palbaseDocs

Palbase IAP · API

POST/iap/me/merge-grant

Prove a guest's purchases

Asked with a guest's session before it signs in to an existing account: a proof, good for 5 minutes, that whoever signs in held the guest. Spent with the account's session (POST /iap/me/merge), it moves what the guest bought to the account. A guest that signs up instead keeps its id, and its purchases with it: nothing to merge.

Called by a signed-in user of your app, with their token and the publishable key.

curl
curl -X POST "https://<your-ref>.palbase.studio/iap/me/merge-grant" \
  -H "apikey: $PALBASE_PUBLISHABLE_KEY" \
  -H "authorization: Bearer $USER_ACCESS_TOKEN"

Responses

201The proof

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

403Not a guest (`guest_required`)

404The user's id is longer than a customer's (`customer_not_found`)

409This guest's purchases went to an account already (`customer_merged`)

410The user was deleted (`customer_erased`): their id is no customer's again

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 CreateMergeGrant of iap's contract.