Payment Lifecycle
Every payment in Open Pay follows a predictable lifecycle. This guide walks through each stage, from the moment a merchant creates a payment to the final webhook notification.Payment Status States
| Status | Description |
|---|---|
initiated | Payment created, awaiting customer interaction |
pending | Customer has opened the checkout page |
confirming | Transaction detected on-chain, waiting for block confirmations |
paid | Payment confirmed and settled |
failed | Transaction reverted or rejected on-chain |
expired | Payment TTL exceeded without completion (default: 30 minutes) |
Step-by-Step Flow
Merchant Creates Payment
The merchant creates a payment via the API or an SDK. The response includes a Response:
payment_id and a checkout_url.Customer Sees Checkout Page
Redirect the customer to
checkout_url or embed it in an iframe. The checkout page displays:- Order summary (amount, description)
- Token selection (USDT, USDC, BNB)
- QR code with the wallet address and exact amount
- Countdown timer until expiration
initiated to pending when the customer opens the checkout page.The QR code encodes a BEP-20 transfer with the exact token amount pre-filled, so the customer only needs to scan and confirm in their wallet.
Customer Sends Crypto
The customer scans the QR code or copies the wallet address and sends the payment from their crypto wallet. Supported tokens on BSC:
| Token | Contract | Decimals |
|---|---|---|
| USDT | BEP-20 on BSC | 18 |
| USDC | BEP-20 on BSC | 18 |
| BNB | Native | 18 |
On-Chain Confirmation
Open Pay’s provider service monitors the blockchain for incoming transactions. Once a matching transaction is detected:
- Status moves to
confirming - The platform waits for the required number of block confirmations (default: 12 blocks on BSC, approximately 36 seconds)
- The smart contract escrow verifies the amount matches using Chainlink price feeds
For BNB payments, the Chainlink oracle converts the BNB amount to USD in real-time with configurable slippage tolerance (default: 1%).
Payment Confirmed & Settlement
Once block confirmations are met and the escrow contract validates the payment:
- Payment status moves to
paid - Funds are held in the merchant’s settlement balance
- The merchant can withdraw to their configured wallet or bank account
Polling vs Webhooks
You can track payment status using two approaches:- Webhooks (Recommended)
- Polling
Configure a webhook endpoint and listen for
payment.completed, payment.failed, or payment.expired events. This is the most efficient and reliable approach.Handling Edge Cases
Payment Expires
Payment Expires
If the customer does not complete the payment within the TTL (default 30 minutes), the status moves to
expired. You can create a new payment and redirect the customer again.Underpayment
Underpayment
If the customer sends less than the required amount, the payment remains in
pending. The checkout page will show the remaining balance. If the TTL expires, the partial amount is refunded automatically.Overpayment
Overpayment
If the customer sends more than required, the payment is marked
paid for the original amount. The excess is credited to the merchant’s settlement balance.Network Congestion
Network Congestion
During high network congestion, block confirmations may take longer. The
confirming state will persist until the required confirmations are met. The TTL timer pauses once a transaction is detected on-chain.