1. Create the invoice on your backend
Send the invoice currency, amount, your order reference, an idempotency key, and
the callback URL.
Persist at least:
- The invoice
id
order_no
- The idempotency key used for the attempt
- The current invoice
status
- The invoice expiration time, when
expires_at is not null
2. Redirect to the hosted page
Use the invoice_url from the response:
Do not construct or modify this URL yourself.
3. Treat the callback as a notification
When the callback arrives, extract the invoice identifier and retrieve that
invoice from the authenticated API. Callback delivery may be duplicated or
delayed, so processing must be idempotent.
4. Update your order from the API response
The invoice status can include:
Status mapping is a business decision. Do not fulfill goods or services until
your backend has retrieved a completed invoice from the API.
5. Make completion idempotent
Callbacks and status checks can run more than once. Use a transaction or
conditional update so inventory, emails, and fulfillment happen only on the
first transition to paid.