palbaseDocs

Palbase IAP · API

POST/iap/checkout/redemption

A web purchase's redemption link

The link a checkout's success page shows its buyer, who has no account (a checkout opened with the app's key alone): to the holder of the key the checkout's opener was given (redemption_key), a new one each time asked, ten at most, within an hour of the payment — past it the link is the email's alone. A session Stripe has not reported yet is read from Stripe. The project's secret key — its support, for a buyer whose email went astray — is shown one at any time, with no key. Limited per address and per project with the app's key alone, per customer and per address with a session. Closed to an environment's token (403 token_out_of_scope): the link hands a purchase to whoever opens it.

Called by your app, with the publishable key; or a signed-in user of your app, with their token and the publishable key; or your server, with the project's secret key.

Request body

keystring · optionalThe checkout's `redemption_key`.
session_idstring · requiredThe Checkout session's id (Stripe's `{CHECKOUT_SESSION_ID}`).
curl
curl -X POST "https://<your-ref>.palbase.studio/iap/checkout/redemption" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"session_id":"string"}'

Responses

201A new link

400The request is malformed, or a field breaks a rule (the error names which)

401No key of the project (`key_required`); or the edge refused the key or token

403An environment's token (`token_out_of_scope`): the link would hand a purchase to whoever holds it

404No checkout of a buyer without an account has this id and key (`checkout_not_found`)

409The checkout is not paid yet (`checkout_not_paid`; retrying is safe after Retry-After); or what it bought was redeemed (`already_redeemed`)

410Past an hour since the payment (`checkout_page_expired`): the link was sent to the buyer's email

413The request body is too large (`request_too_large`)

422The Idempotency-Key was sent with a different request (`idempotency_key_reused`)

429The page was shown its links (`too_many_links`), or too many requests were made with the app's key alone (`too_many_requests`); retrying is safe after Retry-After

502Stripe could not be reached (`stripe_unreachable`); retrying is safe after Retry-After

503The platform could not answer now; retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation CreateCheckoutRedemption of iap's contract.