Guides
Troubleshoot a terminal integration safely
Read checkout snapshots, webhook receiver responses, and order-evidence dispositions without retrying an uncertain payment.
Use this guide with the reviewed Node terminal checkout, webhook receiver, and order-payment evidence bundles. They have different jobs and different result shapes:
- Terminal checkout methods return a payment snapshot or throw a static local error.
- The webhook receiver returns an HTTP status and a static response code after checking the exact raw request.
processBatch()returns disposition counts. Detailed reasons remain in its local evidence tables;getOrder()returns the conservative order projection.
Do not treat a code from one layer as a code from another. None of these components cancels, voids, refunds, retries a create request, or fulfills an order automatically. Checkout sends a new create only when the host calls begin() again after one of the two definite answers below (not_submitted, processor_unavailable).
Check the installation first
Run these components server-side on Node.js 24.21.0 or newer in the Node 24 line. Use one process on one host and durable local SQLite storage, not an ephemeral function or shared network filesystem. Keep each bundle complete and use the versions declared by its manifest.
The checkout needs a sandbox key with payments:write and payments:read, an HTTPS API origin (plain HTTP is only for a loopback test bridge), and fixed merchant and terminal IDs. Keep one checkout database per API origin, merchant, and terminal binding.
The receiver needs the endpoint signing secret, a stable trusted receiver ID, the expected merchant allowlist, and its durable database. It must receive the original bytes before any JSON parser. The evidence component uses that same database and receiver ID. Register the immutable binding returned by checkout getBinding(orderId) before applying events. Never construct a binding from webhook fields.
Read a checkout result
The application owns the order, price, user authorization, CSRF protection, rate limits, and fulfillment deduplication. The operator owns uncertain-outcome review and storage recovery.
| Snapshot status and code | Plain meaning | Safe next read or action | Stop when |
|---|---|---|---|
unknown / not_submitted | The binding was durably prepared but the create send has not been confirmed. This is normally only visible around local failure. | Preserve the database and order ID. Check storage health and the saved row. | Stop automated payment and fulfillment work until the local record is understood. |
pending / payment_pending or payment_processing | A matching sandbox terminal payment is still in progress. | Wait for authenticated webhook evidence or call refresh(orderId), which performs GETs only. A simulated terminal with sim_behavior manual (the REST default) stays pending until you call POST /v1/sandbox/terminals/{id}/simulate or the MCP tool simulate_terminal. | Stop polling aggressively; a timeout does not authorize another create. |
paid / payment_succeeded | A validated matching API response says succeeded with zero known refunded cents. | Record the observation and let the application apply its own idempotent fulfillment policy. Continue to process later authenticated evidence. | Stop if later checkout or evidence state requires review. |
not_paid / card_declined, payment_canceled, or payment_expired | The API returned one of the component's known final nonpayment combinations. | Show the known outcome. A new attempt requires a separately authorized application flow and order decision. | Do not change this order ID or delete its database row to force a retry. |
not_submitted / terminal_busy, terminal_offline, physical_terminal_unavailable, parameter_invalid, resource_missing, api_key_missing, api_key_malformed, api_key_invalid, insufficient_scope, live_mode_unavailable, or idempotency_key_required | The server refused the create with that catalogued error before writing any payment. | Fix the cause (wait for or cancel the running payment, ping the terminal, use a simulated terminal, correct the IDs or key), then call begin() again with the same order ID and amount. It records the refused attempt and sends a new one with a fresh reference and Idempotency-Key. | Do not change the order ID or delete the database; begin() is the sanctioned path. |
review_required / processor_unavailable | The server wrote the payment but its push to the terminal failed (502). | Call begin() again: it resends the identical request with the same Idempotency-Key and the server resumes the push. At most two resends. | If it stays processor_unavailable, call refresh(orderId); never create a new reference for this order. |
review_required / create_outcome_unknown | The create attempt had no trustworthy final response (timeout, lost response, 5xx other than the 502 above, 408, 429, a 409 with Retry-After, an unrecognized error, or a malformed body). It may or may not have reached the API. | Call refresh(orderId) for exact reference/payment lookup and preserve the identity for an operator. | If lookup stays empty, incomplete, ambiguous, or unavailable, stop. Never issue another POST for this order. |
review_required / lookup_inconclusive or refresh_failed | A read-only lookup could not establish current truth. | Check API availability and retry only the authorized read later. Capture the order ID, time, snapshot code, and whether lookup was by payment ID or reference. | Stop all automated fulfillment and payment creation while truth is inconclusive. |
review_required / payment_mismatch | The response failed a bound identity, amount, mode, method, state, timestamp, receipt, or ownership check. | Escalate with nonsecret expected-versus-observed field names. Preserve both databases. | Do not accept the response, rewrite the binding, or infer a processor outcome. |
review_required / payment_state_conflict | Equal-time or newer evidence contradicts an already saved final state. | Compare authenticated event history and authorized API reads; keep the historical identity. | Stop until a human resolves the application consequence. |
review_required / payment_failure_unknown | A final failure was not one of the known decline, cancellation, or expiry combinations. | Escalate the state and failure code as bounded metadata. | Do not translate it to declined or safe-to-retry. |
review_required / payment_refund_inconsistent, payment_refunded, or payment_partially_refunded | A positive refunded counter was observed. The counter is a high-water warning, not proof of a completed refund. | Inspect authenticated refund events and application records. | Stop fulfillment automation; never create a compensating refund or void from this snapshot. |
A later valid read can recover the checkout status from a failed refresh, including returning to the saved final state when the new read agrees with it. Stale reads cannot regress that saved final state, and lower refund counters cannot erase the saved refund high-water evidence. Repeated begin() returns the durable snapshot and never creates a retry escape, except the new attempt after not_submitted and the bounded same-key resend after processor_unavailable.
Checkout can instead throw configuration_invalid, request_invalid, order_missing, order_binding_mismatch, payment_unbound, checkout_closed, or terminal_checkout_storage_error. These are local exceptions, not payment outcomes. Correct configuration or caller input only when the trusted source is known. For payment_unbound, use the existing read-only recovery path. For storage errors, stop and repair storage before continuing; raw SQLite or transport errors are intentionally hidden.
Read a webhook receiver response
Only HTTP 200 means the authenticated event was durably received. It means durable inbox receipt only: it does not mean the payment succeeded, the order is paid, evidence was applied, or fulfillment ran. {received:true, duplicate:true} is a committed identical replay, not a new business event.
| HTTP / response code | Plain meaning | Owner and safe action |
|---|---|---|
400 invalid_event, ambiguous_headers, or request_aborted | The envelope, UTF-8/JSON, event-ID agreement, headers, or request stream was invalid. | Integration owner: compare the sender contract and raw-body adapter without logging the raw payload. Do not retry malformed content locally. |
401 invalid_signature | No configured current/previous secret verified the exact bytes within the five-minute tolerance. | Receiver operator: check clock, secret rotation, and raw-byte handling. Never weaken verification or paste the secret into evidence. |
403 mode_mismatch or merchant_mismatch | The event is live or outside the trusted merchant allowlist. The environment allowlist is read once at startup, so a merchant created afterwards is refused until its ID is configured and the receiver restarts. | Security/application owner: reject it and check endpoint/environment routing. For a merchant your platform created, add it from your own records and restart, or use the receiver's trusted isAllowedMerchant lookup; redeliver dead deliveries afterwards. Do not add an ID from request input to the allowlist. |
404 not_found / 405 method_not_allowed / 415 unsupported_content | The path, method, media type, or content encoding is unsupported. | Integration owner: correct the sender/adapter to the documented POST endpoint and JSON content type. |
408 request_timeout / 413 body_too_large | The request exceeded the five-second or 1 MiB receiver bound. | Receiver operator: investigate sender and capacity. Do not raise bounds casually or process the partial body. |
409 event_identity_conflict | The same event ID arrived with different authenticated bytes. | Security/application owner: preserve the original receipt and escalate. Never overwrite it or treat the second body as a replay. |
503 storage_unavailable or receiver_unavailable | Durable receipt did not complete, the bounded receiver failed, or the optional merchant lookup threw. | Operator: restore local storage/service health. Sender redelivery is safe because event identity is durable once committed. |
Receiver construction can throw Invalid receiver configuration. or verifier configuration can throw Provide one or two nonempty signing secrets and a clock. These startup errors are not HTTP event results. Fix trusted configuration before accepting traffic.
Read evidence processing
processBatch() reports applied, held, blocked, and ignored counts:
| Disposition | Plain meaning | Owner and stopping condition |
|---|---|---|
applied / evidence_applied | Valid evidence matched a registered immutable order binding and was committed atomically. | Application owner: read getOrder() and the semantic outbox. Do not equate application with fulfillment. |
held / order_unbound | A valid payment/refund identity has no registered trusted order yet. The inbox row remains pending for fair retry. | Application owner: recover the existing checkout identity, authorize the order, and register its exact binding. Never bind from the event. |
blocked / event_invalid, event_unsupported, payment_invalid, or refund_invalid | The saved event, supported type, or nested object failed strict validation. | Integration/security owner: inspect bounded metadata and the protected inbox locally. Stop; do not edit the raw row or mark it applied. |
ignored / unrelated_event | A recognized merchant, terminal, or webhook.test event has no order-payment effect. | No payment action. Retain normal receipt/deduplication policy. |
An order projection of awaiting_evidence means no accepted payment conclusion yet. success_observed means authenticated success evidence was seen; it deliberately does not mean paid or authorize fulfillment. not_paid_observed is limited to known decline, cancel, or expiry evidence. review_required is sticky after uncertain failure, contradictory finals, any refund signal, attention, reversal, or refund event. There is no review-resolution API. Preserve the record and require an application/operator decision.
Outbox kinds are payment_success_observed, payment_review_required, and refund_completion_observed. They are deduplicated observations for a future dispatcher, not commands. listOutbox() does not acknowledge delivery. A refund completion event still leaves the order in review; never trigger another refund or void from the outbox.
Evidence methods can throw order_evidence_configuration_invalid, order_binding_invalid, receiver_inbox_missing, receiver_inbox_incompatible, order_binding_mismatch, payment_already_bound, reference_already_bound, batch_limit_invalid, order_id_invalid, order_missing, order_evidence_closed, or order_evidence_storage_error. Treat them as local integration/storage faults, not remote payment results. Restore the compatible receiver inbox and immutable binding; do not create a replacement payment identity.
Escalate without secrets
Record the component name and version, UTC time window, application order ID, snapshot status/code or HTTP status/static code or evidence disposition/reason, API origin hostname, and whether the failure occurred before receipt, after durable receipt, or during evidence application. Include bounded nonsecret ownership field names, counts, and revision numbers.
Never include API keys, webhook secrets, authorization or signature headers, raw webhook bodies, database files or paths, idempotency keys, receipt bearer URLs, processor IDs, card data, or customer payloads. Keep the original order/payment/reference identity and durable databases available to the authorized operator. An unknown outcome remains unknown until an authorized read or authenticated evidence establishes otherwise.