Skip to main content

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

StatusDescription
initiatedPayment created, awaiting customer interaction
pendingCustomer has opened the checkout page
confirmingTransaction detected on-chain, waiting for block confirmations
paidPayment confirmed and settled
failedTransaction reverted or rejected on-chain
expiredPayment TTL exceeded without completion (default: 30 minutes)

Step-by-Step Flow

1

Merchant Creates Payment

The merchant creates a payment via the API or an SDK. The response includes a payment_id and a checkout_url.
curl -X POST https://olp-api.nipuntheekshana.com/v1/payments \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "25.00",
    "currency": "USD",
    "accepted_tokens": ["USDT", "USDC", "BNB"],
    "description": "Order #1042",
    "metadata": {
      "order_id": "1042",
      "customer_email": "buyer@example.com"
    }
  }'
Response:
{
  "id": "pay_abc123",
  "status": "initiated",
  "amount": "25.00",
  "currency": "USD",
  "checkout_url": "https://olp-api.nipuntheekshana.com/checkout/pay_abc123",
  "expires_at": "2026-03-26T13:30:00Z",
  "created_at": "2026-03-26T13:00:00Z"
}
2

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
The payment status transitions from 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.
3

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:
TokenContractDecimals
USDTBEP-20 on BSC18
USDCBEP-20 on BSC18
BNBNative18
The customer must send the exact amount displayed. Partial payments are not accepted and will not be credited automatically.
4

On-Chain Confirmation

Open Pay’s provider service monitors the blockchain for incoming transactions. Once a matching transaction is detected:
  1. Status moves to confirming
  2. The platform waits for the required number of block confirmations (default: 12 blocks on BSC, approximately 36 seconds)
  3. 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%).
5

Payment Confirmed & Settlement

Once block confirmations are met and the escrow contract validates the payment:
  1. Payment status moves to paid
  2. Funds are held in the merchant’s settlement balance
  3. The merchant can withdraw to their configured wallet or bank account
You can check the payment status at any time:
curl https://olp-api.nipuntheekshana.com/v1/payments/pay_abc123 \
  -H "Authorization: Bearer sk_live_..."
6

Webhook Notification

Open Pay fires a payment.completed webhook to the merchant’s configured endpoint. The payload is signed with ED25519 for verification.
{
  "event": "payment.completed",
  "payment_id": "pay_abc123",
  "status": "paid",
  "amount": "25.00",
  "currency": "USD",
  "token": "USDT",
  "tx_hash": "0xabc123...",
  "paid_at": "2026-03-26T13:02:15Z",
  "metadata": {
    "order_id": "1042",
    "customer_email": "buyer@example.com"
  }
}
Always verify the webhook signature before processing. See the Webhooks Guide for implementation details.

Polling vs Webhooks

You can track payment status using two approaches:

Handling Edge Cases

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.
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.
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.
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.