Product.PurchaseOption
Optional settings for a product purchase that add account information, purchase details, and offers, or that specify behaviors.
Declaration
struct PurchaseOptionMentioned in
Overview
Associate purchase options with an in-app purchase when you call the methods to initiate a purchase, such as purchase(options:) or purchase(confirmIn:options:). Use the testing-specific options with StoreKit Test or in the sandbox testing environment.
Purchase options enable you to provide additional information for the purchase, such as an app account token, promotional offer, win back offer, and quantity. You can also use purchase options to indicate how the transaction behaves if the storefront changes, and to indicate whether the transaction is eligible for an introductory offer.
Use purchase options during testing
In the sandbox testing environment, use simulatesAskToBuyInSandbox(_:) to test Ask To Buy scenarios.
In the Xcode testing environment with StoreKit Test, use the following testing-specific purchase options when you call buyProduct(identifier:options:):
Use codeOffer(referenceName:) and promotionalOffer(id:) to simulate customers redeeming the offers.
Use purchaseDate(_:renewalBehavior:) to control the transaction date and subscription renewal behavior.
Topics
Setting the purchase options
appAccountToken(_:)winBackOffer(_:)promotionalOffer(offerID:keyID:nonce:signature:timestamp:)promotionalOffer(offerID:signature:)quantity(_:)
Specifying the behavior for storefront changes
Specifying eligibility for an introductory offer
Setting options for StoreKit Testing in Xcode
purchaseDate(_:renewalBehavior:)Product.PurchaseOption.SubscriptionRenewalBehaviorcodeOffer(referenceName:)promotionalOffer(id:)