TheDocumentation Index
Fetch the complete documentation index at: https://docs.x402r.org/llms.txt
Use this file to discover all available pages before exploring further.
forwardToArbiter() function creates an onAfterSettle hook that forwards the response body and reconstructed PaymentInfoWire to an arbiter service. It runs fire-and-forget so it never blocks the response to the client.
- Only fires for successful
auth-capturescheme settlements - POSTs
{ responseBody, transaction, paymentInfoWire }to{arbiterUrl}/verify - The hook catches errors internally so an unreachable arbiter cannot break the payment flow
Usage
Function signature
Parameters
| Parameter | Type | Description |
|---|---|---|
arbiterUrl | string | Base endpoint of your arbiter service (for example, http://arbiter:3001) |
options | ForwardToArbiterOptions | Optional configuration (see below) |
Options
Payload shape
When anauth-capture settlement succeeds, the hook POSTs the following JSON to {arbiterUrl}/verify:
PaymentInfoWire from the verified SettleResultContext using the reconstructPaymentInfoWire() helper. The arbiter consumes req.body.paymentInfoWire and runs it through PaymentInfo.fromWire(...) (from @x402r/sdk or @x402r/core) to get the bigint-typed PaymentInfo struct expected by SDK actions.
Error handling
By default, the hook logs fetch errors withconsole.warn. Override this with a custom handler:
X402rError carrying the arbiter endpoint and request details for easier debugging.
Skipped scenarios
The hook returns without making a request when:- The settlement was not successful (
context.result.success === false) - The scheme is not
auth-capture - No response body is available in the transport context
Address re-exports
The@x402r/helpers package re-exports chain-invariant address constants from @x402r/core for convenience:
@x402r/evm wire-format types and guards:
x402rDefaults builder for hand-constructing extra in PaymentRequirements:
x402rDefaults(input) returns an AuthCaptureExtra populated with sensible defaults, useful when you want to build PaymentRequirements outside the merchant client.
Next steps
Examples
See working merchant server examples.
