Credits

Buy credits with USDC over x402

Buys one credit pack with USDC, over the x402 payment protocol, without a human at a checkout page.

The exchange is two requests. Call it with a packId and no PAYMENT-SIGNATURE header: it answers 402 with a PAYMENT-REQUIRED header carrying the quote, one accepts entry per chain this deployment settles on, each naming the token, the amount in atomic units, the address to pay and how long the quote is good for. Sign one of those entries and call again with the signed payload in PAYMENT-SIGNATURE. The payment is verified, settled, and only then are credits granted, in one database transaction with the receipt.

A payment signature buys credits exactly once. Presenting it again answers 409 payment_replayed rather than settling twice, and the details say what became of the original, so a retry after a lost response is safe. Do not send an Idempotency-Key: this operation does not take one, because the payment's own nonce is the key.

Credits bought this way are not refundable. The card path, createCreditCheckout, remains the default and is the one a human pays.

This operation exists only where the deployment enables USDC top-ups. Where it does not, every call answers 404 not_found, whatever the credential holds.

post/credits/topup

Request

  • Base URL: https://inkseal.net/api/v1
  • URL: https://inkseal.net/api/v1/credits/topup
  • Auth: HTTP bearer

Headers

PAYMENT-SIGNATUREstring

A signed x402 payment: base64 of the JSON payment payload, signed against one of the accepts entries from a previous 402. Omit it to receive the quote.

Request body

packId'pack_5' | 'pack_25' | 'pack_50' | 'pack_100' | 'pack_500' required

Which pack to buy. The sizes and prices are the ones published at https://inkseal.net/pricing, the same table createCreditCheckout sells from.

Example request

{
  "packId": "pack_25"
}

Response

The payment settled and the credits are in the balance. PAYMENT-RESPONSE carries the settlement receipt.

Example response

{
  "data": {
    "credits": 25,
    "balance": 31,
    "packId": "pack_25",
    "payment": {
      "network": "eip155:8453",
      "transaction": "0x9f2b1c0d5a4e6f78901234567890abcdef1234567890abcdef1234567890abcd",
      "payer": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
      "amountUsd": "39.00"
    }
  }
}

Changes

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