Pay2Fast Mobile Recharge Api Selling API Integration Guide
Complete guide for API Users: configuration, IP whitelist, Bearer Token authentication, recharge, transaction status and callback handling.
๐ Quick Start
To enable an API User, first complete the configuration on the API Configuration page. An API request is accepted only when the token, API User status, callback URL, and source IP all pass validation.
โ๏ธ API Configuration
After logging in as an API User, configure the following information from Sidebar โ API Configuration.
| Field | Required | What to enter |
|---|---|---|
| Response / Callback Page | Yes | Your server's public http:// or https:// callback URL |
| IP Address 1 | Yes | The server IP from which API requests will originate |
| IP Address 2 | No | Second authorized server IP |
| IP Address 3 | No | Third authorized server IP |
| API Token | Yes | Create it using Generate Token |
| PIN | Yes on configuration | Your configuration PIN |
๐ Authentication
Every customer API request must send the generated API Token as a Bearer Token.
Authorization: Bearer YOUR_API_TOKEN Content-Type: application/json Accept: application/json
๐ฑ Recharge API
POST /api/v1/recharge.phpUse this endpoint to create a mobile recharge request.
Request Body
| Field | Required | Example / Notes |
|---|---|---|
mobile | Yes | 10 digit mobile number |
operator | Yes | JIO, AIRTEL, VI, etc. |
operator_code | Recommended | Canonical operator code |
amount | Yes | Recharge amount, e.g. 199 |
client_txn_id | Yes | Your unique order/reference ID |
service_type | No | Default: prepaid |
curl -X POST "https://samadigital.us.cc/api/v1/recharge.php" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"mobile": "9876543210",
"operator": "JIO",
"operator_code": "JIO",
"service_type": "prepaid",
"amount": 199,
"client_txn_id": "ORDER-10001"
}'Typical Response
{
"status": "pending",
"transaction_id": "RCH_123",
"client_txn_id": "ORDER-10001",
"provider_txn_id": null,
"message": "Accepted"
}
failed, the amount is automatically refunded.๐ Transaction Status API
GET /api/v1/status.php?transaction_id=RCH_123Use this endpoint to get the latest status of a recharge transaction. An API User can only view their own transactions.
curl -X GET "https://samadigital.us.cc/api/v1/status.php?transaction_id=RCH_123" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Accept: application/json"
{
"status": "success",
"transaction_id": "RCH_123",
"client_txn_id": "ORDER-10001",
"provider_txn_id": "PROV-778899"
}
Possible status: pending, success, failed.
๐ฉ Your Response / Callback URL
When a transaction result is available, Pay2Fast sends a JSON POST to the URL configured under the API User's API Configuration โ Response / Callback Page.
POST https://your-domain.com/api/callback.php
Content-Type: application/json
{
"status": "success",
"transaction_id": "RCH_123",
"client_txn_id": "ORDER-10001",
"provider_txn_id": "PROV-778899",
"message": "Recharge successful"
}
200 response and update the transaction using the same client_txn_id. Your application should handle duplicate callbacks safely.๐ Provider Callback Endpoint
POST /api/v1/callback.phpThis is for the upstream recharge provider โ Pay2Fast callback. It is different from the API User's own callback URL.
POST https://samadigital.us.cc/api/v1/callback.php
Content-Type: application/json
X-Callback-Signature: YOUR_HMAC_SHA256_SIGNATURE
{
"transaction_id": "RCH_123",
"client_txn_id": "ORDER-10001",
"provider_txn_id": "PROV-778899",
"status": "success",
"message": "Recharge successful"
}
If a callback secret is configured under Admin โ API Providers, generate an HMAC-SHA256 signature from the exact raw JSON body and send it in the X-Callback-Signature header.
failed for the first time, the debited recharge amount is refunded to the wallet. Repeated failed callbacks do not trigger duplicate refunds.๐ Supported Operator Codes
| Operator Code | Operator | Service |
|---|---|---|
AIRTEL | Airtel | Prepaid |
JIO | Reliance Jio | Prepaid |
VI | Vodafone Idea (Vi) | Prepaid |
BSNL | BSNL | Prepaid |
MTNL | MTNL | Prepaid |
If the provider uses its own operator IDs, Admin-side mapping can translate them into the provider code.
โ ๏ธ HTTP Response Codes
| HTTP | Meaning | Common reason |
|---|---|---|
| 200 | Success / processed | Request accepted or status returned |
| 400 | Bad Request | Invalid JSON body |
| 401 | Unauthorized | Missing or invalid Bearer Token |
| 402 | Payment Required | Insufficient wallet balance |
| 403 | Forbidden | Inactive user, callback not configured, or IP not authorized |
| 405 | Method Not Allowed | Wrong HTTP method |
| 422 | Validation Error | Missing/invalid request field |
| 502 | Provider Error | Upstream provider failure |
๐ป PHP Server-to-Server Example
<?php
$token = 'YOUR_API_TOKEN';
$url = 'https://samadigital.us.cc/api/v1/recharge.php';
$data = [
'mobile' => '9876543210',
'operator' => 'JIO',
'operator_code' => 'JIO',
'service_type' => 'prepaid',
'amount' => 199,
'client_txn_id' => 'ORDER-10001'
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
'Accept: application/json'
],
CURLOPT_POSTFIELDS => json_encode($data)
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n";
echo $response;JavaScript / Browser Note
๐ก๏ธ Security Checklist
๐ Integration Support
If you have an issue with API configuration, authentication, recharge, callbacks, or transaction status, check your API User account and request/response details. Never share the secret token, PIN, or callback secret publicly.