palbaseDocs

Palbase IAP · API

POST/iap/offers/{offer_key}/apple-signature

Sign an App Store offer

Apple's signature of the offer's promotional offer for the customer's purchase of one of its subscriptions: StoreKit buys it with these (Product.PurchaseOption.promotionalOffer). Signed with the connected In-App Purchase key — or, for a StoreKit configuration on a developer's Mac, its Subscription Offers Key (PUT /iap/apple/xcode-offer-key). Apple gives a promotional offer to a customer who subscribes, or subscribed, in the group.

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

Path

offer_keystring · requiredThe catalog's offer.

Request body

bundle_idstring · optionalThe app's bundle identifier (the connected app's is used when one is connected).
environmentstring · optionalxcode for a StoreKit configuration on a developer's Mac (signed with its Subscription Offers Key); otherwise the App Store's.
product_idstring · requiredThe App Store product (one the offer is on).
transactionstring · optionalA transaction of the subscription's group as StoreKit signed it on the device (jwsRepresentation; the SDKs send the newest): the Apple account the offer is sold to — whoever Palbase has its subscription as, another of the app's accounts on a shared Apple ID too. Without it, the customer's own newest App Store subscription names it.
curl
curl -X POST "https://<your-ref>.palbase.studio/iap/offers/<offer_key>/apple-signature" \
  -H "apikey: $PALBASE_PUBLISHABLE_KEY" \
  -H "authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "content-type: application/json" \
  -d '{"product_id":"string"}'

Responses

200The signature

400The body is not the request, or no bundle identifier (`invalid_request`)

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 the token

403The offer is not the customer's to take (`offer_not_open`): it ended or has not started, was taken, or is for an audience they are not in; or the edge refused the key

404The catalog has no such offer (`offer_not_found`)

409No App Store key to sign with: no Apple account connected (`apple_not_connected`), or no Xcode Subscription Offers Key set (`no_xcode_offer_key`); a production transaction before the app's Apple ID is known (`apple_not_bound`); or no transaction was sent and none of the customer's App Store subscriptions is known (`no_app_store_purchase`): Apple gives the offer to who subscribes, or subscribed, in the group — send `transaction`, one of the group StoreKit signed on the device

422The offer is on no App Store product of that id (`not_an_app_store_offer`), or `transaction` is not an auto-renewable subscription's transaction StoreKit signed for this app where it runs — the App Store's, or Xcode's with the pinned certificate (`invalid_transaction`)

503Temporarily unavailable; retrying is safe after Retry-After

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

Operation SignAppleOffer of iap's contract.