MyTPEMyTPE Pay
Pay Links

Get Pay Link Transactions

Retrieve transactions for a specific payment link.

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

Retrieves a paginated list of transactions associated with a specific payment link.

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

This API requires authentication via X-API-KEY and X-API-SECRET headers.

Path Parameters

Prop

Type

Query Parameters

Prop

Type

Example Request

get-transactions.js
const getTransactions = async () => {
  const url = new URL("https://dev.mytpe.app/api/v2/mytpe-pay/links/f93ccd97-6a7f-4aa3-a6a8-17f1f9fb06bf/transactions");
  url.searchParams.append("per_page", "5");
  url.searchParams.append("status", "completed");

  const response = await fetch(url, {
    method: "GET",
    headers: {
      "X-API-KEY": "your_api_key",
      "X-API-SECRET": "your_api_secret",
    },
  });

  const data = await response.json();
  console.log(data);
};

getTransactions();
get-transactions.ts
interface Transaction {
  id: string;
  transactionable_id: string;
  amount: string;
  status: string;
  payment_method: string;
  name: string;
  email: string;
  created_at: string;
  updated_at: string;
}

interface TransactionsResponse {
  success: boolean;
  message: string;
  data: {
    current_page: number;
    data: Transaction[];
    per_page: number;
    total: number;
    last_page: number;
  };
}

const getTransactions = async (): Promise<void> => {
  const url = new URL("https://dev.mytpe.app/api/v2/mytpe-pay/links/f93ccd97-6a7f-4aa3-a6a8-17f1f9fb06bf/transactions");
  url.searchParams.append("per_page", "5");
  url.searchParams.append("status", "completed");

  const response = await fetch(url, {
    method: "GET",
    headers: {
      "X-API-KEY": "your_api_key",
      "X-API-SECRET": "your_api_secret",
    },
  });

  const data: TransactionsResponse = await response.json();
  console.log(data);
};

getTransactions();
get_transactions.py
import requests

url = "https://dev.mytpe.app/api/v2/mytpe-pay/links/f93ccd97-6a7f-4aa3-a6a8-17f1f9fb06bf/transactions"

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

params = {
    "per_page": 5,
    "status": "completed",
}

response = requests.get(url, headers=headers, params=params)

print(response.json())
GetTransactionsController.php
use Illuminate\Support\Facades\Http;

$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/f93ccd97-6a7f-4aa3-a6a8-17f1f9fb06bf/transactions', [
    'per_page' => 5,
    'status' => 'completed',
]);

$data = $response->json();
get-transactions.php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://dev.mytpe.app/api/v2/mytpe-pay/links/f93ccd97-6a7f-4aa3-a6a8-17f1f9fb06bf/transactions?per_page=5&status=completed',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => [
        'X-API-KEY: your_api_key',
        'X-API-SECRET: your_api_secret',
    ],
]);

$response = curl_exec($curl);

curl_close($curl);
echo $response;
get-transactions.cjs
const axios = require("axios");

axios
  .get("https://dev.mytpe.app/api/v2/mytpe-pay/links/f93ccd97-6a7f-4aa3-a6a8-17f1f9fb06bf/transactions", {
    params: {
      per_page: 5,
      status: "completed",
    },
    headers: {
      "X-API-KEY": "your_api_key",
      "X-API-SECRET": "your_api_secret",
    },
  })
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.error(error);
  });

Example Success Response (200 OK)

200 OK

{
    "success": true,
    "message": "Pay link transactions retrieved successfully",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": "txn-demo-001",
                "transactionable_id": "link-demo-123",
                "transactionable_type": "App\\Models\\MytpePayLink",
                "amount": "2500.00",
                "status": "completed",
                "payment_method": "online",
                "environment": "development",
                "metadata": {
                    "original_slug": "demo-product",
                    "payment_link_id": "link-demo-123",
                    "payment_mode": "reusable",
                    "payment_completion_processed": true,
                    "payment_completion_at": "2026-01-10T15:30:00+01:00",
                    "link_closed_by_this_payment": false
                },
                "name": "John Doe",
                "email": "john@example.com",
                "phone_number": "05912345678",
                "gateway_message": "Payment successful",
                "order_number": "ORD123456",
                "order_id": "gw-order-001",
                "approval_code": "AUTH123",
                "created_at": "2026-01-10T15:25:00.000Z",
                "updated_at": "2026-01-10T15:30:00.000Z",
                "transactionable": {
                    "id": "link-demo-123",
                    "mytpe_pay_id": "instance-001",
                    "title": "Demo Product",
                    "details": "Sample product description",
                    "logo": null,
                    "slug": "demo-product",
                    "type": "dynamic",
                    "amount": "2500.00",
                    "status": "active",
                    "payment_mode": "reusable",
                    "max_payments": null,
                    "successful_payments_count": 1,
                    "metadata": null,
                    "created_at": "2026-01-01T00:00:00.000Z",
                    "updated_at": "2026-01-10T15:30:00.000Z",
                    "payment_link": "https://frontdev.mytpe.app/pay/demo-product"
                }
            }
        ],
        "first_page_url": "https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/transactions?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/transactions?page=1",
        "links": [
            {
                "url": null,
                "label": "\u00ab Previous",
                "active": false
            },
            {
                "url": "https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/transactions?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next \u00bb",
                "active": false
            }
        ],
        "next_page_url": null,
        "path": "https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/transactions",
        "per_page": 5,
        "prev_page_url": null,
        "to": 1,
        "total": 1
    }
}

Response Fields

Transaction Object

Each transaction in the data array contains the following fields:

Prop

Type

Transaction Metadata Object

The metadata field contains additional information about the payment:

Prop

Type

The transactionable field contains the full payment link object:

Prop

Type

Understanding Transaction Lifecycle

  • pending: Customer opened the checkout but hasn't submitted payment yet.
  • processing: Payment submitted, awaiting bank confirmation.
  • completed: Payment successful - money has been captured. Only fulfill orders at this status.
  • failed: Bank rejected the payment (insufficient funds, invalid card, etc.).
  • refunded: Merchant issued a refund for this transaction.
  • refused: Blocked by anti-fraud or compliance rules.

Order Fulfillment Rule

When processing transactions (especially via webhooks), only fulfill orders when status is strictly completed. Do not ship items or deliver services for pending or processing transactions as they may still fail.

Pagination Metadata

Prop

Type

Error Responses

401 Unauthorized

{
    "message": "Unauthenticated."
}

404 Not Found

{
    "success": false,
    "message": "PAY_LINK_NOT_FOUND",
    "code": 404
}

Use Cases

This endpoint is essential for:

  • Transaction History: Display all payments made through a specific payment link
  • Financial Reconciliation: Match transactions with your accounting system using order_number or approval_code
  • Customer Support: Look up transaction details when customers have payment questions
  • Revenue Tracking: Monitor successful payments and total collected amounts per link
  • Auto-Closing Verification: Check if a one_shot or limited link properly closed after reaching its quota

Integration Best Practice

When integrating with webhooks, store the order_number and approval_code in your database. These values are crucial for customer support and payment verification with the bank.

On this page