Using the Service

Recommended integration flow from your backend to checkout and then fulfillment.

  1. Create the order in your own system (status pending).
  2. Call POST /payment with X-Tenant-ID, X-APIKEY, and order/payment data.
  3. Store returned paymentId and redirectUrl against your order.
  4. Return redirectUrl to frontend and redirect user to provider checkout.
  5. User is redirected to your success/cancel pages after payment action.
  6. Your /payment/webhook endpoint receives updates and finalizes order fulfilment.

Create Payment Example

POST /payment
Content-Type: application/json
X-Tenant-ID: TENANT_ABC
X-APIKEY: TENANT_API_KEY

{
  "orderId": "order-1001",
  "amount": 199.99,
  "currency": "ZAR",
  "userId": 42,
  "successUrl": "https://your-app.com/payment/success",
  "cancelUrl": "https://your-app.com/payment/cancel"
}
{
  "data": {
    "paymentId": 321,
    "redirectUrl": "https://provider-checkout-url"
  },
  "provider": "paystack"
}