Create buyback offer

POST /api/v1/mystery/buyback/:purchase_id packs:buyback

Creates a system-signed MARKETPLACE offer on a card (so rip.fun collects the marketplace fee) at 85% of its value by default. Only cards valued $10–$100 are eligible. The current holder accepts the offer from their own wallet and receives proceeds net of fee. The path segment accepts EITHER a purchase id OR an on-chain token id: a value matching one of your purchases runs the purchase-linked path, otherwise it is treated as a token id and behaves exactly like POST /buyback (token-first — works for cards distributed through your own system, raw + graded, with value_usdc/value_source in the response). Fill in EITHER input below. Purchase ids take precedence.

Try it POST /api/v1/mystery/buyback/ money

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

request body
object · 0 keys
{}
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/buyback/' \
  -H 'X-API-Key: rip_v1_…' \
  -H 'Content-Type: application/json' \
  -d '{}'

Request fields

FieldTypeRequiredDescription
token_idstringPurchase path: required when the purchase revealed multiple items (ignored on the token-id path — the path segment IS the token)
item_typestringToken-id path only: "CARD" or "GRADED_CARD" — disambiguates a numeric id shared by a raw and a graded card
offer_price_usdcstringOverrides the default 85%-of-value price (can never exceed the value)

Response fields (data)

FieldDescription
offer_signature / offer_idThe signed marketplace offer
price / price_usdcGross offer price
seller_receives_usdc / marketplace_fee_usdcNet to the holder vs rip.fun fee
requester / target / deadlinerip.fun signer, current holder, offer expiry
value_usdc / value_sourceToken-id path only: what was priced and from which source (card_raw_price / buyback_oracle / graded_market_price)

Errors

StatusCodeWhen
409not_eligiblecard value outside the $10–$100 buyback range
409value_unknownno market price available for the card
409not_fulfilledpurchase path: purchase has not revealed yet
404token_not_foundtoken-id path: neither a purchase of yours nor a known token
409offer_existsanother active offer already targets that token (double-payout guard)
409ambiguous_tokentoken-id path: id is both a raw and a graded card — pass item_type

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

Flow

  1. Partner: POST /buyback/:id with a purchase id OR a token id → rip.fun system-signs a marketplace offer (85% of value)
  2. End user (holder): accepts the offer from their wallet on the marketplace → receives USDC net of fee
  3. rip.fun: fronts the USDC (billed to you monthly) and a worker forwards the NFT to your pool wallet
  4. Webhooks: buyback.confirmed → buyback.card_transferred (or buyback.transfer_held if no pool wallet is set)