Skip to main content
POST
/
api
/
x402
/
pay
Pay for a service via x402 protocol
curl --request POST \
  --url https://mag3nt.com/api/x402/pay \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "card_id": "sx_a66a6666-...",
  "card_token": "tok_3b9fe670-...",
  "amount": 0.5,
  "merchant": "weather-api.com",
  "merchant_address": "0xABC...",
  "network": "eip155:8453"
}
'
{
  "success": true,
  "transaction_id": "txn_abc123",
  "card_id": "sx_a66a6666-...",
  "amount": 0.5,
  "protocol": "x402",
  "payment_header": {
    "X-mag3nt-Transaction": "txn_abc123",
    "X-mag3nt-Amount": "0.5"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.mag3nt.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

API key with 'Bearer sx_live_...' prefix

Body

application/json
card_id
string
required

Card identifier (sx_...)

Example:

"sx_a66a6666-1234-5678-9abc-def012345678"

card_token
string
required

Card secret token (tok_...)

Example:

"tok_3b9fe670-abcd-efgh-ijkl-mnopqrstuvwx"

amount
number
required

Payment amount in USDC

Example:

0.5

merchant
string

Merchant identifier

Example:

"weather-api.com"

merchant_address
string

Merchant wallet for settlement

Example:

"0xABC..."

mcc
string

Merchant category code

resource_url
string

URL being paid for

network
string
default:eip155:8453

Response

Payment authorized

success
boolean
transaction_id
string
card_id
string
amount
number
network
string
resource_url
string | null
protocol
string
Example:

"x402"

timestamp
string<date-time>
payment_header
object