ZeroPointPayments

Guides

Billing webhooks: Stripe-shaped events, and where they differ

Billing events (checkout, invoice, subscription, customer, payment method) are opt-in, Stripe-shaped, and carry both Stripe period layouts. How to subscribe, verify, catch up, and port a Stripe handler, with the event mapping table.

Billing events use the same signed envelope as payment events (webhooks). Inside it, data.object is a Stripe-shaped object: Stripe's field names, amounts in cents, times in unix seconds. A handler written for Stripe's event.type and event.data.object reads them with few changes. This guide lists those changes.

Every billing type below can be subscribed to now. A type arrives once the feature that produces it is available in your account; whats-available says what is available today. To see a payload before then, send a sample (section 6).

1. Billing events are opt-in

An endpoint with an empty event_types receives payment events only, never a billing event, and gets no error saying so. To receive billing events, list the types or use ["*"]:

POST /v1/webhooks
{"url":"https://api.acme.test/zeropoint/billing","event_types":["checkout.session.completed","invoice.paid","invoice.payment_failed","customer.subscription.created","customer.subscription.updated","customer.subscription.deleted"]}

Register billing on its own endpoint, apart from payment events. In live mode billing deliveries already have their own pauses after repeated failures, but in test mode they share the endpoint's pauses with payment events, and a separate endpoint keeps the two handlers' outages apart in both.

2. Verify the signature

The scheme is the one Stripe uses: HMAC-SHA256 hex over "{t}." + raw_body, a t=...,v1=... header, a 5-minute tolerance and a whsec_ secret. What to know in a ported handler:

  • Every delivery carries ZeroPoint-Signature. With stripe_signature_header: true on the endpoint (POST /v1/webhooks or PATCH /v1/webhooks/{webhook_id}), it also carries Stripe-Signature with the same value. Leave that off for a URL that still receives real Stripe deliveries.
  • The secret is the whsec_ value returned once by POST /v1/webhooks (or register_webhook), not your Stripe endpoint secret.
  • stripe.webhooks.constructEvent(rawBody, header, whsec) verifies either header with that secret. It is part of ZeroPoint's acceptance run for stripe 23.1.0 and 17.7.0 (Node); other versions are untested. The receiver kit's verifier below works without Stripe's library.
  • During a secret rotation the header carries two v1= values for 24 hours; accept either.

Node, with the receiver kit (get_snippet with zeropoint.node.webhook-receiver):

JavaScript
import { createVerifier } from './zeropoint/verify.mjs';
const verify = createVerifier({ secrets: [process.env.ZP_WEBHOOK_SECRET] });

app.post('/webhooks/zeropoint', express.raw({ type: 'application/json' }), async (req, res) => {
  if (!verify(req.get('zeropoint-signature'), req.body)) return res.sendStatus(401);
  const event = JSON.parse(req.body);
  if (await seenEvent(event.id)) return res.sendStatus(200);  // retries repeat events
  await handleBillingEvent(event);                            // your Stripe switch, unchanged
  res.sendStatus(200);
});

Python:

Python
import hashlib, hmac, json, time

def construct_event(payload: bytes, header: str, secret: str, tolerance: int = 300) -> dict:
    parts = [p.split("=", 1) for p in header.split(",") if "=" in p]
    ts = next((v for k, v in parts if k == "t"), None)
    if ts is None or not ts.isdigit() or abs(time.time() - int(ts)) > tolerance:
        raise ValueError("bad signature")
    expected = hmac.new(secret.encode(), f"{ts}.".encode() + payload, hashlib.sha256).hexdigest()
    if not any(k == "v1" and hmac.compare_digest(expected, v) for k, v in parts):
        raise ValueError("bad signature")
    return json.loads(payload)

Pass the raw request bytes, never a re-serialized object. Stripe's Python library returns an object that allows event.data.object.status; this returns a plain dict, so read event["data"]["object"]["status"]. Then prove the receiver with POST /v1/webhooks/{webhook_id}/verify.

3. Where ZeroPoint differs from Stripe

The period advances only when the renewal is paid. Stripe moves current_period_start and current_period_end forward when the renewal invoice is created, before payment. ZeroPoint moves them only in the change that proves the renewal charge was captured. A declined renewal shows past_due with the period that has ended; the period jumps forward in the same customer.subscription.updated that returns the subscription to active. Gate access on status, not on current_period_end: code that gates on the period cuts access at the first declined renewal.

An unknown charge outcome never sends a failure event. When the processor's answer to a charge is unknown (a timeout, an answer it cannot confirm), nothing is declined until the outcome is proven. While it is unknown, ZeroPoint sends no invoice.payment_failed, no status change, no invoice.voided or invoice.marked_uncollectible, no customer.subscription.deleted and no checkout.session.expired, and the customer keeps access. It sends one customer.subscription.updated with no status change and payment_hold set (previous_attributes is {"payment_hold": null}), and one more when the outcome is proven and the hold is cleared. A change of payment_hold alone means a charge is being confirmed: do nothing. Once proven, the usual events follow: invoice.paid if it was captured, invoice.payment_failed if it was declined.

A hard decline is never retried on that card. A decline the card issuer will never approve (for example lost_card, stolen_card, pickup_card, invalid_account, revocation_of_authorization) blocks that card at the merchant. The scheduler never sends it again, a pay through POST /v1/invoices/{id}/pay or the portal answers 402 payment_method_blocked with nothing sent, and for a lost, stolen or closed card a new subscription or an upgrade on that card answers the same. The same card saved again is still blocked; another card is charged at the next retry. A lost, stolen or closed card is blocked for every subscription of the merchant; a revoked authorization blocks that subscription. The retry schedule keeps running, as on Stripe: next_payment_attempt stays set and attempt_count counts retry slots, not charges, while last_payment_error.requires_new_payment_method is true and last_payment_error.decline_code names the decline. The last declined retry sends the final invoice.payment_failed (next_payment_attempt: null) in the same change as the final action, so send your last-chance notice on the failure before it. Never show lost_card, stolen_card or pickup_card to the cardholder: say the card was declined and ask for another card. Block scopes, the per-card ceilings and what a skipped slot does: Failed renewals and retries, the one place these rules are kept.

Live billing deliveries retry for about 3 days. A failed billing delivery to a live endpoint is retried after 1, 5 and 15 minutes, then 1, 3, 6, 12, 24 and 24 hours: ten attempts, the last about 70 hours after the first, and dead by 72 hours, close to Stripe's 3 days. Test mode keeps the short schedule, as payment events do everywhere: 1, 5 and 15 minutes, then dead (webhooks section 5 has the exact rules and limits). When live billing deliveries die we email your account's contact email, once per endpoint per day at most. A dead delivery is not sent again on its own, and a missed customer.subscription.deleted leaves a canceled customer with paid features. The event list is the catch-up path: poll GET /v1/events on startup and every few minutes, through the same handler, deduplicated by event id, with since set to the newest created you have handled minus 300 and one types per billing type you handle:

/v1/events?since=1797381700&types=invoice.paid&types=invoice.payment_failed&types=customer.subscription.created&types=customer.subscription.updated&types=customer.subscription.deleted

Page to the end (pass next_cursor as cursor until has_more is false) and keep the 300-second overlap; webhooks section 5 explains why.

Ordering and object_version. Delivery order is not guaranteed, here or at Stripe. Billing events carry data.object_version, which rises with each change to the object. Use it only to decide whether to replace your stored copy (replace when the event's version is greater than or equal to the stored one); never use it to skip a handler, because one change can send two events at one version, such as invoice.paid with invoice.payment_succeeded. webhooks section 5 has the full rule.

Smaller differences.

  • A renewal invoice's top-level period_start and period_end are the period it bills for, the same as its line's period. Stripe's renewal invoice shows the period that just ended at the top level.
  • payment_intent on an invoice or checkout session holds a ZeroPoint payment id (pay_...), not a pi_ id. GET /v1/payments/{payment_id} reads it.
  • invoice.upcoming has no id and no object_version, as at Stripe: deduplicate it by event.id.
  • customer.deleted never cancels anything: a customer with a live subscription cannot be deleted.
  • envelope.merchant_id names the merchant; there is no Connect account field, no request and no pending_webhooks.
  • api_version is 2026-09-05. Do not compare it with a Stripe version.

4. Both Stripe field layouts, always

Stripe API 2025-03-31.basil moved some subscription and invoice fields. ZeroPoint sends both the older location and the basil location on every billing object, always equal, so code written for either Stripe version reads the field it expects:

FieldOlder locationBasil location
Period start and endsubscription.current_period_start, .current_period_endsubscription.items.data[].current_period_start, .current_period_end
Invoice to subscriptioninvoice.subscriptioninvoice.parent.subscription_details.subscription
Subscription metadata on the invoiceinvoice.subscription_details.metadatainvoice.parent.subscription_details.metadata
Line proration flaginvoice.lines.data[].prorationinvoice.lines.data[].parent.subscription_item_details.proration
Line's subscription iteminvoice.lines.data[].subscription_iteminvoice.lines.data[].parent.subscription_item_details.subscription_item
Line priceinvoice.lines.data[].priceinvoice.lines.data[].pricing.price_details.price

When a period changes, previous_attributes on customer.subscription.updated carries both layouts too: current_period_start, current_period_end and items. To read either layout in one line:

JavaScript
const periodEnd = sub.items.data[0].current_period_end ?? sub.current_period_end;
const subId = inv.parent?.subscription_details?.subscription ?? inv.subscription;

5. Stripe event to ZeroPoint event

Stripe eventZeroPoint eventWhat a handler can notice
checkout.session.completedsamepayment and payment_intent hold a pay_ id. url is null in the event.
checkout.session.expiredsameNot sent while a payment attempt's outcome is unknown.
checkout.session.async_payment_succeeded, _failednoneCards are synchronous.
invoice.paidsameAlso sent for a zero-total first invoice and an operator ruling, then without invoice.payment_succeeded.
invoice.payment_succeededsameSent with invoice.paid, at the same object_version.
invoice.payment_failedsameNever on an unknown outcome. Read billing_reason: subscription_cycle is a renewal; subscription_update a plan change that did not go through (the plan is unchanged, invoice.voided follows); subscription_create a declined first payment (incomplete). The last two carry next_payment_attempt: null while the subscription has not ended. attempt_count counts retry slots (a skipped slot counts). Retries follow the merchant's schedule, not Smart Retries.
invoice.voided, invoice.marked_uncollectiblesameinvoice.marked_uncollectible is always followed by customer.subscription.deleted.
invoice.upcomingsameNo id. Sent 3 days before renewal by default; the merchant can change it.
invoice.created, invoice.finalized, invoice.updatednoneInvoice changes arrive as the specific events above.
invoice.payment_action_requirednoneNo 3D Secure flow.
customer.subscription.created, .updated, .deletedsameBoth period layouts. The period advances only on a paid renewal. A hold is an .updated with payment_hold and no status change. No trialing or paused status.
customer.subscription.trial_will_end, .paused, .resumed, pending_update_applied, pending_update_expirednoneA pending or scheduled change shows in .updated.
payment_method.attached, .detachedsamedetached is sent only when the saved card is deleted. Wallet payments are never attached.
payment_method.automatically_updatednoneNo card updater.
customer.created, .updated, .deletedsamecustomer.deleted never cancels a subscription.
payment_intent.*, charge.*payment.*, refund.*Different names and shapes; these are the payment events.
Stripe-Signature headerZeroPoint-Signature, plus Stripe-Signature with stripe_signature_header: trueSame scheme and value; stripe.webhooks.constructEvent verifies either (section 2).
Retries for up to 3 daysRetries for about 3 days in live mode, about 21 minutes in test modePoll GET /v1/events with types to catch up (section 3).

6. Try it in the sandbox

POST /v1/webhooks/{webhook_id}/test with {"event_type":"invoice.paid","merchant_id":"mch_..."} (or the send_sample_event tool) sends one sample of a billing type to that endpoint, test mode only. The endpoint must subscribe to the type. The sample is the documented payload with "sample": true beside data.object and ids that answer 404. Use it to build your parser; act on real events only, and skip any event whose data.sample is true.