← Home
POST/hyax-api/trpc/crypto.createCryptoCheckoutSession

Create a USDC checkout session

Public tRPC mutation — buyers are anonymous at checkout, so no API key is needed. Wrap the input in `{ "json": … }` (SuperJSON) and read the result from `result.data.json`. Pricing is never trusted from the client: shipping and coupons are recomputed server-side. Each session adds a sub-cent nonce to the total so every open session has a unique expected amount — the buyer must transfer `amountBaseUnits` exactly, or verification fails. Sessions expire after 3 hours.

Base URL: https://platform.hyax.com · Replace YOUR_API_KEY with your team API key.

Request body

FieldRequiredDescription
teamId Required Team receiving the payment. Must have crypto enabled and a valid wallet.
amountCents Required Integer USD cents before discounts
customerEmail Required Buyer email; used to create or match the person on fulfillment
chainIdNoSupported network ID. Default `8453` (Base).
currencyNoDefault `usd`
customerNameNo
productIdNoProduct to grant access to on fulfillment
itemsNoCart line items; also used for coupon eligibility
couponCodeNoValidated and applied server-side
shippingRateIdNoRecalculated server-side against the shipping address
shippingAddressNoObject: firstName, lastName, email, phone, address1, address2, city, state, zipCode, country
billingAddressNoSame shape as `shippingAddress`
visitorIdNoCookie ID for revenue attribution
postIdNoAttribute the sale to a post
linkIdNoAttribute the sale to a link

Request

curl -X POST 'https://platform.hyax.com/hyax-api/trpc/crypto.createCryptoCheckoutSession' \
  -H 'Content-Type: application/json' \
  -d '{
    "json": {
      "teamId": "clx_team_id",
      "amountCents": 4999,
      "chainId": 8453,
      "currency": "usd",
      "customerEmail": "[email protected]",
      "customerName": "Jane Smith",
      "productId": "clx_product_id",
      "items": [
        {
          "id": "1",
          "productId": "clx_product_id",
          "name": "E-book",
          "price": 49.99,
          "quantity": 1
        }
      ],
      "visitorId": "hyax_vid_abc123"
    }
  }'

Response

{
  "result": {
    "data": {
      "json": {
        "sessionId": "clx…",
        "recipientAddress": "0xYourReceivingWalletAddress00000000000000",
        "chainId": 8453,
        "networkName": "Base",
        "nativeSymbol": "ETH",
        "tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "amountBaseUnits": "49994271",
        "amountDisplay": "49.994271"
      }
    }
  }
}