API Documentation – Payment Gateway
BapokPay PG provides a hosted payment flow with webhook-based confirmation.
Merchants create an order, redirect users to the payment page, and rely on webhook callbacks for final settlement.
1. Base URL
https://pg.bapokpay.com/
2. Create Payment Request
Endpoint
POST /pay/?page=orders&token={MERCHANT_TOKEN}
URL Parameters
| Parameter |
Description |
| page |
Must be orders |
| token |
Merchant token provided during onboarding |
Request Body
{
"authkey": "YOUR_MERCHANT_KEY",
"customer_id": "CUSTOMER_ID",
"order_id": "ORDER_ID",
"amount": "AMOUNT_IN_DECIMAL",
"customer_name": "CUSTOMER_NAME",
"return_url": "https://yourdomain.com/success",
"failure_url": "https://yourdomain.com/failure",
"pay_method": "PAYMENT_METHOD"
}
3. Response Examples
New Request Created
{
"request_status": "Created",
"redirect_url": "https://pg.bapokpay.com/pay/?page=pay&ref=REQUEST_REFERENCE"
}
Already Approved
{
"request_status": "Approved",
"redirect_url": ""
}
Pending Verification
{
"request_status": "Pending-verification",
"redirect_url": ""
}
4. User Redirection
After creating a request, redirect the user to:
https://pg.bapokpay.com/pay/?page=pay&ref=REQUEST_REFERENCE&token={MERCHANT_TOKEN}
5. Webhook
BapokPay will send a webhook notification when payment status changes.
{
"event": "approved",
"order_id": "ORDER_ID",
"request_ref": "REQUEST_REFERENCE",
"amount": "AMOUNT",
"status": "PAYMENT_STATUS",
"utr": "TRANSACTION_REFERENCE",
"timestamp": "ISO8601_TIMESTAMP"
}
6. Important Notes
- Always verify webhook data on your server.
- Do not rely only on return_url for payment confirmation.
- Keep your Merchant Key and Token secure.