Production payment flow
1CreateYour server creates a pending invoice.
2CheckoutRedirect the customer to hosted checkout.
3VerifyGSM Pay verifies provider evidence.
4CallbackYour server validates the signed event.
Keep credentials server-side
Merchant API requests use HTTPS and X-API-KEY. Never expose merchant credentials in browser JavaScript, public HTML or URLs.
Use idempotency for writes.Send one stable
X-Idempotency-Key for every merchant business operation.POST
/api/payment.phpCreate a pending invoice
POST https://pay.gsmpk.com/api/payment.php
Content-Type: application/json
X-API-KEY: YOUR_SERVER_SIDE_API_KEY
X-Idempotency-Key: order-123456-unique
{
"amount": "12.50000000",
"currency": "USDT",
"customer_name": "Customer",
"cus_email": "customer@example.com",
"additional_id": "order-123456",
"callback_url": "https://merchant.example/payment-callback"
}GET
/api/ascertain.phpRead invoice status
GET https://pay.gsmpk.com/api/ascertain.php?invoice_id=INVOICE_REFERENCE X-API-KEY: YOUR_SERVER_SIDE_API_KEY
Send customers to GSM Pay
Use the hosted payment URL returned by the invoice API. GSM Pay presents approved receiving routes and performs server-side payment verification.
A browser return is not proof of payment.Use verified invoice state or a valid signed callback before changing the merchant order.
Validate every callback
expected = HMAC_SHA256(
timestamp + "." + exact_raw_body,
callback_signing_key
)
constant-time compare with X-GSM-Signature
reject stale X-GSM-Timestamp values
consume each X-GSM-Event-ID exactly onceOne secure protocol, multiple platforms
What never proves payment
- Screenshots or edited browser values
- Unsigned callbacks
- Customer-controlled expected amounts
- Browser return URLs
- Raw balance differences
