MyTPEMyTPE Pay
Mytpe Pay

Export Transactions CSV

Downloads a CSV file containing all transactions for a specific Mytpe Pay instance.

Export Transactions CSV

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

Downloads a CSV file of all transactions across all payment links for a given Mytpe Pay instance.

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-transactions.js
const instanceId = '{instance_id}';

const response = await fetch(
  `https://dev.mytpe.app/api/v2/mytpe-pay/${instanceId}/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 = 'transactions.csv';
a.click();
window.URL.revokeObjectURL(url);
export-transactions.ts
const instanceId: string = '{instance_id}';

const response: Response = await fetch(
  `https://dev.mytpe.app/api/v2/mytpe-pay/${instanceId}/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 = 'transactions.csv';
a.click();
window.URL.revokeObjectURL(url);
export_transactions.py
import requests

instance_id = '{instance_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/{instance_id}/export-transactions',
    params={'status': 'completed'},
    headers=headers
)

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

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

$instanceId = '{instance_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/{$instanceId}/export-transactions", [
    'status' => 'completed',
]);

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

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => "https://dev.mytpe.app/api/v2/mytpe-pay/{$instanceId}/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('transactions.csv', $response);
echo "CSV saved to transactions.csv\n";
export-transactions.cjs
const axios = require('axios');
const fs = require('fs');

const instanceId = '{instance_id}';

axios.get(`https://dev.mytpe.app/api/v2/mytpe-pay/${instanceId}/export-transactions`, {
  params: {
    status: 'completed'
  },
  headers: {
    'X-API-KEY': '{your_api_key}',
    'X-API-SECRET': '{your_api_secret}',
  },
  responseType: 'arraybuffer'
})
.then(response => {
  fs.writeFileSync('transactions.csv', response.data);
  console.log('CSV saved to 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 instance."
}

404 Instance Not Found

{
    "error": "No query results for model [MytpePay]."
}

Use Cases

This endpoint is essential for:

  • Accounting & Reconciliation: Export transactions to import into your accounting software
  • Reporting: Generate periodic reports of all payment activity
  • Data Analysis: Analyze transaction patterns in spreadsheet tools (Excel, Google Sheets)
  • Audit Trail: Keep offline records of all transactions for compliance
  • Filtered Exports: Export only completed transactions for revenue reports, or failed transactions for troubleshooting

Instance-Level Export

This endpoint exports transactions from all payment links belonging to the specified instance. If you want to export transactions for a specific payment link, use the Export Link Transactions CSV endpoint instead.

File Size

For instances 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