Question about server-to-server notification

孤街醉人 提交于 2020-03-24 09:43:21

问题


As Apple doc said in this doc: https://developer.apple.com/documentation/appstoreservernotifications/notification_type?changes=_2

Subscription event                             | Notification types triggered
-----------------------------------------------------------------------------
.
.
.
Auto-renewal disabled (canceled) from 
the App Store account's Subscriptions settings | DID_CHANGE_RENEWAL_STATUS

AppleCare refund                               | CANCEL, DID_CHANGE_RENEWAL_STATUS

When AppleCare refund happend, there are two notification types triggered, one of them is DID_CHANGE_RENEWAL_STATUS. And when cancel subscription happened, its notification type is DID_CHANGE_RENEWAL_STATUS too. So, when i got a notification with notification_type DID_CHANGE_RENEWAL_STATUS, how could i know whether the user has refunded or canceled?


回答1:


I don't know why Apple triggers CANCEL as well as DID_CHANGE_RENEWAL_STATUS, but technical it is correct. The user cancels his subscription (you get the CANCEL notification) and this also changes the renewal status (you get the DID_CHANGE_RENEWAL_STATUS notification—obviously the subscription won't renew in the future).

To your question: you know a refund happend when you receive the CANCEL notification and when the server response body with the DID_CHANGE_RENEWAL_STATUS notification contains the cancellation_date_ms in Latest_receipt_info.

cancellation_date_ms

The time and date that Apple customer support canceled a transaction or the time and date the user upgraded an auto-renewable subscription.

see here for more details.

Don't worry in the case that a user upgrades his subscription, your server will receive additionally to CANCEL and DID_CHANGE_RENEWAL_STATUS the INTERACTIVE_RENEWAL notification.

In the case the user canceled (deactivated auto-renew) the field auto_renew_status (documentation) in the response body is set to 0.



来源:https://stackoverflow.com/questions/60378058/question-about-server-to-server-notification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!