Reputation: 310
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
?
Upvotes: 1
Views: 1095
Reputation: 1540
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
.
Upvotes: 1