Buy (or check) an x402 session

Without a session or payment this answers 402 with the x402 body: accepts[0] gives the exact amount, payTo (QPayhub) and extra.{sellerId, resourceId, settlement:'contract'}, and paymentTicket carries a nonce. Pay on-chain with QPAYHUB.Pay (inputType 1; seller = sellerId, resource = sha256(resourceId), the ticket's nonce, exactly that amount), then repeat the request with X-PAYMENT: base64(JSON { x402Version: 2, resource, accepted, payload: { txHash, ticket }, extensions }). The server finds the payment in QPayhub's receipt, checks payer, seller, resource, nonce and amount, counts each payment once, and returns 200 with X-ACCESS-GRANT and X-ACCESS-GRANT-EXPIRES. Send the grant as X-ACCESS-GRANT on later requests. If the transaction is not confirmed yet the 402 says invalid_transaction_state: wait a few seconds and send the same header again. Inside a session there is no per-call charge for split quotes or arbitrage results, and the rate limit is the keyed one (ten times the free limit), counted for the session rather than the IP address.

get/v1/session

Request

  • Base URL: https://qmax.exchange/api
  • URL: https://qmax.exchange/api/v1/session
  • Auth: none declared

Headers

X-PAYMENTstring

base64 JSON payment payload after paying QPayhub

X-ACCESS-GRANTstring

Session token from an earlier purchase

Response

{ ok, expiresAt, seconds, note }; headers X-PAYMENT-RESPONSE, X-ACCESS-GRANT, X-ACCESS-GRANT-EXPIRES

Changes

No recorded changes to this operation across all 1 revision of this API.