Transaction Details
Endpoint
https://api.betatel.com/api/billing/me/transactions/:transactionId
Method: GET
Description: Get detailed information about a specific transaction.
Path Parameters:
transactionId
: The unique identifier for the transaction
Request Headers
The request must include an Authorization header with a valid API key for authentication:
Header | Value | Required | Description |
---|---|---|---|
x-api-key | {{x-api-key}} | Yes | The authentication api key to verify the user's identity |
Let’s Dive Into the Code!
Choose your preferred programming language and use the provided examples to integrate the get transaction details.
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
Example - cURL
curl --location 'https://api.betatel.com/api/billing/me/transactions/txn_id' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow' \
--header 'x-api-key: ••••••'
Example - Python
import http.client
conn = http.client.HTTPConnection("api.betatel.com")
payload = ''
headers = {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow',
'x-api-key': '••••••'
}
conn.request("GET", "/api/billing/me/transactions/txn_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Example - Node.js
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://api.betatel.com/api/billing/me/transactions/txn_id',
headers: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow',
'x-api-key': '••••••'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Example - PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.betatel.com/api/billing/me/transactions/txn_id',
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 => array(
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow',
'x-api-key: ••••••'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example - Java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.betatel.com/api/billing/me/transactions/txn_id")
.header("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow")
.header("x-api-key", "••••••")
.asString();
Example - C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.betatel.com/api/billing/me/transactions/txn_id");
request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow");
request.Headers.Add("x-api-key", "••••••");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Response
JSON Schema:
{
"transactionId": "txn_78901",
"correlationId": "evt_b4f82932",
"userId": "user123",
"serviceId": "svc_mobile_sms",
"type": "service_usage",
"description": "SMS delivery to UK mobile",
"datetime": "2025-03-18T14:32:15Z",
"unitPrice": 0.012,
"quantity": 142,
"value": 1.70,
"currency": "USD",
"metadata": {
"destination": "+4412345678",
"mcc_mnc": "234-15",
"completion_status": "delivered",
"delivery_timestamp": "2025-03-18T14:32:10Z"
},
"events": [
{
"eventId": "evt_auth_b4f82932",
"type": "SERVICE_REQUEST_INITIATED",
"timestamp": "2025-03-18T14:32:05Z"
},
{
"eventId": "evt_usage_b4f82932",
"type": "SERVICE_EXECUTION_COMPLETED",
"timestamp": "2025-03-18T14:32:12Z"
}
]
}
Field | Type | Description |
---|---|---|
transactionId | string | A unique identifier for the transaction (e.g., "txn_78901"). |
correlationId | string | A unique identifier for the authorization request (e.g., "evt_b4f82932"). |
userId | string | The unique identifier for the user (e.g., "user123"). |
serviceId | string | The identifier for the service associated with the transaction (e.g., "svc_mobile_sms"). |
type | string | The type of transaction (e.g., "service_usage"). |
description | string | A description of the transaction (e.g., "SMS delivery to UK mobile"). |
datetime | string | The timestamp of when the transaction occurred (e.g., "2025-03-18T14:32:15Z"). |
unitPrice | number | The price per unit for the service (e.g., 0.012). |
quantity | number | The quantity of the service used (e.g., 142). |
value | number | The total value of the transaction (e.g., 1.70). |
currency | string | The currency in which the transaction is represented (e.g., "USD"). |
metadata | object | Additional information about the transaction, including: |
- destination | string | The destination number for the service (e.g., "+4412345678"). |
- mcc_mnc | string | The mobile country code and mobile network code (e.g., "234-15"). |
- completion_status | string | The status of the transaction (e.g., "delivered"). |
- delivery_timestamp | string | The timestamp of when the service was delivered (e.g., "2025-03-18T14:32:10Z"). |
events | array | A list of events associated with the transaction, including: |
- eventId | string | A unique identifier for the event (e.g., "evt_auth_b4f82932"). |
- type | string | The type of event (e.g., "SERVICE_REQUEST_INITIATED"). |
- timestamp | string | The timestamp of when the event occurred (e.g., "2025-03-18T14:32:05Z"). |