MyTPEMyTPE Pay
Pay Links

Get Pay Link Statistics

Retrieve statistics for a specific payment link.

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

Retrieves detailed statistics for 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-statistics.js
const getStatistics = async () => {
  const url = new URL("https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/statistics");
  url.searchParams.append("time_range", "last_30_days");
  url.searchParams.append("aggregation", "daily");

  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);
};

getStatistics();
get-statistics.ts
interface TimeSeriesEntry {
  date: string;
  pending: number;
  processing: number;
  completed: number;
  failed: number;
  refunded: number;
  refused: number;
}

interface StatisticsResponse {
  success: boolean;
  message: string;
  data: {
    pay_link_id: string;
    pay_link_slug: string;
    total_completed_amount: string;
    time_series_data: TimeSeriesEntry[];
  };
}

const getStatistics = async (): Promise<void> => {
  const url = new URL("https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/statistics");
  url.searchParams.append("time_range", "last_30_days");
  url.searchParams.append("aggregation", "daily");

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

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

getStatistics();
get_statistics.py
import requests

url = "https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/statistics"

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

params = {
    "time_range": "last_30_days",
    "aggregation": "daily",
}

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

print(response.json())
GetStatisticsController.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/link-demo-123/statistics', [
    'time_range' => 'last_30_days',
    'aggregation' => 'daily',
]);

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

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/statistics?time_range=last_30_days&aggregation=daily',
    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-statistics.cjs
const axios = require("axios");

axios
  .get("https://dev.mytpe.app/api/v2/mytpe-pay/links/link-demo-123/statistics", {
    params: {
      time_range: "last_30_days",
      aggregation: "daily",
    },
    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 statistics retrieved successfully",
    "data": {
        "pay_link_id": "link-demo-123",
        "pay_link_slug": "demo-product",
        "total_completed_amount": "12500.00",
        "time_series_data": [
            {
                "date": "2026-01",
                "pending": 2,
                "processing": 1,
                "completed": 15,
                "failed": 3,
                "refunded": 0,
                "refused": 0
            },
            {
                "date": "2025-12",
                "pending": 0,
                "processing": 0,
                "completed": 8,
                "failed": 2,
                "refunded": 1,
                "refused": 0
            }
        ]
    }
}

Error Responses

401 Unauthorized

{
    "message": "Unauthenticated."
}

404 Not Found

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

On this page