Skip to content

Create Payment

POST /api/payments/create

Create a balance-recharge payment for your account. You receive a hosted payment URL — send your payer there, and after payment the payer is redirected to your custom success page.

Requirement: the hostname of your success_url (and cancel_url, if used) must be registered on our side before use (contact support to allowlist your domain, e.g. shop.example.com). Requests with unregistered hosts are rejected with 422.

Parameter Type Required Description
amount number Yes Amount in BDT. Minimum 20.
success_url string Yes HTTPS URL on an allowlisted host. Payer is sent here after payment.
cancel_url string No HTTPS URL on an allowlisted host. Payer is sent here if they cancel.
Terminal window
curl -X POST https://api.awajdigital.com/api/payments/create \
-H "Authorization: Bearer your_api_token_here" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"amount": 500,
"success_url": "https://shop.example.com/payment/success",
"cancel_url": "https://shop.example.com/payment/cancel"
}'
{
"success": true,
"payment_url": "https://pay.example.com/checkout/9f8b7c6d-...",
"invoice_id": "9f8b7c6d-..."
}

Redirect your payer to payment_url. After payment, the flow is:

  1. The payment gateway returns the payer to our server first (this guarantees the balance is credited even if the webhook is missed).
  2. We immediately redirect the payer to your success_url with two query parameters appended:
    • invoice_id — the payment reference
    • status — completed or pending
Status Description
401 Missing or invalid access token
403 Payment API not enabled for your account
422 Validation failed (amount < 20, non-https URL, non-allowlisted host)
502 Gateway error — payment could not be created