API

1. Facilitator API Overview

The xPlug Facilitator API is publicly accessible.

No special authentication is required. You do not need to set up a client key or secret key. Simply set the xPlug Facilitator URL, and you are good to go.

Base URL : https://facilitator.xplug.io

Endpoints :

  • /verify : Used to validate whether the input conforms to the x402 standard.

  • /settle : Used to charge x402 transactions.

  • /support : Provides information on available networks.

2. x402 Payment Flow

The xPlug Facilitator adheres to the standard HTTP request-response cycle for x402 protocols.

  • Initial Request (No Payment): The client sends an HTTP request to the server without the required payment header (X-PAYMENT-HEADER).

  • Payment Requirement Response: The server responds with HTTP Status Code 402 (Payment Required), including the payment requirement information in the response body.

  • Authorization and Signature: The client signs the payment authorization and resends the request, including the base64-encoded signature to the server.

  • Validation and Settlement: The server validates the signature, performs the payment settlement on the blockchain, and then returns the requested premium content.

3. Reference

3.1 Payment Requirements Response

Field Descriptions

Field Name
Data Type
Description

x402Version

number

Protocol version identifier

error

string

Error message explaining why payment is required

accepts

array of Payment Requirements Object

Array of payment requirements object

Payment Requirements Object Descriptions

Field Name
Type
Required
Default
Description

scheme

string

exact

Payment scheme identifier

network

string

Blockchain network identifier (supported : "solana" , "solana-devnet")

maxAmountRequired

string

Required payment amount in decimal units

asset

string

86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY

Token contract address

payTo

string

Recipient wallet address

resource

string

URL of the protected API

description

string

Human readable description of API endpoint

mimeType

string

application/json

MIME type of response

outputSchema

object

JSON schema of the response

maxTimeoutSeconds

number

Maximum time allowed for payment settlement

extra

object

Scheme-specific additional information

3.2. POST /verify

Endpoint

HTTP Request Body

HTTP Response 200 (Success)

HTTP Response 400 (Bad Request)

3.3. POST /settle

Endpoint

HTTP Request Body

HTTP Response 200

HTTP Response 400

Last updated