MyTPEMyTPE Pay
Mytpe Pay

Get Transaction Stats

Retrieves transaction statistics for the authenticated user, optionally filtered by environment.

Get Transaction Stats

GET https://dev.mytpe.app/api/v2/mytpe-pay/stats

Retrieves transaction statistics, such as total volume and transaction counts, for the authenticated user.

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

Example Request

get-transaction-stats.js
const response = await fetch('https://dev.mytpe.app/api/v2/mytpe-pay/stats', {
  method: 'GET',
  headers: {
    'X-API-KEY': '{your_api_key}',
    'X-API-SECRET': '{your_api_secret}',
    'Accept': 'application/json'
  }
});

const data = await response.json();
console.log(data);
get-transaction-stats.ts
interface TransactionStatsResponse {
  success: boolean;
  message: string;
  data: {
    transaction_count: number;
    total_amount: string;
    mytpe_pay_count: number;
  };
}

const response = await fetch('https://dev.mytpe.app/api/v2/mytpe-pay/stats', {
  method: 'GET',
  headers: {
    'X-API-KEY': '{your_api_key}',
    'X-API-SECRET': '{your_api_secret}',
    'Accept': 'application/json'
  }
});

const data: TransactionStatsResponse = await response.json();
console.log(data);
get_transaction_stats.py
import requests

headers = {
    'X-API-KEY': '{your_api_key}',
    'X-API-SECRET': '{your_api_secret}',
    'Accept': 'application/json'
}

response = requests.get(
    'https://dev.mytpe.app/api/v2/mytpe-pay/stats',
    headers=headers
)

data = response.json()
print(data)
GetTransactionStats.php
use Illuminate\Support\Facades\Http;

$response = Http::withHeaders([
    'X-API-KEY' => '{your_api_key}',
    'X-API-SECRET' => '{your_api_secret}',
    'Accept' => 'application/json',
])->get('https://dev.mytpe.app/api/v2/mytpe-pay/stats');

$data = $response->json();
dd($data);
get-transaction-stats.php
$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://dev.mytpe.app/api/v2/mytpe-pay/stats',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-API-KEY: {your_api_key}',
        'X-API-SECRET: {your_api_secret}',
        'Accept: application/json',
    ],
]);

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

$data = json_decode($response, true);
print_r($data);
get-transaction-stats.cjs
const axios = require('axios');

axios.get('https://dev.mytpe.app/api/v2/mytpe-pay/stats', {
  headers: {
    'X-API-KEY': '{your_api_key}',
    'X-API-SECRET': '{your_api_secret}',
    'Accept': 'application/json'
  }
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.error(error.response?.data || error.message);
});

Example Success Response

200 OK

{
  "success": true,
  "message": "Transaction statistics retrieved successfully",
  "data": {
    "transaction_count": 42,
    "total_amount": "15500.50",
    "mytpe_pay_count": 3
  }
}

Response Fields

Prop

Type

Statistics Scope

These statistics include all transaction statuses (pending, completed, failed, etc.) for the specified environment. For revenue calculations, you should filter for completed transactions only using the transactions endpoint.

Error Responses

401 Authentication Failed

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

400 Invalid Environment

{
    "errors": [
        {
            "status": "400",
            "code": "INVALID_ENVIRONMENT",
            "title": "Invalid environment",
            "detail": "The specified environment is not valid"
        }
    ]
}

Use Cases

This endpoint is perfect for:

  • Dashboard Overview: Display high-level statistics on your dashboard
  • Performance Monitoring: Track transaction volume trends
  • Multi-Instance Management: See total activity across all instances
  • Quick Metrics: Get aggregate statistics for reporting

Total Amount Includes Completed Transactions Only

The total_amount field includes transactions of completed status only.

On this page