Developer docs v0.1.0

Webhooks

Event types

EventEmitted when
customer.created · customer.updated · customer.deletedCustomer changes
instrument.attached · instrument.detachedInstrument saved or removed
enrollment.created · enrollment.updated · enrollment.failedHosted enrollment started, progressed, or failed
subscription.createdSubscription created (before the first charge settles)
subscription.updatedUpdate call, a status change from a charge outcome (e.g. → active, past_due, unpaid, incomplete_expired), or a renewal: a paid period moves current_period_start and current_period_end, even when the status stays active
subscription.canceledActually canceled: immediately, when the period ends after cancel_at_period_end, or after retries when the exhaustion action is canceled. Scheduling a cancellation emits subscription.updated instead.
subscription.paused · subscription.resumedPause, resume (manual, via update, or scheduled)
subscription.trial_will_endOnce, when a trial is within 3 days of ending (payload is the full subscription)
payment.review_requiredA succeeded payment needs manual resolution: late settlement on an expired or canceled subscription, an agent anomaly (agent_anomaly), or an invoice that was voided or changed before money arrived (invoice_not_payable)
payment.review_resolvedMerchant recorded the completed external refund/service disposition
payment.succeededA charge succeeded (renewal, first payment, proration, standalone payment, or late confirmation)
payment.failedA charge was declined; includes retry_at (null for standalone payments)
payment.expiredA payment the payer did not complete in time became expired (1 hour in test mode, 2 hours in live mode, counted from when it was sent to NETOPIA Payments); a later confirmation sends payment.succeeded or payment.failed
payment.refundedA succeeded payment was refunded (reported by NETOPIA Payments); the payment's amount_refunded grows and, once all of amount is refunded, its status becomes refunded and its invoice is voided (invoice.voided with reason: payment_refunded). A refund of only part of the amount leaves the payment succeeded and its invoice paid. A subscription is not changed by a refund
checkout_session.completed · checkout_session.expired · checkout_session.canceledA checkout session ended: its payment succeeded, it ran out of time, or it was canceled before payment. Sent once per session; the payload is the checkout session. Sessions also raise the usual payment.* events
mandate.created · mandate.approved · mandate.revoked · mandate.exhausted · mandate.expiredA mandate was created, approved by the customer, revoked, exhausted (budget or payment count reached), or passed its expiry
invoice.createdA draft receivable was created
invoice.voided · invoice.marked_uncollectibleAn unpaid invoice was voided, or given up on (it can still be paid)
invoice.finalized · invoice.paidAn invoice was issued with its number; an invoice issued from a payment is issued already paid, so both arrive together
invoice.payment_failedThe automatic charge of a charge_automatically invoice was declined; next_payment_attempt is when the next attempt is (null after the last one) and attempt_count how many were made
domain.active · domain.failedA domain became usable for Apple Pay, or stopped working (the payload is the domain, with last_error)
invoice.overdueAn unpaid send_invoice invoice passed its due date (sent once)
invoice.needs_detailsAn invoice you created is waiting for billing details; includes missing_fields (payload carries no billing details)
invoice.email_bounced · invoice.email_complainedThe invoice email did not arrive (the address does not exist or refused it), or the payer marked it as spam; email_status on the invoice changes to bounced or complained. The payload is the invoice plus email.kind; it carries no email address
invoice.email_repliedThe payer replied to an invoice email; the reply was forwarded to your issuer email address (the text is not stored)

Delivery

Payware POSTs one JSON envelope per event to each matching endpoint:

{
  "id": "01…",
  "object": "event",
  "type": "payment.succeeded",
  "created": "2026-10-23T12:00:00.000Z",
  "data": {
    "object": { "object": "payment", "id": "01…", "subscription_id": "01…",
                "amount": 4900, "currency": "RON", "status": "succeeded", "…": "…" }
  }
}
  • id identifies the logical event and is the same for every endpoint that receives it.
  • data.object is always the full API object: the subscription for subscription.*, the customer for customer.*, the payment transaction for payment.*, the instrument for instrument.attached. Deletions (customer.deleted, instrument.detached) carry { "object": "...", "id": "...", "deleted": true }.
  • Extra context sits next to object inside data: payment.failed adds retry_at (the next attempt, or null when retries are exhausted); instrument.detached adds replacement_instrument_id.

Headers:

HeaderValue
x-signaturet=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">, keyed with the endpoint secret
x-event-typee.g. payment.succeeded
x-webhook-idID of this delivery (unique per endpoint); stable across retries

Respond with any 2xx within 10 seconds. Anything else — a timeout, an error, or a redirect (redirects are never followed) — is retried after 1 min, 5 min, 30 min, 2 h and 24 h; after the sixth attempt the delivery is marked failed. Delivery is at least once: dedupe on id, and expect events to arrive out of order (trust the object's status and current_period_end, not arrival order). Each retry is re-signed with a fresh timestamp.

Verifying the signature

import { createHmac, timingSafeEqual } from "node:crypto";

export const verify = (rawBody: string, header: string, secret: string, toleranceSeconds = 300) => {
  const parts = Object.fromEntries(header.split(",").map((part) => part.trim().split("=") as [string, string]));
  const timestamp = Number(parts.t);
  if (!Number.isInteger(timestamp) || !parts.v1) return false;
  if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) return false; // replay protection

  const expected = createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest("hex");
  return expected.length === parts.v1.length && timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
};

Compute it over the raw bytes you received, before JSON parsing. The timestamp is part of the signed data, so a captured request cannot be replayed outside the tolerance window.

Secrets and endpoint URLs

  • Secrets are 256-bit random values (whsec_ + 64 hex chars), returned at creation and on matching idempotency replays; normal endpoint reads omit them. To use a secret your receiver already holds, send secret (whsec_ and 32 to 128 letters or digits) when you create the endpoint or rotate it.
  • POST /v1/webhooks/:id/rotate-secret issues a new secret and returns it (including on matching idempotency replays); the old one stops working immediately, so update the receiver first or accept a short window of failures (failed deliveries are retried and re-signed with the new secret).
  • URLs must use http or https and may not contain credentials. Live endpoints must also use https and may not point to localhost, *.local, *.internal or private and reserved addresses. Violations return 400 invalid_webhook_url.