Events
Every delivery shares the same top-level envelope — id, type, environment, createdAt, and
data — so one handler can switch on type without learning a new wrapper for each event family.
What changes is the shape of data: payment events, subscription events, disputes, and late
successes each carry their own.
The envelope
{
"id": "evt_3f0c1a2e-...",
"type": "payment.succeeded",
"environment": "test",
"createdAt": "2026-08-26T10:15:00Z",
"data": {}
}| Field | Meaning |
|---|---|
id | evt_… — this delivery’s identity. Automatic retries reuse it; a manual re-send does not. |
type | The event type. Compare it against PlatformEventType rather than a string literal. |
environment | "test" for test-mode activity, "live" for real money. Present on every delivery. |
createdAt | When the event happened. |
data | The event body. |
Two optional flags can also appear at the top level:
| Field | Meaning |
|---|---|
test: true | This delivery came from the webhook simulator, not from a real payment. Always paired with environment: "test". |
manualRetry: true | This is a re-send you triggered for a payment (dashboard or payments.retryWebhook()), rebuilt from the payment’s current state. It carries a new id, so dedupe on data.paymentId + type rather than the event id if you process manual re-sends. |
Payment events
{
"id": "evt_...",
"type": "payment.succeeded",
"environment": "test",
"createdAt": "2026-08-26T10:15:00Z",
"data": {
"paymentId": "pay_...",
"status": "succeeded",
"direction": "inbound",
"amount": { "amount": "50000", "currency": "KES", "formatted": "KSh 500.00" },
"method": "mobile_money_push",
"provider": "mpesa",
"reference": "INV-001",
"customer": { "phone": "254712345678", "email": null },
"completedAt": "2026-08-26T10:15:32Z",
"failure": null,
"metadata": { "orderId": "ORD-123" },
"providerDetails": {}
}
}amount.amount is an integer string in minor units — 50000 is KES 500.00. provider, method,
and direction are on every payment event, so you never have to special-case a provider to read the
top-level fields. providerDetails is the one place provider-specific data lives, and you only need
it for support investigations.
| Event | Fires when | First real delivery? |
|---|---|---|
payment.initiated | In the catalogue only. No real payment emits it — created payments start at payment.pending. | No |
payment.pending | The prompt reached the customer; awaiting their action. | Yes |
payment.succeeded | The customer completed the payment. | |
payment.failed | The payment failed — see data.failure.code. | |
payment.cancelled | The customer dismissed the prompt. | |
payment.expired | The prompt timed out unanswered. | |
payment.reversed | A provider-initiated reversal. | |
payment.refunded | A refund was issued — read its semantics before you build on it. | |
payment.disputed | A chargeback/dispute was opened (Paystack) — own shape. | |
payment.late_success | Money arrived for a payment already marked failed — own shape. |
These describe collections (direction: "inbound"). Payouts share the payment record internally
but are not delivered to merchant endpoints — see events you won’t receive.
A payment moves to one terminal state — succeeded, failed, cancelled, expired, or reversed
after a full refund — and stays there. A late callback on a terminal payment is recorded for audit
and does not change it. The one exception to “one payment, one outcome” is a late success, which
records a separate case without flipping the original payment.
Refunds
payment.refunded is sent after a refund settles with the provider, and its data is the ordinary
payment shape. The values depend on whether the refund was partial or full:
- Partial refund —
data.statusstayssucceeded. The payment is still a successful collection with some of it refunded. - Full refund — the payment moves to
reversed, sodata.statusisreversed. The event type is stillpayment.refunded;payment.reversedis for reversals the provider initiates.
data.amount is the payment’s original amount, not the refunded portion. The event tells you a
refund happened, not how much of it there was — retrieve the payment and read refundedMoney if
you need to adjust a ledger by the delta. A refund that the provider accepts but hasn’t settled yet
emits nothing; you get the event when it settles.
Disputes
payment.disputed carries its own data shape:
{
"id": "evt_...",
"type": "payment.disputed",
"environment": "live",
"createdAt": "2026-08-26T10:15:00Z",
"data": {
"disputeId": "dsp_...",
"paymentId": "pay_...",
"status": "open",
"rawStatus": "chargeback",
"reason": "product_not_received",
"amount": { "amount": "2500", "currency": "KES", "formatted": "KSh 25.00" },
"evidenceDueAt": "2026-09-02T10:15:00Z",
"resolvedAt": null,
"paymentReference": "ORD-123"
}
}status is the normalised dispute state, lowercased; rawStatus is the provider’s own word for it
and differs between providers. amount is the disputed amount, not necessarily the payment’s full
amount. evidenceDueAt is the deadline to respond with evidence, and is null when the provider
gave none. resolvedAt is null while the dispute is open.
Late successes
payment.late_success also carries its own data shape:
{
"id": "evt_...",
"type": "payment.late_success",
"environment": "live",
"createdAt": "2026-08-26T10:15:00Z",
"data": {
"caseId": "lps_...",
"paymentId": "pay_...",
"paymentReference": "ORD-123",
"previousStatus": "FAILED",
"provider": "MPESA",
"amount": { "amount": "50000", "currency": "KES", "formatted": "KSh 500.00" },
"receivedAt": "2026-08-26T10:15:00Z"
}
}This means a customer’s money arrived for a payment you were already told had failed — usually
because the provider’s callback overtook its timeout. The original payment stays failed; the case is
recorded so the two systems can be reconciled. amount is null when the provider didn’t report
one. previousStatus and provider keep their enum casing ("FAILED", "MPESA"), unlike the
lowercased status in the payment shape.
Branching on a failure
TypeScript
import { FailureCode } from "@vectapay/sdk";
if (event.type === "payment.failed" && event.data.failure?.code === FailureCode.INSUFFICIENT_FUNDS) {
// prompt the customer to top up and retry
}See Errors for the full FailureCode table with merchant-facing copy for each one.
failure is null on any status other than failed (and on some failed payments where the provider
gave no code), so guard the access.
Subscription events
Subscription webhooks use the same envelope, but data describes the subscription and the customer
being billed rather than a payment. They are always environment: "live" — test mode never creates
or charges a subscription. For what each event means in context, see
Subscriptions and Charging.
{
"id": "evt_...",
"type": "subscription.charge_failed",
"environment": "live",
"createdAt": "2026-08-26T10:15:00Z",
"data": {
"businessId": "biz_...",
"subscriptionId": "sub_...",
"customerId": "cus_...",
"customerDisplayName": "Amina Wanjiku",
"customerPhoneNumber": "254712345678",
"customerEmail": "amina@example.com",
"planId": "plan_...",
"planCode": "starter-monthly",
"planName": "Starter monthly",
"status": "past_due",
"amount": { "amount": "250000", "currency": "KES", "formatted": "KSh 2,500.00" },
"billingInterval": "monthly",
"intervalCount": 1,
"nextBillingAt": "2026-09-25T10:15:00Z",
"trialEndsAt": null,
"graceEndsAt": "2026-08-29T10:15:00Z",
"cancelAtPeriodEnd": false,
"externalReference": "MEMBER-001",
"eventPayload": {
"chargeAttemptId": "attempt_...",
"paymentId": "pay_...",
"failureCode": "INSUFFICIENT_FUNDS",
"failureReason": "The customer had insufficient funds",
"abandoned": false,
"graceEndsAt": "2026-08-29T10:15:00Z",
"retryAt": "2026-08-27T10:15:00Z",
"attemptNumber": 1,
"attemptsLeft": 2,
"totalAttempts": 3,
"checkoutRequestId": "charge_..."
}
}
}amount is a money object, the same shape as the payment envelope’s amount. Show
amount.formatted; use amount.amount, an integer string in minor units, only for reconciliation.
status is one of draft, trialing, active, past_due, paused, canceled, or expired.
| Event | Fires when |
|---|---|
subscription.created | A subscription is created, before its first charge. |
subscription.activated | The subscription starts being paid — the first successful charge after a trial, or a past-due subscription recovering. It does not fire on immediate-start creation; that emits only subscription.created. |
subscription.charge_succeeded | A renewal charge settles successfully. |
subscription.charge_failed | A renewal attempt fails — see eventPayload.failureCode. |
subscription.retry_scheduled | A retry is scheduled after a failed charge. |
subscription.dunning_started | The subscription enters its recovery window after a failed charge. |
subscription.dunning_exhausted | No automatic retries remain; the subscription stays past due. |
subscription.paused | The subscription is paused, by the merchant or the customer. |
subscription.resumed | A paused subscription resumes billing. |
subscription.canceled | A cancellation was requested, or an open subscription reached its end date — whether set with cancel() at period end or with scheduleEnd(). A cancel-at-period-end subscription produces two deliveries: one records the request while data.status is still active or trialing, the other the finalisation with data.status: "canceled". A scheduled end produces only the finalisation. |
subscription.expired | The subscription reaches the end of its recovery window. |
subscription.plan_changed | A plan change was requested (eventPayload.applied: false) or applied at the billing boundary (applied: true). A deferred change produces two deliveries. |
subscription.billing_date_changed | The next billing date moved. The pending attempt was voided and rescheduled. |
subscription.end_scheduled | An end date was scheduled with scheduleEnd(). Billing stops when the hourly sweep reaches it. |
subscription.end_cleared | A scheduled end date was removed with clearEnd(); billing resumes from the stored next billing date. |
subscription.standing_order_rejected | A Ratiba mandate was declined or timed out. Billing reverts to payment requests. |
subscription.initiated | In the catalogue only. The charge reminder is an email to the customer, not a webhook. |
eventPayload is where the event-specific detail lives. It is null only when there is nothing
event-specific to report.
| Event | eventPayload fields |
|---|---|
subscription.created | status, planId |
subscription.activated | previousStatus, activatedAt, nextBillingAt |
subscription.charge_succeeded | chargeAttemptId, paymentId, receiptNumber, expectedAmount, paidAmount, overpaidAmount, checkoutRequestId. A Ratiba (standing order) success carries amount and amountVerified instead of the expected/paid fields and checkoutRequestId. |
subscription.charge_failed | chargeAttemptId, paymentId, failureCode, failureReason, abandoned, graceEndsAt, retryAt, attemptNumber, attemptsLeft, totalAttempts, checkoutRequestId |
subscription.retry_scheduled | chargeAttemptId, retryNumber, retryAt, amount (a money object) |
subscription.dunning_started | previousStatus, graceEndsAt |
subscription.dunning_exhausted | graceEndsAt, reason |
subscription.paused | reason (and source: "customer_portal" when the customer paused it) |
subscription.resumed | resumedAt, nextBillingAt (and source when from the customer portal) |
subscription.canceled | On request: cancelAtPeriodEnd, reason, and source: "customer_portal" when the customer cancelled. On finalisation: cancelAtPeriodEnd (mirrors how the subscription ended — true for cancel at period end, false for a scheduleEnd() date), effectiveAt. |
subscription.expired | graceEndsAt, finalStatus |
subscription.plan_changed | Requested (applied: false): reason, targetPlanId, effectiveAt. Applied (applied: true): previousPlanId, previousAmount, previousBillingInterval, previousIntervalCount, targetPlanId, targetPlanName, targetPlanCode, targetAmount, targetBillingInterval, targetIntervalCount, effectiveAt. An immediate change (no next billing date) sends the requested shape with applied: true and effectiveAt: null. |
subscription.billing_date_changed | newDate |
subscription.end_scheduled | endAt |
subscription.end_cleared | None — an empty object. |
subscription.standing_order_rejected | paymentId, failureReason |
Underpaid, unverified-amount, and currency-mismatch failures carry expectedAmount, paidAmount,
shortfallAmount, and requiresManualReview: true, and schedule no retry. On an STK charge that
payload carries only the attempt, payment, failure code, and those money fields — not the retry
counters or failureReason. A late callback on a closed subscription still emits
charge_succeeded; it is recorded without reopening the subscription.
A subscription is not a payment, so don’t assume every charge produces exactly one webhook of each
type. A failed renewal produces charge_failed, then retry_scheduled or dunning_started, then a
later charge_succeeded or dunning_exhausted; a cancellation at period end produces canceled
immediately (with data.status still active or trialing), then a second canceled when the
period actually ends and the status flips.
Reading data in each SDK
The SDK types are exact for payment events and for subscription events. They don’t model the dispute and late-success shapes, so read those from the raw payload.
- TypeScript —
event.typenarrowsevent.databetween the payment and subscription shapes.payment.disputedandpayment.late_successare typed as payment events, so don’t trustevent.data.directionon them; read the fields in the examples above. - Python — the event is a plain
dict; readevent["data"]["subscriptionId"]for a subscription andevent["data"]["disputeId"]for a dispute. - Java — a subscription payload doesn’t fit
WebhookEventData, so read it from the parsed JSON:var data = (JsonObject) event.raw().get("data");. The same works for disputes and late successes. - C# —
WebhookEvent.Datais typed for payment events; for subscription events callVerifySignatureand deserialize the body into your own record for the fields you need. The same applies topayment.disputedandpayment.late_success.
Events you won’t receive
The catalogue is wider than what a merchant endpoint can be sent. Only payment.* and
subscription.* can be subscribed to, and a few members of those families are still not delivered:
payment.initiated— no real payment emits it. The first delivery ispayment.pending.subscription.initiated— the charge reminder goes to the customer by email; no webhook is dispatched.payout.*— payouts are not merchant webhook events. Track them with the payouts API and its status endpoint.- Account-level events —
provider_account.*,balance.low,business.status_changed, andbilling.*are internal. Read the affected resource from the API or the dashboard. expected_payment.settled— internal accounting for expected payments.subscription.standing_order_enabled— the activity record of enabling a mandate is shown in the dashboard, but it is not delivered to webhook endpoints. PollstandingOrderStatusuntil the first debit or a rejection arrives.
Everything else in the payment.* and subscription.* families is deliverable, and the dashboard
checklist offers every one except the two “catalogue only” types above.
If you subscribe to every event, the set you receive can grow as the catalogue grows. Treat the
deliveries you don’t recognise as informational: return 2xx and ignore the type rather than failing
the delivery and causing retries.