GOAT Network
x402

x402 API Reference

This page captures the protocol details builders need most often during implementation.

Base Configuration

GOATX402_API_URL=https://api.x402.goat.network
GOATX402_API_KEY=your_api_key
GOATX402_API_SECRET=your_api_secret
GOATX402_MERCHANT_ID=your_merchant_id

Authentication

Backend requests use HMAC-SHA256 authentication with these headers:

  • X-API-Key
  • X-Timestamp
  • X-Sign

Signature construction:

  1. include request body fields plus api_key and timestamp
  2. remove empty values and the sign field
  3. sort keys in ASCII order
  4. join as k1=v1&k2=v2
  5. compute HMAC-SHA256 with the API secret

Endpoint Summary

MethodEndpointPurpose
POST/api/v1/orderscreate an order
GET/api/v1/orders/{order_id}query order status
GET/api/v1/orders/{order_id}/proofretrieve settlement proof
POST/api/v1/orders/{order_id}/calldata-signaturesubmit callback signature
POST/api/v1/orders/{order_id}/cancelcancel a still-cancellable order
GET/merchants/{merchant_id}fetch merchant information

Create Order Fields

FieldTypeRequiredNotes
dapp_order_idstringYesyour internal order identifier
chain_idnumberYestarget chain, such as 2345 for GOAT Network
token_symbolstringYestoken symbol such as USDC
token_contractstringNotoken contract address when needed
from_addressstringYespayer address
amount_weistringYestoken amount in wei
callback_calldatastringNoDELEGATE-only callback data
merchant_idstringNomerchant identifier

Frontend-Facing Order Fields

The fields most often normalized and passed back to frontend code are:

  • orderId
  • payToAddress
  • amountWei
  • calldataSignRequest
  • status

Order States

StateMeaning
CHECKOUT_VERIFIEDorder created and waiting for payment
PAYMENT_CONFIRMEDpayment observed and confirmed
INVOICEDcompleted
FAILEDterminal failure
EXPIREDexpired before completion
CANCELLEDcancelled while still cancellable

Error Semantics

StatusMeaning
200success
400validation or business error
401authentication error
402normal success path for order creation
403authorization error
404not found
500internal error

Integration Notes

  • HTTP 402 is not a failure for order creation; it is the expected payment-required response.
  • Persist proofs when you need settlement or delivery auditability.
  • Cancel stale CHECKOUT_VERIFIED orders to recover reserved operational balance.

On this page