Palbase IAP · API
/iap/customers/{customer_id}/subscriptions/{subscription_id}/cancelCancel a subscription's renewal
Turns the subscription's renewal off: it ends at its period's end, the customer keeping what they paid for. Google Play and Stripe; an App Store subscription's renewal is the customer's to turn off (409 customer_cancels). Kept in the history (cancel_requested).
Called by your server, with the project's secret key.
Path
customer_idstring · requiredThe customer: the user's id (a guest merged into an account names the account).subscription_idstring (uuid) · requiredThe subscription, by its id in the customer's record (subscriptions[].id).Headers
Idempotency-Keystring · optionalMakes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.Request body
notestring · optionalWhat support writes of it (500 characters at most): the record.curl -X POST "https://<your-ref>.palbase.studio/iap/customers/<customer_id>/subscriptions/<subscription_id>/cancel" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"note":"string"}'Responses
200Done, and the subscription after
400A field out of its bounds (`invalid_days`, `invalid_reason`, `invalid_mode`, `invalid_note`), or the body is not the request
401No key, not a key of this project, or a token that is not valid (the edge's answer)
403Not the project's secret key (`secret_key_required`)
404The customer has no such subscription (`subscription_not_found`, `customer_not_found`)
409Only the customer turns an App Store subscription's renewal off (`customer_cancels`); the store refused (`store_refused`, with what it said), the project's store connection cannot act on it (`store_not_connected`, `apple_not_connected`; a web subscription's, the payments module refused it, its code and words passed on as it answered them), or a request with this Idempotency-Key is still running
410The user was deleted (`customer_erased`)
429Over the project's request limit; Retry-After says when to try again
502The store could not be reached (`store_unreachable`); retrying with the same Idempotency-Key is safe
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation CancelSubscription of iap's contract.