-
Notifications
You must be signed in to change notification settings - Fork 23
fix(ios): report StoreKit 2 introductory/trial price, not full price #670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,15 +136,17 @@ - (NSDictionary *)purchaseInfo:(QONStoreKit2PurchaseModel *)purchaseModel | |
| purchaseDict[@"period_unit"] = purchaseModel.subscriptionPeriodUnit; | ||
| purchaseDict[@"period_number_of_units"] = purchaseModel.subscriptionPeriodNumberOfUnits; | ||
|
|
||
| NSMutableDictionary *introOffer = [[NSMutableDictionary alloc] init]; | ||
|
|
||
| introOffer[@"value"] = purchaseModel.price; | ||
| introOffer[@"number_of_periods"] = purchaseModel.introductoryNumberOfPeriods; | ||
| introOffer[@"period_number_of_units"] = purchaseModel.introductoryPeriodNumberOfUnits; | ||
| introOffer[@"period_unit"] = purchaseModel.introductoryPeriodUnit; | ||
| introOffer[@"payment_mode"] = purchaseModel.introductoryPaymentMode; | ||
|
|
||
| result[@"introductory_offer"] = introOffer.count > 0 ? introOffer : nil; | ||
| if (purchaseModel.introductoryPrice != nil) { | ||
| NSMutableDictionary *introOffer = [[NSMutableDictionary alloc] init]; | ||
|
|
||
| introOffer[@"value"] = purchaseModel.introductoryPrice; | ||
| introOffer[@"number_of_periods"] = purchaseModel.introductoryNumberOfPeriods; | ||
| introOffer[@"period_number_of_units"] = purchaseModel.introductoryPeriodNumberOfUnits; | ||
| introOffer[@"period_unit"] = purchaseModel.introductoryPeriodUnit; | ||
| introOffer[@"payment_mode"] = purchaseModel.introductoryPaymentMode; | ||
|
|
||
| result[@"introductory_offer"] = introOffer; | ||
| } | ||
|
|
||
| NSMutableDictionary *promoOffer = [[NSMutableDictionary alloc] init]; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor, and out of scope for this fix: the The StoreKit 1 path guards the equivalent block on |
||
| promoOffer[@"id"] = purchaseModel.promoOfferId; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behavioral note: this guard also changes the no-offer case. Previously an
introductory_offerblock was emitted on every purchase here, because the oldintroOffer.count > 0check was always true (the value was set fromprice, which isnonnull). With this guard, purchases without an introductory offer omit the block entirely.That matches the StoreKit 1 path above (
purchaseData:guards onproduct.introductoryPrice != nil), so it should be safe - just flagging that the request body shape changes for no-offer StoreKit 2 purchases, in case anything consuming the payload expects the block to always be present.