POST
/payment
Create a payment

Send your payment creation payload here. Include an order identifier, user id, and customer email so the row can be matched later by the webhook.

Expected request fields

FieldNotes
orderIdRequired. Used as orders.order_id.
amountRequired. Sent to the payment service.
currencyRequired. Example: ZAR.
customer.emailRequired. Passed through to the payment service.
userIdRequired. Stored in payment metadata.

Flow

  1. The API forwards the request to the configured payments service.
  2. The API stores a pending order row in the orders table.
  3. The webhook updates the row when payment status changes.

Webhook

Register this URL in the payment provider dashboard:

/payment/webhook

Webhook payload shape

{
  "event": "charge.success",
  "data": {
    "id": 6181112847,
    "status": "success",
    "reference": "pay-...-ORDER-94-87",
    "currency": "ZAR",
    "metadata": {
      "tenantId": "tenant-uuid",
      "orderId": "ORDER-94",
      "paymentId": "87",
      "userId": "41",
      "customerEmail": "cairnswm@gmail.com"
    }
  }
}

Database schema

The orders and payment_webhook tables must be created before using the payment routes. See scripts/orders.sql and scripts/payment_webhook.sql.