Payment Status

Monitor payment status through API calls or webhooks. The payment gateway tracks payments from creation through blockchain confirmations to final settlement.

Payment Status Lifecycle

stateDiagram-v2
    [*] --> OPEN: Payment Created
    OPEN --> FOUND: Transaction Detected
    FOUND --> RECEIVED: Confirmed on Blockchain
    FOUND --> UNDERPAID: Insufficient Amount
    RECEIVED --> CONFIRMED: Webhook Sent Successfully
    UNDERPAID --> RECEIVED: Additional Payment
    OPEN --> CANCELLED: Merchant Cancelled
    OPEN --> ERROR: Processing Error
    CONFIRMED --> REFUND: Refund Processed

Status Values

StatusDescriptionNext Actions
OPENPayment created, awaiting paymentMonitor for transaction
FOUNDTransaction detected on blockchain, awaiting confirmationsWait for blockchain confirmations
UNDERPAIDReceived less than the requested amountRequest additional payment or accept
RECEIVEDFull payment received and confirmed on blockchainAwait webhook confirmation
CONFIRMEDPayment confirmed, merchant webhook executedDeliver goods/services
CANCELLEDPayment cancelled by merchantNo action needed
ERRORError during payment processingInvestigate and retry
REFUNDPayment has been refundedProcess refund in your system

Get Payment Status

Single Payment

GET /api/payment/{paymentId}
Authorization: Bearer YOUR_TOKEN

Response:

{
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "status": "CONFIRMED",
    "reference": "ORDER-123",
    "referenceLabel": "Order #123",
    "currencyCode": "USD",
    "amount": {
      "value": 100.00,
      "amount": 10000,
      "formatted": "$100.00"
    },
    "receivedAmount": {
      "value": 100.00,
      "amount": 10000,
      "formatted": "$100.00"
    },
    "confirmedAt": "2026-01-15T10:30:00Z",
    "foundAt": "2026-01-15T10:15:00Z",
    "date": "2026-01-15T10:00:00Z"
  }
}

Status Updates via Webhooks

Configure webhooks to receive automatic status notifications:

EventTriggered When
payment.receivedFunds received and confirmed on blockchain
payment.completedPayment fully confirmed (webhook executed)
payment.underpaidReceived amount is less than requested
payment.refundRefund completed

See Webhook Setup for configuration details.

Polling for Status

If webhooks are not configured, you can poll for status changes:

async function pollPaymentStatus(paymentId, apiKey) {
  const interval = 5000; // 5 seconds
  const timeout = 3600000; // 1 hour
  const startTime = Date.now();

  const poll = async () => {
    const response = await fetch(`https://api.yourdomain.com/api/payment/${paymentId}`, {
      headers: { Authorization: `Bearer ${apiKey}` }
    });

    const data = await response.json();
    const status = data.data.status;

    if (['CONFIRMED', 'CANCELLED', 'ERROR', 'REFUND'].includes(status)) {
      return data.data; // Terminal state
    }

    if (Date.now() - startTime > timeout) {
      throw new Error('Polling timeout');
    }

    await new Promise((resolve) => setTimeout(resolve, interval));
    return poll();
  };

  return poll();
}

Handling Edge Cases

Underpayment

When a payment is underpaid, the UNDERPAID status is set. If allowUnderpay is enabled for the payment application, the payment may still be accepted.

Refunds

Refund requests are created separately via the refund request endpoint. Once processed, the payment status changes to REFUND.

Best Practices

  1. Use webhooks instead of polling for real-time updates
  2. Always verify payment status via API before fulfilling orders
  3. Handle all status values in your integration
  4. Log status changes for audit and debugging
  5. Implement idempotent handlers for webhook events

Next Steps