Skip to Content
WebhooksEvents

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": {} }
FieldMeaning
idevt_… — this delivery’s identity. Automatic retries reuse it; a manual re-send does not.
typeThe 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.
createdAtWhen the event happened.
dataThe event body.

Two optional flags can also appear at the top level:

FieldMeaning
test: trueThis delivery came from the webhook simulator, not from a real payment. Always paired with environment: "test".
manualRetry: trueThis 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.

EventFires whenFirst real delivery?
payment.initiatedIn the catalogue only. No real payment emits it — created payments start at payment.pending.No
payment.pendingThe prompt reached the customer; awaiting their action.Yes
payment.succeededThe customer completed the payment.
payment.failedThe payment failed — see data.failure.code.
payment.cancelledThe customer dismissed the prompt.
payment.expiredThe prompt timed out unanswered.
payment.reversedA provider-initiated reversal.
payment.refundedA refund was issued — read its semantics before you build on it.
payment.disputedA chargeback/dispute was opened (Paystack) — own shape.
payment.late_successMoney 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.status stays succeeded. The payment is still a successful collection with some of it refunded.
  • Full refund — the payment moves to reversed, so data.status is reversed. The event type is still payment.refunded; payment.reversed is 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

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.

EventFires when
subscription.createdA subscription is created, before its first charge.
subscription.activatedThe 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_succeededA renewal charge settles successfully.
subscription.charge_failedA renewal attempt fails — see eventPayload.failureCode.
subscription.retry_scheduledA retry is scheduled after a failed charge.
subscription.dunning_startedThe subscription enters its recovery window after a failed charge.
subscription.dunning_exhaustedNo automatic retries remain; the subscription stays past due.
subscription.pausedThe subscription is paused, by the merchant or the customer.
subscription.resumedA paused subscription resumes billing.
subscription.canceledA 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.expiredThe subscription reaches the end of its recovery window.
subscription.plan_changedA plan change was requested (eventPayload.applied: false) or applied at the billing boundary (applied: true). A deferred change produces two deliveries.
subscription.billing_date_changedThe next billing date moved. The pending attempt was voided and rescheduled.
subscription.end_scheduledAn end date was scheduled with scheduleEnd(). Billing stops when the hourly sweep reaches it.
subscription.end_clearedA scheduled end date was removed with clearEnd(); billing resumes from the stored next billing date.
subscription.standing_order_rejectedA Ratiba mandate was declined or timed out. Billing reverts to payment requests.
subscription.initiatedIn 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.

EventeventPayload fields
subscription.createdstatus, planId
subscription.activatedpreviousStatus, activatedAt, nextBillingAt
subscription.charge_succeededchargeAttemptId, 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_failedchargeAttemptId, paymentId, failureCode, failureReason, abandoned, graceEndsAt, retryAt, attemptNumber, attemptsLeft, totalAttempts, checkoutRequestId
subscription.retry_scheduledchargeAttemptId, retryNumber, retryAt, amount (a money object)
subscription.dunning_startedpreviousStatus, graceEndsAt
subscription.dunning_exhaustedgraceEndsAt, reason
subscription.pausedreason (and source: "customer_portal" when the customer paused it)
subscription.resumedresumedAt, nextBillingAt (and source when from the customer portal)
subscription.canceledOn 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.expiredgraceEndsAt, finalStatus
subscription.plan_changedRequested (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_changednewDate
subscription.end_scheduledendAt
subscription.end_clearedNone — an empty object.
subscription.standing_order_rejectedpaymentId, 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.type narrows event.data between the payment and subscription shapes. payment.disputed and payment.late_success are typed as payment events, so don’t trust event.data.direction on them; read the fields in the examples above.
  • Python — the event is a plain dict; read event["data"]["subscriptionId"] for a subscription and event["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.Data is typed for payment events; for subscription events call VerifySignature and deserialize the body into your own record for the fields you need. The same applies to payment.disputed and payment.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 is payment.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, and billing.* 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. Poll standingOrderStatus until 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.

Last updated on