Merchants
Payment webhooks for merchants
Which payment events to subscribe to, what each means for your order, and how to never ship an unpaid order.
The mechanics of webhooks (registering, verifying signatures, retries, catching up) are in Receiving webhooks. This page is about what a merchant does with each payment event.
The rule that keeps orders safe: a webhook tells you to look; the payment you read tells you what is true. Ship only when a read of the payment says succeeded.
Before you start
An endpoint registered for your application with payment.* and refund.* (add payout.* and settlement.* if you are paid out by KulPay).
The flow at a glance
| # | Who | What happens |
|---|---|---|
| 1 | KulPay | Posts a payment event to your application's endpoint. |
| 2 | Your system | Verifies it, records its ID, answers 2xx. |
| 3 | Your system | Reads the payment and moves the order to the state it says. |
1. Read the payment the event names
Your system, for every payment event.
GET /payments/{provider_payment_id} · API reference
The event carries the payment's IDs. Read the payment and act on its status, not on the event's type alone: events can arrive late or twice, and the read is always current.
2. Move the order
Your system.
payment.succeeded: mark the order paid and fulfil it (once: keep the payment ID with the order).payment.failedorpayment.expired: release the stock and offer another way to pay.payment.requires_action: the customer has a step left; nothing to do.payment.refunded/payment.partially_refunded: record the refund against the order.payment.disputed: a card chargeback was opened; hold the order and gather your evidence.
3. Reconcile what you missed
Your system, daily or after an outage.
GET /v1/events · API reference
Catch up with GET /v1/events?since=<last event id>, so no payment is left unconfirmed in your system.
Events
| Event | What it tells you |
|---|---|
payment.succeeded | Paid. Fulfil the order. |
payment.failed | Not paid. |
payment.expired | Not paid in time. |
payment.requires_action | The customer has a step left. |
payment.refunded | Fully refunded. |
payment.partially_refunded | Partly refunded. |
payment.disputed | A chargeback was opened. |
refund.succeeded | A refund reached the customer. |
Errors that matter here
Every error is application/problem+json with a stable code; branch on the code, not the message. The full list is in the error catalogue.
| Error | When | What to do |
|---|---|---|
404 not_found | The payment read with a key of another mode or application. | Read with the application's key in the event's mode. |
Testing it
Pay a test charge with +258840000005 (succeeds without a webhook) and check your daily reconciliation finds and confirms it.