I found multiple suggestion but still stucked. Do not know what I am suppose to get when subscription is canceled. Or what URL I am supposed to give in iTunes to notification. Here is one reponse I got:
"expires_date" = "2017-11-30 14:24:13 Etc/GMT";
"expires_date_ms" = 1512051853000;
"expires_date_pst" = "2017-11-30 06:24:13 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-30 14:14:13 Etc/GMT";
"original_purchase_date_ms" = 1512051253000;
"original_purchase_date_pst" = "2017-11-30 06:14:13 America/Los_Angeles";
"original_transaction_id" = 1000000356232086;
"product_id" = "com.demo.demoapp.weeklysubscriptionsssss";
"purchase_date" = "2017-11-30 14:19:13 Etc/GMT";
"purchase_date_ms" = 1512051553000;
"purchase_date_pst" = "2017-11-30 06:19:13 America/Los_Angeles";
quantity = 1;
"transaction_id" = 100000fsdfdsf0356233554;
"web_order_line_item_id" = 1000000037061260;
},
What am I supposed to get exactly when an subscription is canceled?
There is a common misconception about how Apple's subscription status notifications work. Apple will only notify your backend when a subscription has been canceled by customer service, i.e. when a customer contacts Apple and receives refund. When a user cancels normally you will not receive a notification.
In order to detect when someone has cancelled you need to periodically check the receipt against Apple's
/verifyReceipt
endpoint to see if the user intends to renew or not, via theexpiration_intent
field, will tell you why a users subscription expired.If you are still lost, I recommend reading all of Apple's guide on subscriptions. If you are looking for a shortcut you could try something like RevenueCat (disclaimer: it is my pet project).