Ptop Payment Gateway API
Official Enterprise Integration & Compliance Manual
1. Executive Summary (API v3)
Ptop API v3 provides enterprise-grade payment processing capabilities including transaction creation, webhook-based confirmation, HMAC signature verification, transaction status queries, and secure merchant wallet payouts. This version introduces strict separation between server-to-server notifications and customer redirection to ensure reliability and integrity.
2. API Base URLs
| Environment | Endpoint |
|---|---|
| Live | POST https://ptop.me/api/v3/payment |
| Sandbox | POST https://ptop.me/api/test/v3/payment |
3. Transaction Creation
| Field | Type | Description |
|---|---|---|
| website_id | string | Merchant identifier |
| secret_key | string | Private authentication key |
| amount | number | Minimum 1 USD |
| currency | string | USD only |
| product | string | Product/service name |
| order_id | string | Merchant order reference |
| webhook_url | url | Server callback endpoint |
| success_url | url | Customer redirect after success |
| fail_url | url | Customer redirect after cancellation |
Example Request
{
"website_id": "your-id",
"secret_key": "your-secret",
"amount": 100.00,
"currency": "USD",
"product": "Premium Plan",
"order_id": "ORD-1001",
"webhook_url": "https://merchant.com/webhook",
"success_url": "https://merchant.com/success",
"fail_url": "https://merchant.com/fail"
}
Example Response
{
"success": true,
"transaction_id": "a93kd82hda",
"payment_url": "https://ptop.me/api/v3/payment/a93kd82hda"
}
Response Code Matrix
| HTTP Code | Meaning |
|---|---|
| 200 | Request successful |
| 400 | Validation error |
| 401 | Unauthorized – Invalid credentials |
| 403 | Signature mismatch |
| 500 | Internal server error |
4. Webhook Delivery Specification
Ptop sends server-to-server POST requests to webhook_url upon transaction update. Your server must return HTTP 200 OK within 10 seconds.
Retry Policy
If no 200 OK is received, Ptop retries delivery up to 3 times with exponential backoff.
Success Payload
{
"success": true,
"transaction_id": "a93kd82hda",
"order_id": "ORD-1001",
"message": "Payment done",
"signature": "HMAC_SIGNATURE"
}
5. Signature Verification (HMAC-SHA256)
You MUST hash the RAW request body exactly as received using your the_signature key.
$rawBody = file_get_contents('php://input');
$calculatedSignature = hash_hmac('sha256', $rawBody, $the_signature);
if (!hash_equals($calculatedSignature, $_POST['signature'])) {
http_response_code(403);
exit('Invalid signature');
}
6. Payment Status Check
POST https://ptop.me/api/v3/payment-check
Request
{
"website_id": "your-id",
"secret_key": "your-secret",
"transaction_id": "a93kd82hda"
}
Response
{
"status": 1,
"amount": 100.00
}
| Status Code | Description |
|---|---|
| 0 | Pending |
| 1 | Paid |
| 2 | Cancelled |
7. Merchant Payout API
POST https://ptop.me/api/api-payout
Sends funds from your merchant wallet to a Ptop user. Payouts are executed instantly: there is no pending state and no approval step from the merchant panel.
Request Fields
| Field | Type | Description |
|---|---|---|
| website_id | string | Merchant identifier |
| secret_key | string | Private authentication key |
| reviverEmail | Email of the receiver's Ptop account | |
| amount | number | Minimum 0.01 USD |
| signature | string | HMAC-SHA256, lowercase hex (see below) |
| sendingTrx | string | Your unique payout reference, max 6 characters. Used for idempotency and status checks. |
Data Concatenation (Exact String to Hash)
website_id|secret_key|reviverEmail|amount
Signature Generation
The key is the Signature Key (the_signature) from your merchant panel, not the secret_key.
$data = $website_id . '|' . $secret_key . '|' . $reviverEmail . '|' . $amount;
$signature = hash_hmac('sha256', $data, $the_signature);
Amount Format in the Signature (Important)
When amount is sent as a JSON number, Ptop signs its shortest form: trailing zeros after the decimal point are removed. A zero in the middle stays. Sign the amount in this form, or you will get 403 Signature mismatch.
| amount sent (JSON number) | Value to sign |
|---|---|
| 2 or 2.00 | 2 |
| 2.50 | 2.5 |
| 2.01 | 2.01 |
| 1.05 | 1.05 |
| 200.00 | 200 |
If you send amount as a JSON string (e.g. "2.00"), it is signed exactly as sent (2.00). In all cases, the value you sign must match the value you send.
// PHP: shortest form of the amount $amountForSignature = rtrim(rtrim(number_format($amount, 2, '.', ''), '0'), '.'); // JavaScript: String() already gives the shortest form const amountForSignature = String(2.50); // "2.5"
Example Request
{
"website_id": "w123456",
"secret_key": "secxyz890",
"reviverEmail": "client@email.com",
"amount": 50,
"signature": "generated_signature",
"sendingTrx": "A1X9T3"
}
String to hash for this example: w123456|secxyz890|client@email.com|50
Success Response (HTTP 200)
{
"status": "success",
"message": "Payment sent successfully.",
"sendingTrx": "A1X9T3",
"trx": "api-A9ARVD6JEPD5",
"amount": 50
}
HTTP 200 with "status": "success" means the funds were moved to the receiver. The payout is final. Do not pay it again manually. Any other response means the payout was not executed and no funds were deducted.
Response Code Matrix
| HTTP Code | message | Meaning |
|---|---|---|
| 200 | Payment sent successfully. | Payout completed |
| 422 | Validation failed. | Invalid fields, or Duplicate request detected (sendingTrx already used) |
| 401 | Unauthorized or sandbox credentials used. | Invalid credentials |
| 403 | Signature mismatch. Untrusted origin. | Wrong signature (check key and amount format) |
| 403 | Insufficient balance. | Not enough funds in your merchant wallet |
| 404 | Receiver user not found. | No Ptop account with this reviverEmail |
| 500 | Internal server error. | Check the status with Payout Status Check before retrying |
Timeouts and Retries
If you get no response (timeout), do not pay manually. Call Payout Status Check with the same sendingTrx, or resend the payout with the same sendingTrx: if the first request was executed, you will get 422 Duplicate request detected.
8. Payout Status Check
POST https://ptop.me/api/payout-check
Returns the status of a payout by its sendingTrx. You can only query payouts sent from your own merchant account.
Request
{
"website_id": "your-id",
"secret_key": "your-secret",
"sendingTrx": "A1X9T3"
}
Response – Completed (HTTP 200)
{
"status": "completed",
"sendingTrx": "A1X9T3",
"trx": "api-A9ARVD6JEPD5",
"amount": 50,
"currency": "USD",
"reviverEmail": "client@email.com",
"created_at": "2026-12-02T06:15:04+00:00",
"message": "Payout completed."
}
Response – Not Executed (HTTP 404)
{
"status": "not_found",
"sendingTrx": "A1X9T3",
"message": "No payout found for this sendingTrx. It was not executed."
}
| HTTP Code | status | Meaning |
|---|---|---|
| 200 | completed | Payout done. Funds moved to the receiver. |
| 404 | not_found | Payout not executed. No funds deducted. Safe to retry with the same sendingTrx. |
| 401 | error | Invalid credentials |
| 422 | error | Validation failed |
created_at is in UTC. Times in the Ptop panel are shown in the platform's local time.
9. Security & Compliance
- HTTPS is mandatory for all endpoints.
- IP whitelisting is recommended.
- All webhooks are signed using HMAC-SHA256.
- Idempotency enforced via sendingTrx (max 6 characters, unique per payout).
- Secret keys must never be exposed client-side.
10. Enterprise Support
api_support@ptop.me
API v2.8 – Legacy Documentation
Welcome to the ptop.me Payment Gateway API. This API allows merchants to process payments securely and efficiently.
Base URL
Live: https://ptop.me/api/payment Sandbox: https://ptop.me/api/test/payment
Generate Transaction ID
| Parameter | Type | Description |
|---|---|---|
| website_id | string | Your unique website identifier |
| secret_key | string | Your secret key |
| amount | numeric | Minimum 1 USD |
| product | string | Product name |
| order_id | string | Unique order identifier |
| currency | string | USD |
| success_url | url | Redirect after success |
| fail_url | url | Redirect after cancel |
Payment Status Check
POST https://ptop.me/api/payment-check
| Status | Description |
|---|---|
| 0 | In Review |
| 1 | Paid |
| 2 | Canceled |
Merchant Payout API
POST https://ptop.me/api/api-payout
Signature: hash_hmac('sha256', "website_id|secret_key|reviverEmail|amount", $the_signature)
Amount in the signature: trailing zeros are removed when amount is sent as a number (2.00 → 2, 2.50 → 2.5, 2.01 → 2.01).
HTTP 200 with "status": "success" means the payout is completed and final. The response includes sendingTrx, trx and amount.
Full details: see section 7 in the v3.0 documentation.
Payout Status Check
POST https://ptop.me/api/payout-check
Request: website_id, secret_key, sendingTrx.
| Status | Description |
|---|---|
| completed (200) | Payout done |
| not_found (404) | Payout not executed, no funds deducted |
Full details: see section 8 in the v3.0 documentation.
Contact Support
api_support@ptop.me