Testing Your Endpoint
Developer → Webhooks → Send test event sends a real, correctly signed delivery to your configured URL. Pick an event type, optionally supply your own payload, and it travels the same path a production delivery does: same signature scheme, same headers, same delivery log, same five-attempt retry schedule. No payment is created and nothing is billed.
Screenshot needed: VectaPay dashboard → Developer → Webhooks page, showing the “Send test event” dialog with an event type dropdown and an optional custom payload field.
Three things have to be in place before a test can go out:
- A URL is saved. Without one you get “Add an endpoint URL before sending a test”.
- Webhooks are switched on. A paused endpoint can still be tested — a pause from repeated failures leaves the switch on — but an endpoint you disabled cannot.
- The event is ticked in your subscription list. The simulator will not send an event you haven’t subscribed to; it fails with “Select this event in the subscription list before sending a test”.
That last rule is the one people trip on. The point of a test delivery is to exercise a handler you expect to receive this event in production. Sending one you’re not subscribed to tests nothing.
What the test payload looks like
A generated test payload is the real shape for that event, with environment: "test" and
test: true added. Payment events get the standard payment body:
{
"id": "evt_...",
"type": "payment.failed",
"environment": "test",
"createdAt": "2026-08-26T10:15:00Z",
"test": true,
"data": {
"paymentId": "test_1756203300000",
"status": "failed",
"direction": "inbound",
"amount": { "amount": "1000", "currency": "KES", "formatted": "KSh 10.00" },
"method": "mobile_money_push",
"provider": "mpesa",
"reference": "TEST-REF-001",
"customer": { "phone": "254712345678", "email": null },
"completedAt": null,
"failure": { "code": "CUSTOMER_CANCELLED", "message": "Request cancelled by user" },
"metadata": { "orderId": "TEST-ORDER-001" },
"providerDetails": { "resultCode": 1032 }
}
}payment.refunded uses the payment shape. payment.disputed and payment.late_success use the
dispute and late-success shapes on Events — those are the two that look
nothing like a normal payment, so test them explicitly if your handler touches them. Subscription
events get the subscription data body plus a filled eventPayload, so a dunning handler sees the
failureCode, attemptNumber, graceEndsAt it would see in production.
The generated values are fixed samples, not derivatives of your real data: the amount is KES 10,
the reference is TEST-REF-001, the customer is a test number. Use a custom payload when your
handler branches on your own metadata or reference format.
A custom payload is sent verbatim. The generated environment and test flags are not added
for you, and X-Webhook-Event still names the event type you selected in the dropdown — so if
your custom body says "type": "payment.succeeded" while you picked payment.failed, the header
and the body disagree. Keep them consistent, and include environment yourself if your handler
branches on it.
Reading the result
The send returns as soon as the delivery is queued. The outcome is in Developer → Webhooks → Logs, one row per attempt:
| Column | What it tells you |
|---|---|
| Event | The type that was delivered — the same value as X-Webhook-Event. |
| Status | delivered, failed, or still pending. |
| Response code | What your endpoint answered, or 0 when it timed out or refused the connection. |
| Response body | The first 5,000 characters of what you returned. |
| Attempts | Which attempt this row is. |
| Error | The connection or timeout error, when there was no HTTP response. |
| Duration | How long your endpoint took, in milliseconds. |
A failed test send is not a rehearsal that gets thrown away. It retries on the normal schedule (1, 5, 15, and 60 minutes) and counts toward the endpoint’s failure streak exactly like a real delivery — five consecutive failed deliveries pause the endpoint. The flip side is useful: a successful test send clears an existing pause, which makes it the quickest way to prove a fix before real events resume.
Use the retry button on a log row to re-send that row’s stored payload. If the endpoint is paused and you want to prove a fix, retry from the log (or send a fresh test) rather than waiting for the next real event.
If the delivery arrives but your handler doesn’t do what you expected, check the dispatch table and the full receive examples on Receiving Events — the log tells you the event reached you, not what your code did with it.
Simulator or smoke test?
They test different halves of the same pipe, so use both:
| Smoke test | Webhook simulator | |
|---|---|---|
| Proves | Your request → VectaPay → the provider → your phone works end to end | Your endpoint verifies signatures and handles each event type |
| Needs | A verified phone (Developer → Testing) | A saved URL and the event subscribed |
| Delivers | A real payment.* event, environment: "test" | A generated event, environment: "test" and test: true |
| When to use | After wiring up collect() | After every change to your webhook handler |
The smoke test is the only way to see a genuine provider callback; the simulator is the only way to exercise event types your phone can’t easily produce (a dispute, a late success, a dunning sequence).
Local development
The platform has to reach your endpoint over the public internet, so localhost and LAN addresses
don’t work — not even with a test send. A delivery to a private or reserved address (loopback,
10.x, 192.168.x, .local, and the like) is refused at the network layer, and in production the
dashboard also requires an https:// URL.
Run a tunnel (ngrok http 3000, or similar) and point the dashboard URL at the tunnel’s https
address:
ngrok http 3000
# Forwarding https://a1b2c3.ngrok-free.app -> http://localhost:3000Then save https://a1b2c3.ngrok-free.app/webhooks/vectapay as your URL. Swap it for your real
domain before going live; the tunnel address changes every time you restart the tunnel, and the old
one starts failing.
Two things that are easy to get wrong locally:
- Redirects aren’t followed in production. If your framework redirects
http→https, a trailing slash, or a login page, the delivery fails rather than following it. Answer2xxdirectly at the saved URL. - Answer within 30 seconds. A debugger breakpoint held for a minute is a timeout, which is a failed attempt and a retry.
Troubleshooting
| Symptom | Likely cause |
|---|---|
400 Invalid signature | You verified a re-serialized body instead of the raw bytes, or the wrong secret (an old one after a rotation). |
3xx in the log | Your endpoint redirects. Save the final URL and answer there. |
Response code 0 | Connection refused, DNS failure, or no response within 30 seconds — often the tunnel is down or the dev server stopped. |
| Nothing in the log after Send test event | The send was rejected before queuing: no URL, webhooks off, or the event isn’t subscribed. The dashboard shows which. |
| Endpoint paused | Five consecutive failed deliveries. Fix the endpoint, then save it or send a test that succeeds. Events that happened during the pause are not replayed. |
| Test arrives but the body looks wrong | You supplied a custom payload. It is sent verbatim — check it matches the event type you selected. |
The same data through the SDK
Each SDK exposes the delivery log for a payment, and the payment-level retry:
TypeScript
const deliveries = await vectapay.payments.webhookDeliveries(paymentId);
await vectapay.payments.retryWebhook(paymentId);A retry through payments.retryWebhook() is rebuilt from the payment’s current status and marked
manualRetry: true — a new event with a new id, not a replay of the old one. It needs the endpoint
enabled, the event subscribed, and the payment out of pending/initiated. Retrying from the
delivery log instead re-sends that row’s stored payload, including on a paused endpoint.