Skip to main content
A refund settles asynchronously, so webhooks are how you learn the outcome. See Webhook deliveries for the transport, signing, and retry rules that apply to every event.

The four events

A single state change produces two deliveries: the broad refund.updated and the specific refund.successful or refund.failed.
Drive business logic from refund.successful and refund.failed, and keep refund.updated as an audit feed.
Deliveries are queued, so they can arrive out of order, and refund.created can reach you before your POST /v1/refunds call returns. Decide from data.status, not from which event landed first.

Payload

The envelope is the standard webhook envelope. data is the Refund object, exactly as GET /v1/refunds/{refundUid} returns it.
refund.successful
refund.updated is the only refund event that carries changed_fields, a map of each changed key to its previous value. Together with data it gives you both sides of the transition:

Failures

On refund.failed, error tells you whether a retry is worth it.
A refund also moves money on the payment, so expect ugwo.activity.updated and ugwo.updated alongside the refund events whenever refunded_amount or a status changes. See what a refund does to the payment.

Handling refunds safely

  • Acknowledge fast. Verify X-Kwugwo-Signature, queue the event, return 200. A slow handler burns one of your three delivery attempts.
  • Deduplicate on the envelope uid. Retries reuse it. Note that refund.updated and refund.successful describe the same transition under different envelope IDs, so dedupe protects you from replays, not from the two-event pattern.
  • Make the effect idempotent on data.uid. Key your bookkeeping on the refund ID so a credit happens once, however many events mention it.
  • Re-fetch before anything expensive. data is a snapshot from when the event fired; pull GET /v1/refunds/{uid} if your worker runs later.
  • Accept unfamiliar refunds. Refunds created outside the API arrive with ref: null for refunds you never requested. Record them.
Node (Express)
Never credit a customer on refund.created or on a processing status. Only successful means the money has gone back.