Skip to main content
POST
/
v1
/
settle
Settle x402 payment
curl --request POST \
  --url https://api.mrdn.finance/v1/settle \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "paymentPayload": {
    "x402Version": 1,
    "scheme": "exact",
    "network": "base-sepolia",
    "payload": {
      "signature": "<string>",
      "authorization": {
        "from": "<string>",
        "to": "<string>",
        "value": "<string>",
        "validAfter": "<string>",
        "validBefore": "<string>",
        "nonce": "<string>"
      }
    }
  },
  "paymentRequirements": {
    "amount": "<string>",
    "recipient": "<string>",
    "network": "<string>",
    "asset": "<string>",
    "resource": "<string>",
    "description": "<string>",
    "mimeType": "<string>"
  }
}
'
Settle an x402 payment on-chain after verification. This endpoint executes the actual blockchain transaction to transfer funds according to the x402 payment authorization.

Authentication

Requires API key authentication with organization context.

Recipient

The recipient wallet that receives settled funds is configured in your organization settings and tied to your API key. You do not need to specify the recipient in the request body.

Request Body

{
  "paymentPayload": {
    "x402Version": 1,
    "scheme": "exact", 
    "network": "base-sepolia",
    "payload": {
      "signature": "0x...",
      "authorization": {
        "from": "0x742d35Cc6634C0532925a3b8D0c4E5e6C2aE7A3e",
        "to": "0x8e633dBf31adCc7D41BE3e95B7c8DD3526B5235A",
        "value": "1000000",
        "validAfter": "1234567890",
        "validBefore": "1234567899", 
        "nonce": "0x..."
      }
    }
  },
  "paymentRequirements": {
    "scheme": "exact",
    "network": "base-sepolia",
    "maxAmountRequired": "1000000",
    "resource": "https://example.com/resource",
    "description": "Payment for resource access",
    "mimeType": "application/json",
    "payTo": "0x8e633dBf31adCc7D41BE3e95B7c8DD3526B5235A",
    "maxTimeoutSeconds": 3600,
    "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
  }
}
Both authorization.to and payTo must be set to the facilitator contract address for the network.
NetworkFacilitator Contract
base0x8E7769D440b3460b92159Dd9C6D17302b036e2d6
base-sepolia0x8e633dBf31adCc7D41BE3e95B7c8DD3526B5235A
optimism0x8E7769D440b3460b92159Dd9C6D17302b036e2d6
optimism-sepolia0x8e633dBf31adCc7D41BE3e95B7c8DD3526B5235A
polygon0x8E7769D440b3460b92159Dd9C6D17302b036e2d6
Supported Networks: base, base-sepolia, optimism, optimism-sepolia, polygon

Response

Success Response

{
  "success": true,
  "transaction": "0x1234567890abcdef...",
  "network": "base-sepolia"
}

Error Response

{
  "success": false,
  "errorReason": "insufficient_funds",
  "transaction": "",
  "network": "base-sepolia"
}

Error Codes

  • invalid_payload - Payment payload format is invalid
  • invalid_payment_requirements - Payment requirements format is invalid
  • insufficient_funds - Insufficient balance for settlement
  • unexpected_settle_error - Unhandled exception during settlement
  • invalid_transaction_state - On-chain transaction failed

Authorizations

Authorization
string
header
required

Body

application/json
paymentPayload
object
required
paymentRequirements
object
required

Response

Payment settlement result