Skip to main content
POST
Settle Permission

Authorizations

Authorization
string
header
required

Your Nevermined API Key (starts with 'nvm:'). Get one at nevermined.app under Settings > API Keys.

Body

application/json

Settlement request

Body of POST /x402/settle — the same SettlePermissionsDto as verify. paymentRequired and x402AccessToken are both required and the handler runs a ValidationPipe, so a body missing either is rejected with 400 before settlement runs. planId, subscriberAddress, agentId, the endpoint and the HTTP verb are read out of the token — never sent alongside it.

paymentRequired
object
required

The server's 402 PaymentRequired response. The facilitator validates that the scheme accepted inside the token matches one of accepts.

x402AccessToken
string
required

The x402 payment payload, base64-encoded — the token minted by POST /x402/permissions.

Example:

"eyJ4NDAyVmVyc2lvbiI6MiwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly9teWFnZW50LmFpL2FwaS92MS90YXNrcyJ9LCJhY2NlcHRlZCI6eyJzY2hlbWUiOiJudm06ZXJjNDMzNyIsIm5ldHdvcmsiOiJlaXAxNTU6ODQ1MzIiLCJwbGFuSWQiOiI0NDc0Mjc2MzA3NjA0NzQ5NzY0MDA4MDIzMDIzNjc4MTQ3NDEyOTk3MDk5MjcyNzg5NjU5Mzg2MTk5NzM0NzEzNTYxMzEzNTU3MTA3MSIsImV4dHJhIjp7InZlcnNpb24iOiIxIiwiYWdlbnRJZCI6IjgwOTE4NDI3MDIzMTcwNDI4MDI5NTQwMjYxMTE3MTk4MTU0NDY0NDk3ODc5MTQ1MjY3NzIwMjU5NDg4NTI5Njg1MDg5MTA0NTI5MDE1IiwiaHR0cFZlcmIiOiJQT1NUIn19LCJwYXlsb2FkIjp7InNpZ25hdHVyZSI6IjB4MTIzNCIsImF1dGhvcml6YXRpb24iOnsiZnJvbSI6IjB4ZjM5RmQ2ZTUxYWFkODhGNkY0Y2U2YUI4ODI3Mjc5Y2ZmRmI5MjI2NiIsInNlc3Npb25LZXlzUHJvdmlkZXIiOiJ6ZXJvZGV2Iiwic2Vzc2lvbktleXMiOltdfX0sImV4dGVuc2lvbnMiOnt9fQ=="

maxAmount
string

Maximum credits to redeem during settlement. Send it as a decimal STRING: the value is parsed with BigInt() and then required to be a bigint, so a JSON number is rejected with 400.

Example:

"2"

agentRequestId
string

Agent request id for observability, as returned by POST /x402/verify. Bounded to 1–128 URL-safe ASCII characters because the value is interpolated into a Helicone filter and persisted to agent_tasks.

Maximum string length: 128
Pattern: ^[a-zA-Z0-9\-_]{1,128}$
Example:

"arId-123e4567-e89b-12d3-a456-426614174000"

batch
boolean

Whether this settles a batch — several LLM calls made under one agentRequestId.

Example:

true

marginPercent
number

Margin percentage used for credit calculation. Mutually exclusive with maxAmount when agentRequestId is supplied.

Required range: 0 <= x <= 10
Example:

0.2

Response

Settlement complete

Settlement receipt. success alone tells you the settle worked; what to check in addition depends on billingModel. On credits plans the payment shows up as creditsRedeemed > 0. On pay-as-you-go plans there is no credit balance, so creditsRedeemed and remainingBalance are always the string "0" even on a charge that succeeded — the proof there is success: true plus a non-empty orderTx (fiat rails) or transaction (crypto rails). Do not gate on creditsRedeemed without reading billingModel first: on a card rail that reports a real charge as a decline and invites a retry of a payment that already went through. Note the credit fields are strings, so "0" is truthy while Number("0") > 0 is false.

success
boolean

Whether settlement was successful.

errorReason
string

Reason for settlement failure (only present if success is false).

payer
string

Address of the payer's wallet.

transaction
string

Blockchain transaction hash. On crypto pay-as-you-go plans this is also the reference for the per-request charge.

network
string

Network identifier. The discriminator is the rail, not the billing model: a CAIP-2 chain id (eip155:84532) for crypto rails under both billing models, or the settling payment provider (stripe, braintree, visa) for fiat card-delegation rails.

Example:

"eip155:84532"

billingModel
enum<string>

Which billing model this settle was priced under. Present regardless of success — check success before treating it as evidence of a charge. Read it before the two credit fields.

Available options:
credits,
pay-as-you-go
creditsRedeemed
string

Number of credits redeemed. Always "0" for pay-as-you-go plans, which hold no credit balance — including on a settle that charged the buyer successfully.

Example:

"2"

remainingBalance
string

Subscriber's remaining credit balance. Always "0" for pay-as-you-go plans — the per-request charge is referenced by orderTx (fiat) or transaction (crypto), not here.

Example:

"98"

orderTx
string

Reference for the order or per-request charge, if one occurred. On fiat pay-as-you-go this is the per-request charge (a Stripe PaymentIntent id, a Braintree transaction id); crypto pay-as-you-go reports its on-chain order in transaction instead. On credits plans it is set only when the settle had to order credits first (auto top-up).

Example:

"pi_3TUrvfBYvSRKcV420xCBjHb1"