Skip to main content

Checkout Flow

This page documents how the hosted checkout page at pay.chainpal.org works. Understanding this flow helps you implement proper callback handling and user experience.
Internal API - Not Publicly AvailableThe endpoints described on this page are internal APIs that power ChainPal’s hosted checkout page. They are not part of the Developer API and are not available for direct integration.To accept payments, use the Payments API to create a payment session and redirect customers to the returned paymentURL.

How Hosted Checkout Works

When you create a payment using the Payments API, you receive a paymentURL like:
https://pay.chainpal.org/c/abc123xyz456
When customers visit this URL, the hosted checkout page:
  1. Fetches payment details and available token/network options
  2. Displays your business branding and the payment amount
  3. Allows the customer to select their preferred cryptocurrency and network
  4. Generates a unique deposit address for the transaction
  5. Shows the QR code and address for payment
  6. Polls for payment confirmation
  7. Redirects to your callbackURL on success or failureURL on failure

Internal Endpoints (Reference Only)

Retrieves the payment configuration for a checkout session. This includes supported tokens/networks, amount limits, and business branding.
GET /checkout/:payCode

Path Parameters

ParameterTypeRequiredDescription
payCodestringYesThe 12-character payment code from the checkout URL

Example Request

curl https://api.chainpal.org/checkout/abc123xyz456

Response

{
  "success": true,
  "message": "payment data fetched successfully",
  "data": {
    "id": "507f1f77bcf86cd799439011",
    "customerEmail": "[email protected]",
    "memo": "",
    "paymentReference": "checkoutORDER12345",
    "paymentStatus": "pending",
    "paymentAmount": "5000.00",
    "paymentCurrency": "NGN",
    "supportedTokens": ["USDC", "USDT"],
    "supportedNetworksPerToken": {
      "USDC": ["base", "celo", "polygon"],
      "USDT": ["celo", "polygon"]
    },
    "businessName": "Acme Corp",
    "logoURL": "https://example.com/logo.png",
    "status": "pending",
    "environment": "test",
    "minimumOutputAmount": 1000,
    "maximumOutputAmount": 1000000,
    "minimumUSDAmount": 1,
    "maximumUSDAmount": 2000,
    "createdAt": "2024-01-15T14:00:00Z",
    "updatedAt": "2024-01-15T14:00:00Z"
  }
}

Response Fields

FieldTypeDescription
idstringPayment ID
customerEmailstringCustomer’s email
paymentReferencestringPayment reference
paymentStatusstringCurrent status
paymentAmountstringFiat amount to be paid
paymentCurrencystringFiat currency (NGN, GHS, KES, ZAR, or USD)
supportedTokensarrayAvailable cryptocurrency tokens
supportedNetworksPerTokenobjectMap of token to available networks
businessNamestringMerchant’s business name
logoURLstringURL to merchant’s logo
statusstringPayment status
environmentstringtest or live
minimumOutputAmountnumberMinimum fiat amount allowed
maximumOutputAmountnumberMaximum fiat amount allowed
minimumUSDAmountnumberMinimum USD amount (when collecting in USD)
maximumUSDAmountnumberMaximum USD amount (when collecting in USD)

Complete Checkout

Locks the payment to a specific token/network and generates a deposit address. After calling this endpoint, the customer has a limited time to complete the payment.
POST /checkout/:payCode/complete

Path Parameters

ParameterTypeRequiredDescription
payCodestringYesThe payment code

Request Body

ParameterTypeRequiredDescription
tokenstringYesSelected cryptocurrency (USDT or USDC)
networkstringYesSelected blockchain network

Example Request

curl -X POST https://api.chainpal.org/checkout/abc123xyz456/complete \
  -H "Content-Type: application/json" \
  -d '{
    "token": "USDC",
    "network": "base"
  }'

Response

{
  "success": true,
  "message": "api payment processing",
  "data": {
    "receiveAddress": "0x1234567890abcdef1234567890abcdef12345678",
    "validUntil": "2024-01-15T15:00:00Z",
    "totalPayableAmount": "3.029024"
  }
}

Response Fields

FieldTypeDescription
receiveAddressstringThe deposit address for the customer to send crypto to
validUntilstringISO 8601 timestamp when this address expires
totalPayableAmountstringThe exact crypto amount the customer must send
The customer must send the exact totalPayableAmount to the receiveAddress before validUntil. Underpayments or late payments may not be processed automatically.

Poll Checkout Status

Retrieves the current status of a checkout session. Use this for polling to detect when payment is received.
GET /checkout/:payCode/status

Path Parameters

ParameterTypeRequiredDescription
payCodestringYesThe payment code

Example Request

curl https://api.chainpal.org/checkout/abc123xyz456/status

Response

{
  "success": true,
  "message": "api payment status fetched successfully",
  "data": "pending"
}

Possible Status Values

StatusDescription
pendingWaiting for customer to select token/network
processingPayment received, being processed
completedPayment successful and settled
expiredPayment window expired
failedPayment failed

Checkout Flow