Webhooks

Instead of polling, register a webhook URL and fluxa will POST a signed JSON event to it whenever something happens to your orders, subscriptions or settlements. Verify the signature on every delivery, return 2xx quickly, and you have a reliable, real-time integration.

Configure your endpoint

In the merchant portal, set your webhook URL and (optionally) narrow the event subscription to the event types you care about. An empty subscription means all events that are delivered by default; the order.* lifecycle events, payment.pending and the payment.dispute_* events are opt-in and are only delivered when your subscription names them explicitly. The portal also shows your webhook signing secret, which you use to verify deliveries — keep it server-side.

Delivery format

Each delivery is an HTTP POST with a JSON body and these headers:

  • Name
    X-Fluxa-Event
    Type
    string
    Description

    The event type, e.g. payment.succeeded. Also present as the event field in the body.

  • Name
    X-Fluxa-Event-Id
    Type
    string
    Description

    The event's id, e.g. whk_01k2w8m4qz7d3e9t5r6y1c0b2n. Also present as the event_id field in the body. It stays the same on every retry and redelivery of the event and differs between events, so it is the key to deduplicate on — see Retries. The signature covers the body, not the headers: record an id as processed only after the signature checks out, and take it from the body's event_id (or confirm the header equals it).

  • Name
    X-Fluxa-Timestamp
    Type
    string
    Description

    Unix seconds when the delivery was signed.

  • Name
    X-Fluxa-Signature
    Type
    string
    Description

    hex(HMAC_SHA256(secret, "<timestamp>.<body>")) — see below.

  • Name
    X-Fluxa-Encryption
    Type
    string
    Description

    Present and set to A256GCM only when payload encryption is enabled for your account. See Encrypted payloads.

Verifying the signature

The signature is the lowercase hex HMAC-SHA256 of the string "<timestamp>.<body>" — the X-Fluxa-Timestamp value, a literal dot, then the raw request body — keyed by your webhook signing secret.

Compute the same value over the bytes you received and compare in constant time. Reject the delivery if it doesn't match. Use the raw body exactly as received — don't re-serialize the parsed JSON, or the bytes (and the hash) may differ.

Verify a webhook

import crypto from 'node:crypto'

const SECRET = 'your_webhook_signing_secret'

// Capture the raw body, e.g. express.raw({ type: 'application/json' }),
// then verify before parsing — the signature covers the exact bytes received.
export function verify(rawBody, headers) {
  const ts = headers['x-fluxa-timestamp']
  const sig = headers['x-fluxa-signature']
  const signed = `${ts}.${rawBody}`
  const expected = crypto.createHmac('sha256', SECRET).update(signed).digest('hex')
  return (
    sig.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))
  )
}

Event types

Every payload includes an event field. fluxa delivers these event types:

  • Name
    payment.pending
    Type
    Description

    The payer chose a delayed payment method (a Stripe Konbini convenience-store voucher, or another method that completes Checkout unpaid such as PayPay) and still has to pay. Carries the method, the deadline and the voucher. Opt-in: delivered only when your subscription lists it; once per payment attempt, plus once more if the attempt was first reported without its voucher and the voucher arrives later, or if an embedded payment's payer takes a new voucher after the first one lapsed (show the latest voucher you received).

  • Name
    payment.succeeded
    Type
    Description

    An order was paid and settled: in full, or at the amount received for a settle_on_received charge.

  • Name
    payment.additional_received
    Type
    Description

    A transfer confirmed after a settle_on_received order was paid has been credited to that order. Delivered under an empty subscription; a non-empty subscription must list it.

  • Name
    payment.failed
    Type
    Description

    A payment attempt failed terminally.

  • Name
    payment.refunded
    Type
    Description

    An order was refunded, in part or in full. reason says why: refund for a refund (issued by you, an operator or at the provider), dispute when the provider took the money back for a chargeback: a Stripe card dispute, or a GoCardless Direct Debit chargeback (the payer's indemnity claim), which GoCardless reports without a dispute object and so comes with no payment.dispute_* events. A Stripe refund that waits for the customer's bank details (Konbini, PromptPay, Boleto, bank transfers) is reported only once the customer has submitted them and Stripe starts paying it out, not when it is created; one that fails or is canceled before that is never reported.

  • Name
    payment.dispute_created
    Type
    Description

    A chargeback, an issuer inquiry or an early fraud warning was opened against a paid Stripe order (is_inquiry tells them apart). Sent once per provider dispute, and once more, with escalated: true, if an inquiry becomes a chargeback before it closes. Opt-in.

  • Name
    payment.dispute_closed
    Type
    Description

    The provider closed a dispute: outcome is won or lost. Sent once per provider dispute, and once more, with outcome: "won" and corrected: true, if the provider later reverses a lost dispute to won. Opt-in.

  • Name
    settlement.completed
    Type
    Description

    A non-custodial on-chain order's net amount was swept to your settlement address (proof of receipt).

  • Name
    subscription.charged
    Type
    Description

    A subscription generated a new cycle's charge. For a card-on-file subscription with a saved card, auto_charge says whether the card was charged (succeeded, then payment.succeeded follows) or not (declined, authentication_required, card_unavailable; the order is an invoice). checkout_url is present whenever the payer has a hosted checkout to open.

  • Name
    subscription.completed
    Type
    Description

    A subscription reached its end condition.

  • Name
    subscription.payment_failed
    Type
    Description

    A subscription's billing failed repeatedly and moved to past_due.

  • Name
    order.created
    Type
    Description

    An order was created and is awaiting payment. Opt-in: delivered only when your subscription lists it.

  • Name
    order.expired
    Type
    Description

    An unpaid order passed its deadline. Opt-in.

  • Name
    order.canceled
    Type
    Description

    An unpaid order was canceled: by you through POST /api/v1/orders/:id/cancel, by the platform operator, or when a canceled subscription voided its unpaid invoice. Sent once per order; cancelling an already-canceled order sends nothing. Opt-in.

  • Name
    kyc.approved
    Type
    Description

    Your KYC submission was approved.

  • Name
    kyc.rejected
    Type
    Description

    Your KYC submission was rejected; the payload carries the reason.

Payloads

Every event carries event_id, the same value as the X-Fluxa-Event-Id header, and also the id of the delivery in Webhook deliveries. Treat it as an opaque string: don't parse it or order events by it.

Payment events carry the order summary. paid_at is present once the order is paid. settlement.completed adds the on-chain transfer details, and subscription events carry the subscription id and cycle. Every event of an order a subscription generated (such as its payment.succeeded) also carries subscription_id and subscription_cycle.

Orders created with settle_on_received add three fields to every order-scoped event: settle_on_received (always true), min_received_amount, and received_amount, the cumulative gross amount credited for the order after the change the event reports. payment.additional_received also carries the transfer it credits: deposit_id (unique per event), tx_hash and deposit_amount. Credit from the cumulative received_amount, never from deposit_amount: store the last value you applied and apply only the increase, so duplicate and out-of-order deliveries are harmless (a payment.additional_received can arrive before the payment.succeeded it follows). Exact-mode payloads carry none of these fields.

Payment events (payment.succeeded, payment.refunded, payment.additional_received, payment.dispute_created, payment.dispute_closed) of an order that has settled add fee and net, decimal strings with the meaning they have on the order, as they stood when the event happened: the payment.refunded after a refund carries the fee and net after it. A redelivery carries the same values, so reconcile per event rather than adding them up. They are absent on test-mode orders, on payment.pending and payment.failed, and on order.* events. net can be negative on a refunded direct-settlement order, whose platform fee is not returned. The fee on settlement.completed is something else: the part of an on-chain sweep sent to the platform.

Dispute events keep the order summary (amount is still the order amount) and add dispute_id (the provider's id; store the dispute's state under it, but deduplicate deliveries on event_id), dispute_amount, dispute_currency, dispute_reason (the provider's reason code, such as fraudulent, or the issuer's fraud type for an early fraud warning) and is_inquiry; payment.dispute_created adds escalated, and payment.dispute_closed adds outcome and corrected. For a card chargeback Stripe takes the money when the dispute opens, so a payment.dispute_created is followed by a payment.refunded with reason: "dispute", and a later payment.dispute_closed may still report won (the order stays refunded). An inquiry or early fraud warning withdraws nothing. When the issuer escalates an inquiry to a chargeback, the dispute keeps its dispute_id and you get a second payment.dispute_created with is_inquiry: false and escalated: true, followed by the payment.refunded; if you deduplicate on dispute_id, let that one through. Stripe can also reverse a lost dispute to won (a late win, with the funds reinstated): you then get a second payment.dispute_closed for the same dispute_id, with its own event_id, outcome: "won" and corrected: true, which replaces the lost you stored; let that one through too if you deduplicate on dispute_id. The reversal is one-way and sent once: a lost that arrives after won is a stale delivery and produces no event. An early fraud warning is never closed, and a chargeback that follows it is a separate dispute with its own dispute_id. Deliveries can arrive out of order, so be ready for a payment.dispute_closed before its payment.dispute_created.

payment.pending adds payment_method (for example konbini or paypay), payment_expires_at (RFC 3339, when the method has a deadline) and, for Konbini, voucher: type, hosted_voucher_url, and stores, which maps each store chain (familymart, lawson, ministop, seicomart) to its payment_code and, where the chain uses one, confirmation_number. Show the voucher page or the codes to the payer. The order stays open until 24 hours after payment_expires_at, so a store payment made on the last day still produces payment.succeeded; a voucher that expires unpaid produces payment.failed, except on an embedded payment, where the order stays pending (the payer can take a new voucher in the Payment Element) until it expires. If the order is canceled or expires while the voucher is unpaid, fluxa voids the voucher at Stripe, usually within seconds, so the payer can no longer pay it at the store: stop showing it once you receive order.canceled or order.expired. A store payment made before the voucher was voided does not mark the order paid; it is refunded to the payer. Retries can deliver payment.pending after payment.succeeded: ignore it once the order is paid. The same fields are on the order's payment as payment.raw.pending.

payment.succeeded

{
  "event": "payment.succeeded",
  "event_id": "whk_01k2w8m4qz7d3e9t5r6y1c0b2n",
  "order_id": "ord_2Zx9Qw8sUaM2",
  "merchant_order_id": "order-1001",
  "amount": "49.90",
  "currency": "USDT",
  "status": "paid",
  "channel": "usdt_erc20",
  "paid_at": "2026-06-11T08:30:00Z",
  "fee": "0.25",
  "net": "49.65"
}

payment.succeeded (settle on received)

{
  "event": "payment.succeeded",
  "event_id": "whk_example_2",
  "order_id": "ord_01m4dae01kxn8ntnngxtg12ks2",
  "merchant_order_id": "USR1510NO3AHNYE1791448512",
  "amount": "481.65",
  "currency": "USDT",
  "status": "paid",
  "channel": "usdt_tron",
  "channel_name": "USDT @ Tron",
  "is_test": false,
  "notification_defer_until_webhook": "true",
  "settle_on_received": true,
  "min_received_amount": "5",
  "received_amount": "480.5",
  "paid_at": "2026-10-08T08:38:43Z"
}

payment.additional_received

{
  "event": "payment.additional_received",
  "event_id": "whk_example_3",
  "order_id": "ord_01m4dae01kxn8ntnngxtg12ks2",
  "merchant_order_id": "USR1510NO3AHNYE1791448512",
  "amount": "481.65",
  "currency": "USDT",
  "status": "paid",
  "channel": "usdt_tron",
  "channel_name": "USDT @ Tron",
  "is_test": false,
  "notification_defer_until_webhook": "true",
  "settle_on_received": true,
  "min_received_amount": "5",
  "received_amount": "481.65",
  "deposit_id": "dep_01m4dg0q7zr3k1v8x2b5n6c9ta",
  "tx_hash": "3f9c2e8a41d07b5c6e1f2a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d",
  "deposit_amount": "1.15",
  "paid_at": "2026-10-08T08:38:43Z"
}

payment.dispute_created

{
  "event": "payment.dispute_created",
  "event_id": "whk_example_4",
  "order_id": "ord_2Zx9Qw8sUaM2",
  "merchant_order_id": "order-1001",
  "amount": "9.99",
  "currency": "USD",
  "status": "paid",
  "channel": "stripe",
  "is_test": false,
  "paid_at": "2026-06-11T08:30:00Z",
  "dispute_id": "du_1QxYz",
  "dispute_amount": "9.99",
  "dispute_currency": "USD",
  "dispute_reason": "fraudulent",
  "is_inquiry": false,
  "escalated": false
}

settlement.completed

{
  "event": "settlement.completed",
  "event_id": "whk_example_5",
  "order_id": "ord_2Zx9Qw8sUaM2",
  "merchant_order_id": "order-1001",
  "chain": "usdt_erc20",
  "asset": "USDT",
  "settlement_tx": "0xabc...",
  "settlement_address": "0xYourAddress",
  "amount": "48.40",
  "fee": "1.50",
  "currency": "USDT"
}

subscription.charged

{
  "event": "subscription.charged",
  "event_id": "whk_example_6",
  "subscription_id": "sub_9Qw8",
  "subscription_cycle": 3,
  "order_id": "ord_5K2m",
  "amount": "19.00",
  "currency": "USDT",
  "next_charge_at": "2026-07-11T00:00:00Z",
  "checkout_url": "https://checkout.stripe.com/c/pay/cs_live_…"
}

Retries

Your endpoint should return a 2xx status quickly (do heavy work asynchronously). Any non-2xx response or connection error is retried with exponential backoff — up to 8 attempts, with the delay capped at 6 hours. After the final attempt the delivery is marked failed. You can inspect recent deliveries — including attempt counts and the last error — via Webhook deliveries or the portal.

Encrypted payloads

When payload encryption is enabled for your account, the body is an AES-256-GCM envelope instead of plaintext JSON, and X-Fluxa-Encryption: A256GCM is set. The signature still covers the envelope you receive, so verify it first, then decrypt. The envelope is:

Encrypted envelope

{ "alg": "A256GCM", "data": "base64(nonce || ciphertext || tag)" }

The key is SHA-256(webhook signing secret). Decrypt data with AES-256-GCM using the first 12 bytes as the nonce to recover the plaintext JSON event.