You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
latePurchaseParam 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);
} elseif(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?
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?
It depends on your subscription type to be able to get offers, please check this answer for the detail: #92872 (comment). There is also outlined: you can find discount from SKProductWrapper.discounts or SKPaymentWrapper.paymentDiscount. I check this quickly with package example and see you may get it through SKPaymentTransactionWrapper transaction, for e.g: transaction.payment.paymentDiscount.
Also, this is more of a how-to question than a bug or feature request. I see there is a known issue asking the example for this: #51757. So I would suggest you ask the same there (if my suggest above doesn't work) that may help to raise the issue. I will go ahead and close this in favor of that one. Thanks!
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
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:
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!
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?
doc: https://developer.apple.com/documentation/storekit/in-app_purchase/original_api_for_in-app_purchase/subscriptions_and_offers/generating_a_signature_for_promotional_offers?language=objc
The text was updated successfully, but these errors were encountered: