Palbase IAP · API
/iap/redemptions/redeemRedeem a web purchase
Redeems a link to a purchase made on the web by a buyer without an account: the purchase becomes the session's customer's — a guest's goes with them to the account they sign in to, as all a guest has. A link works once, for an hour; once one of a purchase's links is redeemed, all of them are spent. An expired link sends a new one to the address the buyer gave at checkout (410 redemption_expired, resent), once. Limited per customer and per address. Answers what the customer has now.
Called by a signed-in user of your app, with their token and the publishable key.
Request body
tokenstring · requiredThe link's token: what the app was handed (`token` of `<scheme>://palbase/redeem?token=…`).curl -X POST "https://<your-ref>.palbase.studio/iap/redemptions/redeem" \
-H "apikey: $PALBASE_PUBLISHABLE_KEY" \
-H "authorization: Bearer $USER_ACCESS_TOKEN" \
-H "content-type: application/json" \
-d '{"token":"string"}'Responses
200What the customer has now
400The request is malformed, or a field breaks a rule (the error names which)
401No customer's session (`session_required`): a customer's own is reached with the publishable key and their access token; or the edge refused the key or token
404No such link (`redemption_not_found`), or the user's id is longer than a customer's (`customer_not_found`)
409The purchase was redeemed (`already_redeemed`), or this guest's purchases went to an account (`customer_merged`): use the account's session
410The link expired (`redemption_expired`; `resent` says a new one was sent), or the user was deleted (`customer_erased`)
413The request body is too large (`request_too_large`)
429Over the project's request limit; Retry-After says when to try again
503Another change to this customer is in progress (`customer_busy`), or the platform could not answer now; retrying is safe after Retry-After
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation RedeemPurchase of iap's contract.