Nostraddeveloper documentationDocumentationDeveloper console

Selling in your app

Selling: list, start, come back

List what's on sale

curl "https://gateway.nostrad.ai/v1/products?ids=coins_100,level_2" -H "Authorization: Bearer $ACCESS_TOKEN"
{ "products": [ { "id": "coins_100", "type": "consumable", "name": "100 coins", "description": "A bag of coins",
    "price": { "credits": 199, "usd": "1.99" }, "display_price": "$1.99", "multi_quantity": true, "owned": false } ],
  "unfetched": [ { "id": "level_2", "reason": "not_found_or_not_on_sale" } ] }

Start a purchase

curl https://gateway.nostrad.ai/v1/purchases -H "Authorization: Bearer $ACCESS_TOKEN" -H "content-type: application/json" \
  -d '{"product": "coins_100", "quantity": 2, "account_token": "user-42", "return_url": "https://app.example/bought"}'
{ "purchase_url": "https://accounts.nostrad.ai/purchase/pur_...", "expires_at": 1793000000000 }

Coming back

The person choseYour return_url gets
Buy?purchase_token=pt_... (added to any query it had)
Cancel?error=user_canceled

The return alone proves nothing: anyone can open that address. Deliver only after your server has checked the purchase, or on the signed notification.

Restoring purchases

GET /v1/purchases with the person's token answers what they own in your app now: { "purchases": [ ... ] }, each shaped as above. Call it when they sign in on a new device, and after already_owned. Deliver, and acknowledge, any you haven't yet.