Reputation: 1146
We are trying to incorporate in app purchase and we are not getting proper callbacks.
Cancelled
Refunded
Overview: We are developing in app purchase in our hybrid application using IONIC. We have incorporated the plugin for In App Purchase:
• Device version iPhone 6s Plus • iOS version : iOS 15.5
Steps: Registered In app subscriptions on App Store Connect In mobile app I Call OS ready function
Register the Product
this.store.register({
id: this.PRODUCT_IOS_MONTHLY_RECURRING_ID,
type: this.store.NON_CONSUMABLE
});
Register the callbacks
this.store.when(this.PRODUCT_IOS_MONTHLY_RECURRING_ID)
.cancelled(this.purchaseCancelled)
.updated(this.purchaseMonthlyUpdated)
.approved(this.purchaseApproved)
.verified(this.purchaseVerified)
.refunded(this.purchaseRefunded)
.owned(this.purchaseOwned);
Call Refresh
Now after this I am getting the data for this Product and I can call purchase.
{"id":"2022-06-21T04:42:53.592Z","value":"updated { id : 1MonthRecurring , alias : 1MonthRecurring , type : non consumable , group : 20959546 , state : registered , title : 1-Month Recurring Subscription , description : Monthly Recurring Subscription , priceMicros :9990000, price : $9.99 , currency : USD , countryCode : US , loaded :false, canPurchase :false, owned :false, introPrice :null, introPriceMicros :null, introPricePeriod :null, introPricePeriodUnit :null, introPricePaymentMode :null, ineligibleForIntroPrice :null, discounts :[], downloading :false, downloaded :false, additionalData :null, transaction :null, billingPeriod :1, billingPeriodUnit : Month }"}
After purchase it gives me owned state.
{"id":"2022-06-21T04:42:57.198Z","value":"updated { id : 1MonthRecurring , alias : 1MonthRecurring , type : non consumable , group : 20959546 , state : owned , title : 1-Month Recurring Subscription , description : Monthly Recurring Subscription , priceMicros :9990000, price : $9.99 , currency : USD , countryCode : US , loaded :true, canPurchase :false, owned :true, introPrice :null, introPriceMicros :null, introPricePeriod :null, introPricePeriodUnit :null, introPricePaymentMode :null, ineligibleForIntroPrice :null, discounts :[], downloading :false, downloaded :false, additionalData :null, transaction :{ type : ios-appstore , id : 2000000084829744 , appStoreReceipt : ....
Now when I go to settings and sandbox account and cancel subscription I am not getting the cancelled callback.
Also I should get the refund callback. Although in settings screen I see that the subscription is not in owned state still the application shows OWNED.
I would want to know how can I get the cancelled and refunded callbacks
Upvotes: 1
Views: 514
Reputation: 123
cancelled callback is sent to your server not on device. You need to implement App Store Server Notifications for that.
Upvotes: 2