palbaseDocs

Palbase IAP · API

POST/iap/customers/{customer_id}/subscriptions/{subscription_id}/extend

Extend a subscription

Moves the subscription's renewal days later, for free: the App Store's renewal-date extension (a paid, active subscription; at most 90 days, twice a year), Google Play's deferral, Stripe's next charge moved. The store is asked again after: the record answers the new expiry. Kept in the customer's history (extension) with who did it.

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

daysinteger · requiredHow many days (1 to 90).
notestring · optionalWhat support writes of it (500 characters at most): the record.
reason"customer_satisfaction" | "service_issue" | "other" · requiredWhy, as the App Store asks it.
curl
curl -X POST "https://<your-ref>.palbase.studio/iap/customers/<customer_id>/subscriptions/<subscription_id>/extend" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"days":1,"reason":"customer_satisfaction"}'

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`)

409A store refused it; 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 ExtendSubscription of iap's contract.