Skip to content

Authorize a single x402 payment

Returns a signed X-Payment for one resource. If the user's settings require approval, returns `status: "need_approval"` with `approvalUrl`; retry with `approvalId` after the user approves.

POST
/api/payment/x402V1Payment

Request Body​

application/json

V1 payment request — copy fields from the 402 accepts entry.

Payment scheme.

Valid values"exact"

base, base-sepolia (or CAIP-2), fluxa-monetize-credits, or xrpl-mainnet (where enabled).

Amount in atomic units.

Currency.

Valid values"USDC""FLUXA_MONETIZE_CREDITS""XRP"
Default"USDC"

Token contract (USDC).

Recipient (for credits: monetize.fluxapay.xyz).

Host of the resource being paid.

Full resource URL.

Shown to the user.

EIP-712 domain name (extra.name).

EIP-712 domain version (extra.version).

Signature validity; default 60, clamped to 30–300.

Minimum30
Maximum300
Default60

approvalId from a previous need_approval response, after the user approved.

Optional suggested mandate description.

Optional suggested mandate label.

Optional suggested mandate budget (atomic).

Optional ISO timestamp.

Optional ISO timestamp.

Responses​

Signed payment (status: "ok"), or approval required (status: "need_approval" / "need_manual_signature" with approvalUrl).

application/json
One of

Signed payment.

ok.

Send as the X-Payment header when retrying the resource.

Decoded X-Payment.

FluxA payment record ID.

Signature expiry (Unix seconds).

Human-readable note.

Guidance for LLM agents. Surface instructions to the model.

User approval required (HTTP 200).

need_approval or need_manual_signature.

Valid values"need_approval""need_manual_signature"

Send back as approvalId after approval.

Link for the user.

Approval expiry (Unix seconds).

Human-readable note.

Guidance for LLM agents. Surface instructions to the model.

{
  "status": "<string>",
  "xPaymentB64": "<string>",
  "xPayment": {
    "x402Version": "<integer>",
    "scheme": "<string>",
    "network": "<string>",
    "payload": {
      "signature": "<string>",
      "authorization": {
        "from": "<string>",
        "to": "<string>",
        "value": "<string>",
        "validAfter": "<string>",
        "validBefore": "<string>",
        "nonce": "<string>"
      }
    }
  },
  "paymentRecordId": "<integer>",
  "expiresAt": "<integer>",
  "message": "<string>",
  "payment_model_context": {
    "instructions": "<string>"
  }
}

Released under the MIT License.