Skip to content

Payment flow

This page explains what happens between creating a charge and fulfilling an order, and how to handle each outcome.

Your server NogorPay API Customer Hosted checkout
| | | |
|-- POST /charge/create -> | |
|<-- payment_url -------| | |
|------------- redirect to payment_url ------->|------------------------>|
| | | pays with bKash/Nagad |
| |<----------------- TrxID submitted --------------|
|<- webhook charge.completed | |
| | |<-- redirect_url --------|
|-- GET /charge/verify -> (optional check) | |
pending ──► verifying ──► completed
│
├──► cancelled (customer cancelled)
└──► expired (checkout closed before payment)
Status Webhook Final?
pending None No
verifying None No
completed charge.completed Yes
cancelled charge.cancelled Yes
expired None Yes
  1. Create the order first in your database with status awaiting_payment.
  2. Create the charge with your order_id and a webhook_url. Store the returned invoice_id on the order.
  3. Redirect the customer to payment_url.
  4. Handle the webhook. On charge.completed, verify the signature, check that amount equals the order total, and mark the order as paid. Ignore duplicates.
  5. Handle the return. When the customer lands on your redirect_url, show the order status from your database. If the webhook hasn’t arrived yet, call Verify a charge once and show “Payment processing” if it’s still verifying.
  6. Handle cancel and expiry. On cancel_url or after expires_at, offer a Try again button that creates a new charge.

To show your own bKash and Nagad buttons:

  1. Call List payment methods and render a button for each method, using logo and name.
  2. Hide or disable a method if the order total is below min_amount or above max_amount.
  3. When the customer picks one, create the charge with payment_method set to the method’s provider, for example bkash. The checkout opens directly on that method.

If you run more than one store or website, create a brand for each in the dashboard. Pass brand_id when you create a charge so the checkout shows the right name and logo and uses that brand’s gateways. Without brand_id, NogorPay uses your default brand.