MyTPEMyTPE Pay
Pay Links

Export Link Transactions CSV

Downloads a CSV file containing all transactions for a specific payment link.

Export Link Transactions CSV

GET https://dev.mytpe.app/api/v2/mytpe-pay/links/{id}/export-transactions

Downloads a CSV file of all transactions for a specific payment link.

Authentication

Authentication: API Key (X-API-KEY + X-API-SECRET headers)

This endpoint requires authentication using X-API-KEY and X-API-SECRET headers.

X-API-KEY: {your_api_key}
X-API-SECRET: {your_api_secret}

Request Parameters

Path Parameters

Prop

Type

Query Parameters

Prop

Type

Example Request

export-link-transactions.js
const linkId = '{link_id}';

const response = await fetch(
  `https://dev.mytpe.app/api/v2/mytpe-pay/links/${linkId}/export-transactions?status=completed`,
  {
    method: 'GET',
    headers: {
      'X-API-KEY': '{your_api_key}',
      'X-API-SECRET': '{your_api_secret}',
    }
  }
);

// Download the CSV file
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'link-transactions.csv';
a.click();
window.URL.revokeObjectURL(url);
export-link-transactions.ts
const linkId: string = '{link_id}';

const response: Response = await fetch(
  `https://dev.mytpe.app/api/v2/mytpe-pay/links/${linkId}/export-transactions?status=completed`,
  {
    method: 'GET',
    headers: {
      'X-API-KEY': '{your_api_key}',
      'X-API-SECRET': '{your_api_secret}',
    }
  }
);

// Download the CSV file
const blob: Blob = await response.blob();
const url: string = window.URL.createObjectURL(blob);
const a: HTMLAnchorElement = document.createElement('a');
a.href = url;
a.download = 'link-transactions.csv';
a.click();
window.URL.revokeObjectURL(url);
export_link_transactions.py
import requests

link_id = '{link_id}'

headers = {
    'X-API-KEY': '{your_api_key}',
    'X-API-SECRET': '{your_api_secret}',
}

response = requests.get(
    f'https://dev.mytpe.app/api/v2/mytpe-pay/links/{link_id}/export-transactions',
    params={'status': 'completed'},
    headers=headers
)

# Save to file
with open('link-transactions.csv', 'wb') as f:
    f.write(response.content)

print('CSV saved to link-transactions.csv')
ExportLinkTransactions.php
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;

$linkId = '{link_id}';

$response = Http::withHeaders([
    'X-API-KEY' => '{your_api_key}',
    'X-API-SECRET' => '{your_api_secret}',
])->get("https://dev.mytpe.app/api/v2/mytpe-pay/links/{$linkId}/export-transactions", [
    'status' => 'completed',
]);

// Save to file
Storage::put('link-transactions.csv', $response->body());
export-link-transactions.php
$linkId = '{link_id}';

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => "https://dev.mytpe.app/api/v2/mytpe-pay/links/{$linkId}/export-transactions?status=completed",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-KEY: {your_api_key}',
        'X-API-SECRET: {your_api_secret}',
    ],
]);

$response = curl_exec($ch);
curl_close($ch);

// Save to file
file_put_contents('link-transactions.csv', $response);
echo "CSV saved to link-transactions.csv\n";
export-link-transactions.cjs
const axios = require('axios');
const fs = require('fs');

const linkId = '{link_id}';

axios.get(`https://dev.mytpe.app/api/v2/mytpe-pay/links/${linkId}/export-transactions`, {
  params: {
    status: 'completed'
  },
  headers: {
    'X-API-KEY': '{your_api_key}',
    'X-API-SECRET': '{your_api_secret}',
  },
  responseType: 'arraybuffer'
})
.then(response => {
  fs.writeFileSync('link-transactions.csv', response.data);
  console.log('CSV saved to link-transactions.csv');
})
.catch(error => {
  console.error(error.response?.data || error.message);
});

Response

The response is a CSV file download (not JSON). The file contains the following columns:

CSV Columns

Prop

Type

Example CSV Output

Order Number,Amount,Status,Payment Method,Name,Email,Phone,Gateway Message,Metadata,Created At,Updated At
14RUMO0J7E,5000.00,completed,online,John Doe,john@example.com,0551234567,Transaction approved,"{""reference"":""REF123""}",2026-02-24 15:47:43,2026-02-24 15:50:12
15ABCD1234,2500.00,pending,online,Jane Smith,jane@example.com,0667891234,,"",2026-02-25 09:12:00,2026-02-25 09:12:00

Error Responses

401 Authentication Failed

{
    "errors": [
        {
            "status": "401",
            "code": "API_KEY_INVALID",
            "title": "Invalid API key",
            "detail": "Authentication failed. Please check your API credentials."
        }
    ]
}

403 Forbidden

{
    "error": "You do not have permission to access this payment link."
}
{
    "error": "No query results for model [MytpePayLink]."
}

Use Cases

This endpoint is essential for:

  • Per-Link Reporting: Export transactions for a single payment link to track its performance
  • Accounting & Reconciliation: Import link-specific transactions into your accounting software
  • Data Analysis: Analyze transaction patterns for individual links in spreadsheet tools (Excel, Google Sheets)
  • Audit Trail: Keep offline records of transactions per link for compliance
  • Filtered Exports: Export only completed transactions for revenue reports, or failed transactions for troubleshooting

Link-Level Export

This endpoint exports transactions for a single payment link. To export transactions from all payment links in an instance, use the Export Instance Transactions CSV endpoint.

File Size

For links with a large number of transactions, the CSV file may take a few seconds to generate. The response will stream the file as a download.

On this page