Prepare (non-custodial)

POST /api/v1/mystery/purchase/prepare packs:purchase

Non-custodial purchase, step 1: returns unsigned USDC-approve + purchase calldata. The END USER signs and broadcasts these from their own wallet — rip.fun never touches their funds. Creates no rows.

Try it POST /api/v1/mystery/purchase/prepare write

These inputs are shared across all docs pages — an id entered here carries over.

request body
object · 2 keys
{
  "wallet_address": "0x0000000000000000000000000000000000000000",
  "tier_id": 1
}
response

Not run yet — press Run to make a live call against https://staging-service.rip.fun (through this demo's server-side proxy; the API key never reaches the browser).

curl (tracks the inputs above)
curl -X POST 'https://staging-service.rip.fun/api/v1/mystery/purchase/prepare' \
  -H 'X-API-Key: rip_v1_…' \
  -H 'Content-Type: application/json' \
  -d '{"wallet_address":"0x0000000000000000000000000000000000000000","tier_id":1}'

Request fields

FieldTypeRequiredDescription
wallet_addressstringyesEnd-user wallet that will sign + pay
tier_idnumberyesTier to purchase
max_price_usdcstringPrice cap; defaults to the last-seen tier price

Response fields (data)

FieldDescription
chain_id / contract / payment_tokenChain + MysteryComboPool + USDC addresses
max_price / max_price_usdcApproval amount (micros + decimal)
calls[]{to, data, description} — approve USDC, then purchase the tier

Errors

StatusCodeWhen
400invalid_tierunknown tier_id

See Errors for the response envelope and the full code list.

Flow

  1. Partner: POST /purchase/prepare with the user’s wallet_address + tier_id
  2. End user: signs + broadcasts calls[0] (USDC approve, skippable if allowance suffices) then calls[1] (purchase) from their own wallet
  3. Partner: POST /purchase/submit with the tx hash (+ request_id from the receipt logs) to link settlement
  4. rip.fun: VRF reveals the items; poll GET /purchase/:id until FULFILLED (or use the purchase.fulfilled webhook)