Closed as not planned
Description
Description:
I'm trying to implement promotional offers for iOS subscriptions using the [in_app_purchase] library. For example: offering the first week for free or providing a discount for the first year.
In my Android project, I've successfully implemented these offers using the following code:
late PurchaseParam purchaseParam;
if (Device.isAndroid) {
// Code snippet for implementing promotional offers in Android
// Different promotional offers have different ProductDetails, making it easy to implement them
purchaseParam = GooglePlayPurchaseParam(productDetails: productDetails, changeSubscriptionParam: null);
} else if(Device.isIOS) {
purchaseParam = AppStorePurchaseParam(
productDetails: productDetails,
discount: SKPaymentDiscountWrapper(identifier: '', keyIdentifier: '', nonce: '', signature: "", timestamp: DateTime.now().millisecondsSinceEpoch),
);
}
bool paySuccess = await _inAppPurchase.buyNonConsumable(purchaseParam: purchaseParam);
However, I'm unsure about how to achieve the same in iOS. Can someone please provide detailed guidance? I've gone through the documentation here but couldn't grasp it entirely. Do we need our server to generate signatures for this?
Thank you for any assistance you can provide!
if(Device.isIOS) {
purchaseParam = AppStorePurchaseParam(
productDetails: productDetails,
discount: SKPaymentDiscountWrapper(identifier: '', keyIdentifier: '', nonce: '', signature: "", timestamp: DateTime.now().millisecondsSinceEpoch),
);
}
Where can I obtain the parameters for this class SKPaymentDiscountWrapper, and how should I construct this object? Are there any alternative approaches to achieve this?