Platform
Webhooks
Receive real-time event notifications for payment lifecycle changes.
How webhooks work
When events happen in your PaymentHooks account (a payment succeeds, an invoice is created, a dispute is updated), we send an HTTP POST request to every active webhook endpoint subscribed to that event type. This allows your application to react to events in real-time without polling the API.
There are two delivery channels. Registered endpoints (created in the dashboard or with the API below) receive account-wide events. A per-session webhook is the webhookUrl you pass when creating a checkout session; it receives only the outcome of that hosted checkout (see Checkout Sessions). Checkout outcomes are sent to both channels.
Event payload structure
Every webhook POST contains the same envelope. The resource the event is about lives under data.object; on update events the previous values of changed fields are under data.previous_attributes. Per-session webhooks use the same envelope.
{
"id": "ph_evt_9c41e0b27f5a3d18e6b2c7a4e1f0d3b5",
"object": "event",
"api_version": "2026-04-22",
"created": 1751500800,
"type": "payment.succeeded",
"livemode": true,
"data": {
"object": {
"id": "ph_pay_4c8e1a5d9b3f7c2e6a0d4b8f1c5e9a3d",
"object": "payment_intent",
"amount": 9500,
"amount_received": 9500,
"currency": "usd",
"amount_usd_cents": 9500,
"usd_to_local_currency_rate": 1,
"status": "succeeded",
"customer": "ph_cus_8f14e45fceea167a5a36dedd4bea2543",
"payment_method": "card",
"latest_charge": "pay_Qx81LmT5vW2zKa",
"metadata": {},
"created": 1751500800,
"livemode": true
}
},
"request": {
"id": null,
"idempotency_key": "order_8812_attempt_1"
}
}| Field | Type | Description |
|---|---|---|
| id | string | Unique event id (ph_evt_ followed by 32 lowercase hex characters). The first delivery, every automatic retry and a manual replay of the same event carry the same id — de-duplicate on it. |
| object | string | Always "event". |
| api_version | string | API version the payload is serialized against (currently 2026-04-22). |
| created | integer | Unix timestamp (seconds) when the event was created. |
| type | string | The event type, e.g. "payment.succeeded" — also sent in the X-PaymentHooks-Event header. |
| livemode | boolean | Your account's platform mode when the event was created: true in live mode, false in test mode. The same value is set on data.object and its nested objects, and it does not change on retries or replays. |
| data.object | object | The resource the event relates to (payment_intent, invoice, subscription, …), in Stripe's object shape. amount, amount_total, unit_amount and similar fields are the local amount in the smallest unit of currency (lowercase ISO), exactly as Stripe sends them. Money objects (payment_intent, checkout.session, invoice, price, plan) also carry amount_usd_cents and usd_to_local_currency_rate (1 USD = X currency); refunds and disputes carry amount_usd_cents. |
| data.previous_attributes | object? | Prior values of changed fields. Sent on customer.updated, product.updated, price.updated, subscription.updated, dispute.updated and subscription.cancelled (when cancelled through the API). Omitted otherwise. |
| request.id | string | null | Reserved. Currently null for events caused by API requests. |
| request.idempotency_key | string | null | The idempotencyKey body field of the POST /v1/payments request that created the payment (payment.created / payment.succeeded). null for every other event. |
Per-event resource shapes (payment_intent, charge, invoice, subscription, …) are catalogued on the Webhook Events reference.
Delivery headers
Every webhook POST carries the headers below. The signature header carries the timestamp and HMAC you verify against the shared secret; the event and delivery headers let you route and deduplicate without parsing the JSON body.
| Header | Example | Purpose |
|---|---|---|
| Content-Type | application/json | Body is always a JSON-encoded event envelope. |
| X-PaymentHooks-Signature | t=1751500800,v1=5257a8… | HMAC-SHA256 signature. During the 24 h after an endpoint secret rotation a second v1_previous=… value is also included. |
| X-PaymentHooks-Event | payment.succeeded | The event type — lets you route without parsing the body first. |
| X-PaymentHooks-Delivery | ph_whd_1a3c5e7f9b2d4f6a8c0e2b4d6f8a1c3e | Unique per delivery attempt (ph_whd_ prefix) — a retry or replay gets a new value while the event id stays the same. Use it when correlating with Delivery logs. |
| X-PaymentHooks-Timestamp | 1751500800 | Unix seconds at signing time — the same value as t= in the signature header. |
| X-PaymentHooks-Api-Version | 2026-04-22 | API version the payload is serialized against. |
| User-Agent | PaymentHooks-Webhook/1.0 | Identifies the PaymentHooks delivery agent. |
Setting up an endpoint
- 1Go to Developers → Webhooks in your merchant dashboard
- 2Click Add endpoint and enter your URL (must start with https://)
- 3Select which events you want to receive — leave the list empty to receive every event
- 4Copy the signing secret — you will need it to verify webhook signatures
Verifying signatures
Every delivery carries an X-PaymentHooks-Signature header:
X-PaymentHooks-Signature: t=1751500800,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
v1 = hex( HMAC-SHA256( key = your signing secret, the full "whsec_..." string,
message = t + "." + raw request body ) )- Read the raw request body bytes before any JSON parsing.
- Split the header on
,and each item on the first=. Collecttand everyv1/v1_previousvalue. - Reject the request if
tis more than 300 seconds from your current time. - Compute the HMAC of
t + "." + rawBodywith your secret and compare it to each signature using a constant-time comparison. - Respond with any 2xx status within 10 seconds. Process the event asynchronously if it takes longer.
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const SECRET = process.env.PAYMENTHOOKS_WEBHOOK_SECRET; // whsec_...
const TOLERANCE_SECONDS = 300;
function verify(rawBody, header, secret) {
if (!header) return false;
const parts = { v1: [] };
for (const item of header.split(',')) {
const i = item.indexOf('=');
if (i <= 0) continue;
const key = item.slice(0, i).trim();
const value = item.slice(i + 1).trim();
if (key === 't') parts.t = value;
if (key === 'v1' || key === 'v1_previous') parts.v1.push(value);
}
const t = Number(parts.t);
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false;
const expected = crypto.createHmac('sha256', secret)
.update(t + '.')
.update(rawBody) // Buffer of the exact bytes received
.digest();
return parts.v1.some((sig) => {
const given = Buffer.from(sig, 'hex');
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
});
}
// express.raw keeps the body as a Buffer — do NOT use express.json() on this route.
app.post('/webhooks/paymenthooks', express.raw({ type: 'application/json' }), (req, res) => {
if (!verify(req.body, req.get('X-PaymentHooks-Signature'), SECRET)) {
return res.status(400).send('Invalid signature');
}
const event = JSON.parse(req.body.toString('utf8'));
// Delivery is at-least-once: de-duplicate on event.id
res.sendStatus(200);
});Which secret?Endpoint deliveries use that endpoint's signing secret (Developers → Webhooks → endpoint → Signing secret). Per-session webhooks (the webhookUrl on a checkout session) and Webhook Simulator test events use the same scheme; session webhooks are signed with your session webhook secret (GET /v1/webhooks/session-secret), and simulator events with the target endpoint's secret.
Secret rotation. After you rotate an endpoint secret, deliveries for the next 24 hours carry both v1 (new secret) and v1_previous (old secret). Accepting either keeps verification working while you deploy the new secret.
Duplicates. Store the event id and ignore ids you have already processed. Automatic retries and manual replays reuse the original event id (a replay of an older log entry that does not hold the full event is the one exception: it gets a new id, reported as eventIdPreserved: false), so also make your handlers idempotent on the resource id and event type. X-PaymentHooks-Delivery identifies a single delivery attempt.
Testing locally with the CLI
The PaymentHooks CLI forwards every event for your account to a URL on your machine as it is dispatched, so you can build a handler without exposing a public endpoint. It needs a secret key with webhooks:read, and webhooks:write for ph trigger and ph events resend.
npm install -g @paymenthooks/cli
export PAYMENTHOOKS_API_KEY=phk_live_...
ph listen --forward-to localhost:3000/webhooks
# Ready. Forwarding TEST events to http://localhost:3000/webhooks
# Signing secret for your handler: whsec_...- Forwarded requests have the production envelope and headers (
X-PaymentHooks-Signature,X-PaymentHooks-Event,X-PaymentHooks-Delivery,X-PaymentHooks-Timestamp,X-PaymentHooks-Api-Version), signed with your account's CLI secret, whichph listenprints at start. Use it as the webhook secret in your local environment; the verification code above is unchanged. - The CLI secret is separate from endpoint secrets, so it cannot sign a delivery your production endpoint would accept. If it leaks, replace it with
ph secret rotate. ph trigger payment.succeededsends a sample event (livemode: false,metadata.simulated: "true") to runningph listensessions only. It is never delivered to registered endpoints.ph events resend <delivery-id>redelivers a logged delivery to its endpoint with the original event id.
All commands, options and error codes: PaymentHooks CLI.
Endpoints & Responses
Manage your webhook endpoints via the API (base URL https://paymenthooks.com/api/v1, authenticated with your phk_live_... secret key). There is no retrieve-by-id or delete operation: read endpoints from the list, and stop deliveries by setting status to disabled. An endpoint is also disabled automatically after failureThreshold consecutive failed deliveries (default 50).
urlmust start withhttps://(max 2048 characters);descriptionmax 500.subscribedEventsentries are exact event names (e.g.subscription.cancelled);"*"matches everything, and an omitted or empty list also receives every event.- Create accepts
url,description,subscribedEvents,deliveryFilters. Update additionally acceptsstatus(active | disabled) andfailureThreshold(1-1000). Any other key returns 400VALIDATION_ERROR. deliveryFilters(gateway,amountMin,amountMax) are strict: with a gateway filter only events whose payload names that gateway are delivered; with an amount filter, events without an amount are skipped.- The signing secret is returned on create, list and update, and by
rotate-secret. Unknown endpoint ids return 404NOT_FOUND. - API keys need the
webhooks:readscope to list endpoints and delivery logs, andwebhooks:writeto create, update, rotate secrets, replay or resend. A key without the scope gets 403INSUFFICIENT_SCOPE. - Replay and resend perform a real, signed delivery to the original endpoint right away and record it as a new log entry; the response reports the endpoint's answer in
success/status. A log id that does not exist or belongs to another account returns 404NOT_FOUND; a disabled endpoint returns 409ENDPOINT_INACTIVEuntil you re-enable it.
/v1/webhooks/endpointsCreate a webhook endpoint (201; the only response with the full secret, besides rotate and reveal){
"url": "https://yoursite.com/webhooks/paymenthooks",
"description": "Production webhook receiver",
"subscribedEvents": ["payment.succeeded", "payment.failed", "payment.refunded"]
}{
"data": {
"id": "ph_whe_3c8f1a6d9b2e4f7a0c5d8b1e4a7f2c9d",
"merchantId": "ph_mrc_6b1e0d9c2a7f48e3b5c1d0a9e8f7b6c5",
"url": "https://yoursite.com/webhooks/paymenthooks",
"description": "Production webhook receiver",
"subscribedEvents": ["payment.succeeded", "payment.failed", "payment.refunded"],
"status": "active",
"signingSecret": "whsec_3f9a1c0e7b2d4f6a8c0e1b3d5f7a9c1e3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a",
"previousSigningSecret": null,
"secretRotatedAt": null,
"successRate": null,
"totalDeliveries": 0,
"lastDeliveryAt": null,
"consecutiveFailures": 0,
"failureThreshold": 50,
"autoDisabledAt": null,
"deliveryFilters": null,
"createdAt": "2026-05-16T10:30:00.000Z",
"updatedAt": "2026-05-16T10:30:00.000Z"
},
"error": null
}/v1/webhooks/endpointsList webhook endpoints (newest first, not paginated; signing secrets masked){
"data": [
{
"id": "ph_whe_3c8f1a6d9b2e4f7a0c5d8b1e4a7f2c9d",
"merchantId": "ph_mrc_6b1e0d9c2a7f48e3b5c1d0a9e8f7b6c5",
"url": "https://yoursite.com/webhooks/paymenthooks",
"description": "Production webhook receiver",
"subscribedEvents": ["payment.succeeded", "payment.failed", "payment.refunded"],
"status": "active",
"signingSecret": "whsec_…1f3a",
"previousSigningSecret": null,
"secretRotatedAt": null,
"successRate": null,
"totalDeliveries": 0,
"lastDeliveryAt": null,
"consecutiveFailures": 0,
"failureThreshold": 50,
"autoDisabledAt": null,
"deliveryFilters": null,
"createdAt": "2026-05-16T10:30:00.000Z",
"updatedAt": "2026-05-16T10:30:00.000Z"
}
],
"error": null
}/v1/webhooks/endpoints/:endpointIdUpdate a webhook endpoint (signing secret masked in the response){
"subscribedEvents": ["payment.succeeded", "payment.failed", "payment.refunded", "subscription.cancelled"],
"description": "Updated production webhook",
"deliveryFilters": { "gateway": "gw_razorpay", "amountMin": 1000 }
}{
"data": {
"id": "ph_whe_3c8f1a6d9b2e4f7a0c5d8b1e4a7f2c9d",
"merchantId": "ph_mrc_6b1e0d9c2a7f48e3b5c1d0a9e8f7b6c5",
"url": "https://yoursite.com/webhooks/paymenthooks",
"description": "Updated production webhook",
"subscribedEvents": ["payment.succeeded", "payment.failed", "payment.refunded", "subscription.cancelled"],
"status": "active",
"signingSecret": "whsec_…1f3a",
"previousSigningSecret": null,
"secretRotatedAt": null,
"successRate": null,
"totalDeliveries": 0,
"lastDeliveryAt": null,
"consecutiveFailures": 0,
"failureThreshold": 50,
"autoDisabledAt": null,
"deliveryFilters": { "gateway": "gw_razorpay", "amountMin": 1000 },
"createdAt": "2026-05-16T10:30:00.000Z",
"updatedAt": "2026-05-16T11:00:00.000Z"
},
"error": null
}/v1/webhooks/endpoints/:endpointId/rotate-secretRotate the signing secret (24 h grace period){
"data": {
"signingSecret": "whsec_8d2b4f6a0c1e3b5d7f9a2c4e6b8d0f1a3c5e7b9d2f4a6c8e0b1d3f5a7c9e2b4d",
"gracePeriodExpiresAt": "2026-05-17T11:05:00.000Z"
},
"error": null
}/v1/webhooks/endpoints/:endpointId/reveal-secretReveal the current signing secret (account:write; audited; 10 per hour per person){
"data": {
"id": "ph_whe_3c8f1a6d9b2e4f7a0c5d8b1e4a7f2c9d",
"signingSecret": "whsec_3f9a1c0e7b2d4f6a8c0e1b3d5f7a9c1e3b5d7f9a1c3e5b7d9f1a3c5e7b9d1f3a"
},
"error": null
}/v1/webhooks/logs/:logId/replayRedeliver a logged event to its endpoint now (webhooks:write){
"data": {
"originalDeliveryId": "ph_whd_1a3c5e7f9b2d4f6a8c0e2b4d6f8a1c3e",
"replayDeliveryId": "ph_whd_8b2d4f6a0c1e3b5d7f9a2c4e6b8d0f1a",
"eventId": "ph_evt_9c41e0b27f5a3d18e6b2c7a4e1f0d3b5",
"eventIdPreserved": true,
"statusCode": 200,
"responseTimeMs": 184,
"success": true
},
"error": null
}/v1/webhooks/streamServer-sent events: every webhook event for your account as it is dispatched; used by ph listen (webhooks:read)event: ready
data: {"merchantId":"ph_mrc_4afd3b3702c98a4131993c3de110966f","livemode":false,"signingSecret":"whsec_8f1c..."}
event: webhook
data: {"type":"payment.succeeded","envelope":{"id":"ph_evt_9c41e0b27f5a3d18e6b2c7a4e1f0d3b5","object":"event","type":"payment.succeeded","livemode":false,"data":{"object":{}}}}/v1/webhooks/stream/triggerSend a sample event to open streams only, never to registered endpoints. Body { eventType }. 20 per minute (webhooks:write){
"data": { "eventId": "ph_evt_185c59f9d2ad673199ef63dd4e7a1b0c", "type": "payment.succeeded" },
"error": null
}/v1/webhooks/stream/secret/rotateReplace the CLI signing secret used to sign streamed events; new streams use it (webhooks:write){
"data": { "signingSecret": "whsec_2b7e..." },
"error": null
}/v1/webhooks/logs/:logId/resendSame redelivery as replay, returned as the new delivery log entry (webhooks:write){
"data": {
"id": "ph_whd_8b2d4f6a0c1e3b5d7f9a2c4e6b8d0f1a",
"endpointId": "ph_whe_3c8f1a6d9b2e4f7a0c5d8b1e4a7f2c9d",
"event": "payment.succeeded",
"payload": { "id": "ph_evt_9c41e0b27f5a3d18e6b2c7a4e1f0d3b5", "object": "event", "type": "payment.succeeded" },
"statusCode": 200,
"responseTimeMs": 184,
"status": "success",
"attempts": 2,
"deliveredAt": "2026-05-16T11:20:00.000Z",
"originalDeliveryId": "ph_whd_1a3c5e7f9b2d4f6a8c0e2b4d6f8a1c3e",
"eventId": "ph_evt_9c41e0b27f5a3d18e6b2c7a4e1f0d3b5",
"eventIdPreserved": true
},
"error": null
}Event types
Events delivered to registered endpoints. Sample payloads are on the Webhook Events reference.
| Event | Description |
|---|---|
| payment.created | POST /v1/payments created a payment that did not succeed synchronously (pending or failed at the gateway), or POST /v1/external-transactions recorded a payment taken on another service. Every payment_intent carries payment_source ("gateway" or "external") and external_provider |
| payment.succeeded | A payment succeeded: POST /v1/payments succeeded synchronously, a hosted checkout payment succeeded, or a gateway webhook confirmed a pending payment |
| payment.failed | A payment failed: a hosted checkout payment was declined, or a gateway webhook reported a pending payment as failed |
| payment.refunded | A refund was created through the API or reported by the gateway |
| payment.disputed | The gateway reported a dispute on a payment |
| payment.captured | An authorized payment was captured (POST /v1/payments/:id/capture) |
| invoice.finalized | A draft invoice was issued: sent (POST /v1/invoices/:id/send), finalized (POST /v1/invoices/:id/finalize) or marked paid. It now has its number from your unbroken invoice series (number), its issue date (status_transitions.finalized_at, effective_at) and its date of supply (tax_point_date). Before it, number is null. Sent once per invoice; renewal invoices are issued numbered and do not send it |
| invoice.created | An invoice was created through the API, or auto-generated (already paid) for a successful subscription renewal, including renewals fully covered by proration credit. Invoice amounts (subtotal, total, amount_paid) are in the invoice's own currency, the subscription's itemLocalCurrency; amount_usd_cents and usd_to_local_currency_rate give the USD side |
| invoice.paid | An invoice was marked paid (POST /v1/invoices/:id/mark-paid) |
| invoice.payment_reminder | A scheduled reminder fired for a sent, unpaid invoice |
| invoice.upcoming | Draft of a subscription's next invoice, sent a few days before it renews (not stored) |
| invoice.overdue | A sent invoice is still unpaid after its due date; sent once per invoice |
| invoice.voided | An invoice was voided (POST /v1/invoices/:id/void) |
| credit_note.created | A credit note was issued against an invoice |
| credit_note.voided | A credit note was voided |
| customer.balance_transaction.created | A customer's credit balance changed (adjustment, credit note, or balance applied to an invoice) |
| subscription.created | A subscription was created (API or completed subscription-mode checkout) |
| customer.subscription.created | Stripe's name for subscription.created, sent with it for every subscription a checkout opens |
| subscription.updated | A subscription was updated (PUT /v1/subscriptions/:id) |
| subscription.cancelled | A subscription was cancelled through the API, ended at the period end after a cancelAtPeriodEnd request, or was cancelled after dunning retries were exhausted |
| subscription.trial_will_end | The trial of a subscription created with a trial ends in 3 days |
| subscription.paused | A subscription was paused |
| subscription.resumed | A subscription was resumed |
| subscription.renewed | An automatic renewal charge succeeded |
| subscription.renewal_failed | An automatic renewal charge failed; the subscription enters dunning |
| subscription.renewal_due | A renewal date arrived for a subscription PaymentHooks cannot charge off-session — collect payment yourself |
| subscription.renewing_soon | Advance notice (3 days) of an upcoming renewal |
| subscription.retry_created | A retry checkout session was created (POST /v1/subscriptions/:id/retry) |
| subscription.deleted | Sent with every subscription.cancelled whose status is cancelled (Stripe's customer.subscription.deleted) |
| subscription_schedule.released | A subscription schedule was released (POST /release, or its last phase ended with endBehavior release); the subscription keeps running |
| entitlements.active_entitlement_summary.updated | A customer's features or limits changed (subscribe, plan change, add-on, override, cancellation); refresh your cached copy |
| entitlements.usage_threshold.reached | A customer's usage of a feature crossed one of your alert thresholds below 100% (default 75% and 90%) |
| entitlements.limit_reached | A customer's usage reached 100% of a feature's maximum; over_limit is true after a downgrade below current usage |
| entitlements.overage.started | The first unit above the maximum on a price that bills overage |
| entitlements.overage_cap.reached | Overage reached the price's cap; further usage is refused |
| entitlements.usage.rejected | A usage event was refused (limit, cap or no entitlement); at most once per period and feature |
| entitlements.usage_period.closed | A usage period closed at renewal or cancellation, with the final used and overage figures |
| mandate.updated | The off-session authorisation PaymentHooks renews with changed status |
| payment_method.detached | The customer revoked the mandate at their bank, card network or gateway |
| subscription.payment_method_updated | The customer set up automatic payments again from a setup link; nothing was charged and the billing period did not move |
| customer.created | A customer was created |
| customer.updated | A customer was updated |
| product.created | A product was created |
| product.updated | A product was updated |
| product.deleted | A product was deleted |
| price.created | A price was created |
| price.updated | A price was updated |
| price.deleted | A price was deleted |
| dispute.updated | A dispute was updated (PUT /v1/disputes/:id, or closed at the gateway) |
| dispute.closed | A dispute was won or lost (Stripe charge.dispute.closed); data.object.payment shows the payment after the outcome |
| dispute.evidence_submitted | Evidence was submitted for a dispute |
| checkout.session.created | A checkout session was created |
| checkout.session.completed | A hosted checkout payment succeeded (for subscription sessions, after the subscription was created) |
| checkout.session.payment_failed | A hosted checkout payment failed |
| checkout.session.expired | An open checkout session passed its expiry time; sent once, when the expired session is next accessed |
| payment_link.created | A payment link was created |
| gateway.disconnected | A gateway connection was removed |
| custom_domain.verified | A custom domain's DNS ownership was verified |
| custom_domain.active | A custom domain is live |
| custom_domain.ssl_failed | Certificate issuance for a custom domain failed |
| custom_domain.dns_lost | A custom domain's DNS no longer points to PaymentHooks |
| notification.triggered | A notification of a group you turned on under Settings > Notifications > Webhooks, with its recipients and placeholders, so you can deliver it yourself |
| alert.triggered | One of your alert rules with the Webhook channel fired (Settings > Notifications > Alert Rules), with the rule, its condition and the observed value. Sent once per firing |
| eventhook.<job type> | Mirror of a scheduled job (e.g. eventhook.subscription.renewal) carrying the raw job payload — not a stable resource shape. Platform-internal jobs such as webhook retries are never mirrored |
Per-session webhook. When a checkout session has a webhookUrl, the events below are also sent to it, signed with your session webhook secret and retried on the same schedule as endpoint deliveries. Only payment.requires_action is limited to the session webhook. To confirm a hosted checkout payment, key on checkout.session.completed on either channel. See Checkout Sessions.
| Event | Description |
|---|---|
| checkout.session.completed | The hosted checkout payment succeeded. Also sent to registered endpoints |
| checkout.session.payment_failed | The hosted checkout payment failed. Also sent to registered endpoints |
| checkout.session.expired | The session expired before it was paid. Also sent to registered endpoints |
| payment.requires_action | The customer must complete an authentication step (e.g. 3D Secure) on the hosted page. Sent only to the session webhookUrl |
Failed deliveries
A delivery succeeds when your endpoint returns any 2xx status within 10 seconds. A non-2xx response, a network error or a timeout is recorded as a failed delivery in Developers → Webhooks → Delivery logs.
Failed deliveries are retried automatically, up to 5 attempts in total:
| Attempt | Sent |
|---|---|
| 1 | Immediately, when the event occurs |
| 2 | 1 minute after attempt 1 failed |
| 3 | 5 minutes after attempt 2 failed |
| 4 | 30 minutes after attempt 3 failed |
| 5 | 2 hours after attempt 4 failed (final attempt) |
- Every retry sends the same event envelope with the same event
id,createdandlivemode. It is freshly signed (newt=timestamp, endpoint's current secret) and carries a newX-PaymentHooks-Deliveryvalue. Each attempt appears in Delivery logs. - Retries stop at the first 2xx response. If the endpoint is disabled before a retry is due, the remaining retries are dropped.
- To send an event again yourself, use the replay action in Delivery logs or
POST /v1/webhooks/logs/:logId/replay. A replay is delivered immediately, keeps the original eventid, and is not retried automatically if it fails. - After
failureThresholdconsecutive failed attempts (default 50) the endpoint is set todisabled. Re-enable it withPUT /v1/webhooks/endpoints/:endpointIdand{ "status": "active" }. - Per-session webhooks are retried on the same schedule. They are not listed in Delivery logs and cannot be replayed.
Alert rules
An alert rule watches one event and notifies you when it meets a condition: by email, as a dashboard notification, or as an alert.triggeredwebhook event. Rules are managed in Settings → Notifications → Alert Rules or with the API below (scopes account:read / account:write, at most 25 rules).
| event | When | amount reads |
|---|---|---|
| payment.succeeded | A payment was captured. | The payment's transactionAmountUsdCents. |
| payment.failed | A payment failed or was voided. | The payment's transactionAmountUsdCents. |
| payment.refunded | A refund was recorded on a payment. | This refund in USD cents. |
| dispute.created | A customer disputed a payment at the gateway. | The disputed payment's transactionAmountUsdCents. |
| payout.completed | A payout was paid to your bank. | The payout's transactionAmountUsdCents. |
| invoice.overdue | A sent invoice is still unpaid after its due date. | The invoice's itemAmountUsdCents (total due). |
| subscription.cancelled | A subscription was cancelled, now or at period end. | The subscription's itemAmountUsdCents per period. |
| subscription.renewal_failed | An automatic renewal charge failed. | The subscription's itemAmountUsdCents per period. |
| tax.threshold_reached | Your sales into a place reached 80% or 100% of its VAT, GST or sales tax registration threshold (Tax > Tax Overview). Once per level and crossing. | The sales counted towards the threshold in USD cents. |
condition.field: "amount":valueis a whole number of USD cents, compared with the event's USD-cents money field. Fires once per occurrence (payment, refund, payout, invoice or subscription renewal), however often the event is re-sent.condition.field: "count":valueis a number of events, compared with how many times the event happened in the last hour, this one included. Fires at most once per rule per clock hour.condition.operator:gt,gte,lt,lte,eq,neq.channels: any ofemail,in_app,webhook.- An unknown event, field, operator or channel, or a value that is not a whole number, returns 400
VALIDATION_ERROR: a saved rule can always fire.
curl -X POST https://paymenthooks.com/api/v1/notifications/alert-rules \
-H "Authorization: Bearer phk_live_..." \
-H "Content-Type: application/json" \
-d '{
"name": "High-value payment",
"event": "payment.succeeded",
"condition": { "field": "amount", "operator": "gt", "value": 50000 },
"channels": ["webhook", "in_app"]
}'GET /v1/notifications/alert-rules lists every rule with lastTriggeredAt. PUT /v1/notifications/alert-rules replaces all rules ({ "rules": [...] }). PATCH /v1/notifications/alert-rules/:ruleId changes fields of one rule (for example { "enabled": false }); DELETE removes it.
{
"data": {
"rules": [
{
"id": "ph_alr_4c9e1a7b3d5f2e8a6c0b9d1f3e5a7c2b",
"name": "High-value payment",
"event": "payment.succeeded",
"condition": { "field": "amount", "operator": "gt", "value": 50000 },
"channels": ["webhook", "in_app"],
"enabled": true,
"invalid": false,
"invalidReason": null,
"lastTriggeredAt": "2026-11-15T09:30:00.000Z"
}
],
"invalidCount": 0
},
"error": null
}