Transaction lifecycle and webhooks
You move money through the API and need two answers: when is a payment final, so you can credit a customer or release goods, and how do you keep your own records in step when a notification is late or lost. This page is for the developer who builds that sync and for the operator who reads the statuses in the console.
The short version:
- Final success is
settled. Final without success isfailedorcancelled.partially_settledis final too and needs a person to look. - There is no
pending,confirming,completedorrefundedstatus on an operation, and there is no refund operation. See the vocabulary mapping. - Webhooks tell you quickly; reads tell you reliably. Build both: handle events as they arrive and reconcile from the API on a schedule.
For the model behind the statuses read Operations; for the split between the event history and webhook delivery read Events and webhooks.
One status model for every money movement
Deposits, withdrawals, conversions, internal transfers and on-ramp or off-ramp
sessions all report the same status field with the same twelve values. A
family uses only part of the set (see
Differences per family).
stateDiagram-v2
[*] --> requested
requested --> pending_approval: approval required
requested --> pending_compliance: compliance review
requested --> pending_admission: deposit, account not ready
requested --> admissible: accepted
requested --> executing: withdrawal or deposit accepted
requested --> failed: denied
pending_approval --> pending_compliance: approved, then review
pending_approval --> admissible: approved
pending_approval --> executing: withdrawal approved
pending_approval --> failed: rejected or expired
pending_approval --> cancelled: cancelled
pending_compliance --> admissible: cleared
pending_compliance --> executing: withdrawal or deposit cleared
pending_compliance --> failed: denied
pending_compliance --> cancelled: cancelled
pending_admission --> pending_compliance: account ready, then review
pending_admission --> executing: account ready
pending_admission --> failed: refused
admissible --> settled
admissible --> partially_settled
admissible --> failed
admissible --> cancelled: off-ramp before funds arrive
executing --> settled
executing --> failed
settled --> [*]
partially_settled --> [*]
failed --> [*]
cancelled --> [*]
The same flow as steps:
- An operation starts as
requested. You create it (withdrawal, conversion, internal transfer, ramp session), or the platform creates it when a rail detects incoming funds (deposit). - The platform checks it. If a policy rule needs an approver it becomes
pending_approval. If compliance has to review it, it becomespending_compliance. An operation can pass through both, approval first. A deposit whose account cannot be credited yet becomespending_admission. - Once the checks pass, the operation is in flight: a withdrawal or a deposit
is
executing; a conversion, internal transfer or ramp session isadmissible. - It ends in exactly one final status:
settled,partially_settled,failedorcancelled. A final status never changes. - A denied, rejected or expired check ends the operation as
failed. A cancellation ends it ascancelled. When a check denies the operation while you create it, the create call itself returns an error with codenot_admissible(see Errors).
What each status means
| Status | Group | What it means for you | Final |
|---|---|---|---|
requested | In flight | Recorded. The platform is running its checks. You mostly see it in the …requested.v1 event; the create response already carries the next status. | No |
pending_approval | Waiting on you | A policy rule requires an approver. approval_ref carries the approval id and its expiry. | No |
pending_compliance | Waiting on compliance | A compliance review is open; compliance_assessment_ref is set. There is nothing to call. | No |
pending_admission | Waiting on you | Deposits only. The funds arrived, but the receiving account may not be credited yet. admission_hold_reason says why. | No |
admissible | In flight | Conversions, internal transfers and ramp sessions: accepted and handed to execution. For an off-ramp session it also covers the wait for the customer's crypto. | No |
executing | In flight | Withdrawal: sent for payout; the amount is held on the account. Deposit: cleared and being credited. | No |
executed | In flight | In the enum, but the platform does not set it today. If you ever read it, treat it as in flight. | No |
settled | Final, success | The money moved. settled_at is set. Safe to credit your customer or release goods. | Yes |
partially_settled | Final, needs attention | Some legs of the operation settled and others did not; failure_reason is set. Never reported for a withdrawal or a deposit. | Yes |
failed | Final, no success | The operation did not complete. failure_reason says why. A failed withdrawal releases the amount it held. | Yes |
cancelled | Final, no success | Stopped before anything executed, through the family's cancel route. | Yes |
ledger_visible | In flight | In the enum, but the platform does not set it today. It is meant for a conversion whose ledger entry exists while its route has not finished. If you ever read it, treat it as not final and keep reading the operation. | No |
A conversion whose route needs manual recovery can also stay admissible
longer than usual. Keep reading it until it reaches a final status.
Differences per family
| Family | Who creates it | Path it takes | Statuses it never reports | Cancel route |
|---|---|---|---|---|
| Deposit | The platform, when a rail detects incoming funds | requested, optionally pending_admission and pending_compliance, then executing, then settled or failed | pending_approval, admissible, cancelled, partially_settled | None |
| Withdrawal | You | requested, optionally pending_approval and pending_compliance, then executing, then settled or failed | pending_admission, admissible, partially_settled | Cancel withdrawal |
| Conversion | You | requested, optionally pending_approval and pending_compliance, then admissible, then settled, partially_settled or failed | pending_admission, executing | Cancel conversion |
| Internal transfer | You | Same as conversion | pending_admission, executing | Cancel internal transfer |
| On-ramp session | You | Same as conversion | pending_admission, executing | Cancel on-ramp session |
| Off-ramp session | You | Same as conversion; admissible includes the wait for the customer's crypto | pending_admission, executing | Cancel off-ramp session |
External settlement conversions use the same status field and have no cancel route. Only one event type exists for them (see Event types), so read the operation to learn its outcome.
Cancelling works only while nothing has executed: in pending_approval or
pending_compliance, and for an off-ramp session also while it still waits
for the customer's crypto. After that the cancel route answers
409 state_conflict with data.reason set to operation_not_cancellable.
When an operation waits on you
pending_approval. Someone with theapprovals.decidecapability must decide the case named inapproval_ref: use Approve or Reject, or the Approvals screen in the console. Approval moves the operation on. A rejection ends it asfailedwithfailure_reasonAPPROVAL_REJECTED; an approval that passes itsexpires_atends it asfailedwithAPPROVAL_EXPIRED. See Policies and approvals.pending_compliance. Wait. When the review ends, the operation continues or becomesfailedwith a compliancefailure_reasonsuch asCOMPLIANCE_DENIED.pending_admission(deposits). Fix whatadmission_hold_reasonnames, for exampleCLIENT_NOT_VERIFIED,ENTERPRISE_NOT_VERIFIEDorACCOUNT_SUSPENDED. The platform re-checks the deposit when the account's standing changes; you do not resubmit anything.
Step-up authentication is not a status. For withdrawals, conversions and
external settlement conversions, a human caller sends an X-Action-Token
with the create request, before the operation exists; a service account does
not need one.
Related lifecycles
You meet four more state fields while following a payment.
Funding endpoint (where deposits arrive; see Funding endpoints):
status | Meaning |
|---|---|
provisioning | Requested; receive details are not ready yet. Keep reading the endpoint. |
active | Ready to receive. |
failed | Could not be issued; failure on the endpoint says why. |
disabled | Temporarily not receiving. |
retired | Closed for good. |
Withdrawal destination (where payouts go; see Withdrawal destinations):
status | Meaning |
|---|---|
active | Can be used for new withdrawals. |
disabled | Not selectable for new withdrawals; withdrawals in flight continue. |
retired | Closed for good. |
Approval (the case behind pending_approval):
status | Meaning | Effect on the operation |
|---|---|---|
pending | Waiting for a decision. | Stays pending_approval. |
approved | Approved. | Continues. |
rejected | Declined. | failed, APPROVAL_REJECTED. |
expired | Nobody decided before expires_at. | failed, APPROVAL_EXPIRED. |
cancelled | The case was withdrawn. | If you cancelled the operation, it is already cancelled. If only the case was cancelled, the operation ends as failed, the same as a rejection. |
Webhook delivery (one event sent to one subscription):
status | Meaning | Final |
|---|---|---|
pending | Created; the first attempt has not run yet. | No |
retrying | An attempt failed, or a redelivery is queued. next_retry_at says when the next attempt runs. | No |
delivered | Your endpoint answered with a 2xx status. | Yes |
dlq | Every attempt failed. The delivery stays in the dead-letter state until you redeliver it. | Yes |
failed | Not attempted: the subscription was paused or deleted before the delivery could be sent. | Yes |
A webhook subscription itself is active, paused or deleted.
Webhooks
Subscribe
Create a subscription with the webhooks.create capability. url must be an
HTTPS address on a public host; anything else is refused with
callback_url_not_allowed. secret is the shared key the platform signs
deliveries with: generate a long random string and store it, because no read
returns it and an update cannot change it. scope_ref is an enterprise
(enterprises/<id>) or a connected account (API: client, clients/<id>);
an enterprise subscription also receives the events of its connected accounts
and their accounts.
Subscribe to every operation event
POST https://b2b2x-sandbox.youhodler.com/api/webhook-subscriptions
Authorization: Bearer <access_token>
Idempotency-Key: webhook-sub-001
Content-Type: application/jsonKeep the returned id and etag: updating, pausing and deleting the
subscription need the current If-Match value. See
Create webhook subscription.
event_types takes exact types, a resource group such as
operations.withdrawal.*.v1, a domain group such as operations.*.v1, or
["*"] alone for everything.
Event types
Event types are named <domain>.<resource>.<verb>.v<major>. The current list
comes from List webhook event types
(GET /events/types); read it instead of hard-coding one. For operations the
verb is the status the operation just entered, with one exception:
approved means "a wait ended and the operation moves on".
| Family | Event types the platform publishes | Final ones |
|---|---|---|
| Deposit | operations.deposit.requested.v1, operations.deposit.pending_admission.v1, operations.deposit.pending_compliance.v1, operations.deposit.approved.v1 (status executing), operations.deposit.settled.v1, operations.deposit.failed.v1 | settled, failed |
| Withdrawal | operations.withdrawal.requested.v1, operations.withdrawal.pending_approval.v1, operations.withdrawal.pending_compliance.v1, operations.withdrawal.executing.v1, operations.withdrawal.settled.v1, operations.withdrawal.failed.v1, operations.withdrawal.cancelled.v1 | settled, failed, cancelled |
| Conversion | operations.conversion.requested.v1, operations.conversion.pending_approval.v1, operations.conversion.pending_compliance.v1, operations.conversion.admissible.v1, operations.conversion.approved.v1 (status admissible), operations.conversion.settled.v1, operations.conversion.failed.v1, operations.conversion.cancelled.v1 | settled, failed, cancelled |
| Internal transfer | The same eight verbs under operations.internal_transfer. | settled, failed, cancelled |
| On-ramp session | The same eight verbs under operations.on_ramp. | settled, failed, cancelled |
| Off-ramp session | The same eight verbs under operations.off_ramp. | settled, failed, cancelled |
| External settlement conversion | operations.external_settlement_conversion.pending_compliance.v1 only | None: read the operation |
The catalog, and the event_types values a subscription accepts, also list
operations.deposit.pending_approval.v1, operations.deposit.admissible.v1,
operations.deposit.cancelled.v1, operations.withdrawal.admissible.v1 and
operations.withdrawal.approved.v1. They are reserved: deposits and
withdrawals never enter those statuses (see
Differences per family), so the platform does not
publish them. Subscribing to them is harmless, but do not wait for them; an
approved withdrawal reports operations.withdrawal.executing.v1.
The catalog also lists rail-level facts (rails.deposit.detected.v1,
rails.dispatch.acknowledged.v1, rails.dispatch.rejected.v1,
rails.settlement.confirmed.v1) and ledger.transaction.posted.v1. Use
rails.deposit.detected.v1 as the earliest sign of incoming funds; use the
operation events to decide when money is final.
What a delivery looks like
Each delivery is an HTTP POST with a JSON body. For operation events data
carries the operation id, family, status, account, amounts, and the wait or
failure fields when they apply.
idis the event id. It is the same value inx-yh-webhook-event-id, inevent_idon the delivery, and inGET /events/{event_id}.data.operation_idis the id you read with the family'sGETroute. For operation eventsaggregate.idholds the same id; rely ondata.operation_idanddata.family.recipientnames the subscription and enterprise the body was built for.
| Header | Value |
|---|---|
x-yh-webhook-event-id | The event id. Use it (or id in the body) to drop duplicates. |
x-yh-webhook-delivery-id | The delivery id, for the deliveries API. |
x-yh-webhook-timestamp | Unix time in seconds of this attempt. |
x-yh-webhook-signature | t=<unix seconds>,v1=<hex signature>. |
x-yh-webhook-signature-v2 | t=…,kid=…,sub=…,ent=…,sig=…, an Ed25519 signature made with a platform key. Present when the platform key is configured. |
user-agent | yh-webhook-service/1.0 |
Verify the signature
v1 in x-yh-webhook-signature is the HMAC-SHA256, hex-encoded, of the
string <t>.<raw body>, keyed with the secret you sent when you created the
subscription. t is the same number as x-yh-webhook-timestamp, and it is
new on every attempt.
- Read the raw request body as bytes, before any JSON parsing.
- Split the header on commas and take
tandv1. - Refuse a
tthat is too far from your clock (five minutes is a common limit) so a captured request cannot be replayed later. - Compute HMAC-SHA256 of
<t>.<raw body>with your secret and compare it tov1in constant time.
A subscription you create has signing set to hmac, so the v1 check
above is enough. The v2 header is an Ed25519 signature over
<t>.<subscription id>.<enterprise ref>.<raw body> with a platform key named
by kid; it lets a receiver verify a delivery without holding a secret. The
public keys are a JWKS document at /.well-known/webhooks-jwks.json under the
API base URL, served without a token; pick the key whose kid matches the
header.
Acknowledge quickly
- Answer with any 2xx status to acknowledge. Every other status, a timeout and a connection error count as a failed attempt.
- Answer within 10 seconds, the default delivery timeout. Store the event and process it afterwards.
- Redirects are not followed: a 3xx answer is a failed attempt.
- The first 4,096 characters of your response body are stored and shown in
the delivery's
attempts. Do not put secrets in it.
Retries and the dead-letter state
A failed attempt is retried with a delay that doubles each time: 1 second,
then 2, 4, 8 and so on, capped at 5 minutes. Due deliveries are picked up
every 5 seconds, so real gaps are a few seconds longer. When the last attempt
fails the delivery becomes dlq and is not retried again on its own.
The number of attempts is a deployment setting. Sandbox makes five attempts
in total, so a delivery dead-letters within about a minute of failures.
Production makes ten: the waits between them add up to about 8.5 minutes,
plus the time the attempts themselves take. An outage of your endpoint that
lasts longer than that leaves deliveries in dlq, and you recover them
yourself (next section). Read attempt_count and next_retry_at on the
delivery instead of hard-coding the schedule.
Pausing a subscription
(Disable)
does not buffer anything: events published during the pause are not delivered,
and deliveries still waiting become failed without an attempt. After you
enable it again, replay the events you missed.
Inspect, redeliver, replay, test
| You want to | Call | Notes |
|---|---|---|
| See what was sent and how your endpoint answered | List deliveries, GET /webhook-subscriptions/{subscription_id}/deliveries | Filter with status (for example dlq) or event_id. Each delivery lists its attempts with http_status_code and response_body. Needs webhooks.read. |
| Send one delivery that has not succeeded again | Redeliver, POST /webhook-subscriptions/{subscription_id}/deliveries/{delivery_id}/redeliver | Queues one more attempt of the same delivery. A delivered one returns 409 with webhook_delivery_already_delivered. Needs webhooks.manage. |
| Send a stored event again, even after a successful delivery | Replay event, POST /events/{event_id}/replay | Creates a new delivery with the same event id. Send subscription_ids to target specific subscriptions, or omit it for every matching one. Needs events.read and webhooks.manage. |
| Check that your endpoint is reachable and your signature check works | Send test delivery, POST /webhook-subscriptions/{subscription_id}/test | Sends a synthetic event of type webhook.test_delivery.v1 with data.test set to true, signed like a real one. The response includes the first attempt. It changes no money and is not stored in the event history. |
Redeliver a dead-lettered delivery
POST https://b2b2x-sandbox.youhodler.com/api/webhook-subscriptions/<subscription_id>/deliveries/<delivery_id>/redeliver
Authorization: Bearer <access_token>
Idempotency-Key: redeliver-001Ordering and duplicates
- Delivery is at least once. A retry after a lost acknowledgement, a
redelivery and a replay all send an event you may already have. Record the
event
idwith a unique key and skip an id you have processed. - Order is best effort. Events are sent in the order they happened where possible, but a retried event can arrive after a later one. Never let an older event overwrite a newer state: once you have recorded a final status for an operation, ignore later non-final events for it, and when in doubt read the operation.
- A handler must be safe to run twice. Credit a customer keyed by
data.operation_id, not by the number of events you received.
Reconcile from the API
Webhooks are a signal, not the record. These reads are the record.
| Source | Use it for | Call |
|---|---|---|
| The operation by id | The current truth about one payment | GET /withdrawals/{withdrawal_id}, GET /deposits/{deposit_id}, GET /conversions/{conversion_id}, GET /internal-transfers/{internal_transfer_id}, GET /on-ramp-sessions/{session_id}, GET /off-ramp-sessions/{session_id}, GET /external-settlement-conversions/{external_settlement_conversion_id} |
| The operation lists | Finding operations you do not know yet, such as new deposits | GET /deposits, GET /withdrawals and the other list routes. The only filters are account_ref, page_size and page_token; there is no status or date filter, so filter after reading. |
| The event history | Everything that happened, pull-based | List events, GET /events. Filters: scope_ref, from_date, to_date, event_type, event_type_pattern (with * as a wildcard), aggregate_id, aggregate_type, actor_id, trace_id. Newest first. Needs events.read. |
| Balances | Checking that your ledger and the account agree | Client-account balances and master-account balances: available, held, total per asset. |
| Activity export | Period-end reconciliation as a file | Create operations activity export |
An activity export is asynchronous. Create it, read it until status is
ready (the others are queued, running, failed, expired), then fetch
the file from download_path.
Export one month of operations
POST https://b2b2x-sandbox.youhodler.com/api/operations-activity-exports
Authorization: Bearer <access_token>
Idempotency-Key: ops-export-2026-04
Content-Type: application/jsonformat is csv or json (newline-delimited). filter_criteria.statuses
takes its own set of reporting labels, not the operation statuses on this
page, so this request leaves it out and you filter the rows afterwards.
When a webhook was missed
Run this on a schedule (every few minutes is typical) and after any outage of your endpoint.
-
Find what you missed. List the event history since your last checkpoint and compare the event ids with the ones you processed.
Follow
next_page_tokenuntil it isnull. Each item has the sameid,event_typeanddataa delivery would have carried. -
Process the missing events with the same handler your webhook uses. Because the handler is keyed by event id, running it twice is harmless.
-
Re-read every operation that is not final on your side. Use the family's
GETroute by id. This catchespartially_settled, which has no event type, and external settlement conversions. -
Look for deposits you have never seen. Page through
GET /depositsfor each account you credit and match them byid. -
Clear the backlog on the webhook side. List deliveries with
status=dlqand redeliver them, or replay the events, so your delivery log is clean. This is optional once steps 1 to 4 have run. -
Compare balances for the affected accounts with your own ledger. A difference means an operation you have not recorded: go back to step 3.
-
Move the checkpoint to the newest
occurred_atyou processed. An event can reach the history a little after the time it carries, so start the next run a few minutes before the checkpoint; the event ids you have already processed are skipped.
To follow a single payment, list its events with
GET /events?aggregate_id=<operation_id>.
If you expect pending, confirming, completed, failed, refunded
Many payment APIs use these five words. Here they map to the following.
| Generic word | Closest real status | Notes |
|---|---|---|
| pending | requested, pending_approval, pending_compliance, pending_admission | Four values, split by who has to act. There is no operation status named pending. |
| confirming, processing | executing (withdrawals, deposits) or admissible (conversions, internal transfers, ramp sessions) | There is no confirming status and no confirmation counter in the status. |
| completed, succeeded, paid | settled | settled_at is set. There is no operation status named completed. |
| failed | failed | Read failure_reason. Also treat cancelled (stopped before execution) and partially_settled (some legs settled) as final without full success. |
| refunded | None | There is no refund operation, no refunded status and no refund event. A failed withdrawal releases the amount it held back to the account. To send money back to a payer, create a new withdrawal to a destination you register for them. |
pending and completed do exist on other resources (approvals, webhook
deliveries, verification status), which is why they are easy to assume here.
Test it on sandbox
Sandbox-only: Works on sandbox only. These routes return 404 in production. The simulation routes below exist on sandbox only
and return 404 in production. They need the sandbox_simulator.run
capability. Which currencies and rails support them is listed in
Sandbox testing.
-
Subscribe and send a test delivery. Create the subscription as above, then call
POST /webhook-subscriptions/{subscription_id}/test. This step is not sandbox-only. Confirm your signature check accepts it. -
Drive a deposit to
settled. Sandbox-only: Works on sandbox only. These routes return 404 in production. Simulate an incoming transfer on anactivefunding endpoint.Use the endpoint's own account and currency.
Expect
rails.deposit.detected.v1, then theoperations.deposit.events up tooperations.deposit.settled.v1, and the deposit inGET /deposits. If the deposit stops inpending_admission, finish the account's verification first. -
Drive a withdrawal to
settledorfailed. Create a fiat withdrawal through the ordinary Create withdrawal route and wait until it isexecuting. Sandbox-only: Works on sandbox only. These routes return 404 in production. Then supply the rail's answer. A409withsimulation_target_not_readymeans the provider has not accepted the payment yet; retry with the sameIdempotency-Keyafter a few seconds.Expect
operations.withdrawal.settled.v1. Send{"outcome": "failed", "reason": "Sandbox test"}on another withdrawal to seeoperations.withdrawal.failed.v1. Crypto withdrawals and withdrawals that are already final cannot be simulated. -
See the waiting statuses. There is no simulation for an approval: a policy rule that requires one puts the operation in
pending_approval, and you decide it through the ordinary approval routes. Cancel a withdrawal in that state to seecancelled. -
Rehearse a missed webhook. Pause the subscription, repeat step 2, enable the subscription again, then run When a webhook was missed.
Each simulation answers 202 with simulation_id and accepted_at. That
means it was accepted, not that the operation is final: watch the events and
the ordinary reads.
Related
- Operations: the shared operation model.
- Events and webhooks and the integration guide: the two event surfaces.
- Policies and approvals: why an operation waits for an approver.
- Idempotency and concurrency:
Idempotency-KeyandIf-Match. - Errors: the error envelope behind
409 state_conflict. - Sandbox testing: every simulation route.
- Reference: Webhook subscriptions, Events, Deposits, Withdrawals, Operations activity exports.