Skip to main content
POST
/
settle
cURL
curl --request POST \
  --url https://asdo.algen.network/settle \
  --header 'Content-Type: application/json' \
  --data '
{
  "x402Version": 1,
  "paymentPayload": {
    "x402Version": 1,
    "scheme": "exact",
    "network": "mesherX",
    "payload": {
      "signature": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480",
      "authorization": {
        "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
        "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
        "value": "1000000000000000000",
        "validAfter": "1716150000",
        "validBefore": "1716150000",
        "nonce": "0x1234567890abcdef1234567890abcdef12345678"
      }
    }
  },
  "paymentRequirements": {
    "scheme": "exact",
    "network": "mesherX",
    "maxAmountRequired": "1000000",
    "resource": "https://api.example.com/premium/resource/123",
    "description": "Premium API access for data analysis",
    "mimeType": "application/json",
    "outputSchema": {
      "data": "string"
    },
    "payTo": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "maxTimeoutSeconds": 10,
    "asset": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "extra": {
      "gasLimit": "1000000"
    }
  }
}
'
{
  "success": false,
  "errorReason": "insufficient_funds",
  "payer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "transaction": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
  "network": "mesherX"
}

Body

application/json
x402Version
enum<integer>
required

The version of the x402 protocol.

Available options:
1
Example:

1

paymentPayload
object
required

The x402 protocol payment payload attached to X-PAYMENT header.

Example:
{
"x402Version": 1,
"scheme": "exact",
"network": "mesherX",
"payload": {
"signature": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480",
"authorization": {
"from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"value": "1000000000000000000",
"validAfter": "1716150000",
"validBefore": "1716150000",
"nonce": "0x1234567890abcdef1234567890abcdef12345678"
}
}
}
paymentRequirements
object
required

The payment requirements expected by the resource server.

Response

Successfully settled payment on the x402 protocol.

success
boolean
required

Indicates whether the payment settlement is successful.

Example:

false

payer
string
required

The onchain address of the client paying for the resource.

Example:

"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"

transaction
string
required

The settlement transaction hash.

Example:

"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"

network
string
required

The network where settlement occurred.

Example:

"mesherX"

errorReason
enum<string>

The reason the payment settlement errored on the x402 protocol.

Available options:
insufficient_funds,
invalid_scheme,
invalid_network,
invalid_x402_version,
invalid_payment_requirements,
invalid_payload,
invalid_exact_evm_payload_authorization_value,
invalid_exact_evm_payload_authorization_valid_after,
invalid_exact_evm_payload_authorization_valid_before,
invalid_exact_evm_payload_authorization_typed_data_message,
invalid_exact_evm_payload_authorization_from_address_kyt,
invalid_exact_evm_payload_authorization_to_address_kyt,
invalid_exact_evm_payload_signature_address,
settle_exact_svm_block_height_exceeded,
settle_exact_svm_transaction_confirmation_timed_out
Example:

"insufficient_funds"