1

Good day! I'm trying to implement notifications for auto-renew subscriptions and some parts of the whole system are not clear for me. Could you please help?

First of all, when user creates a subscription I get a receipt from user's device, verify it and create a record in database with all needed information. Now, the notifications are coming to server.

  1. INITIAL_BUY notification - When does it come and why? I just got a receipt from device, verified it and I'm happy. Why do I need it?

  2. Correct me if I'm wrong, this part is unclear for me, When user UPGRADES subscription level I get CANCEL notification for oldSubscription and a receipt with a new purchase for newSubscription, right? So theoretical question is - if on my server side content available in oldSubscription and content available in newSubscription are different entities than when I get CANCEL for oldSubscription I just deny user's access to oldSubscription content and when I get receipt from client I create newSubscription with access to new content, right?

  3. DOWNGRADE and CROSSGRADE. As far as I see I get DID_CHANGE_RENEWAL_PREF or DID_CHANGE_RENEWAL_STATUS. So I will get auto_renew_status in notification for this subscription and when payed period will expire I will get a receipt from user device with info about new purchase? Or I have to figure out how to handle DOWNGRADE and CROSSGRADE only by DID_CHANGE_RENEWAL_PREF and DID_CHANGE_RENEWAL_STATUS notifications?

Thank you

RedCollarPanda
  • 1,389
  • 1
  • 20
  • 40

1 Answers1

1

The problem with server receipt validation is that there is not only one way. There are endless possibility to implement this and it depends on your use case of the usage of subscriptions and how you want the communication between your app and server to happen.

In your second paragraph is the first example of those possibilities: your server will get the receipt from the device only if you implemented it that way. Also, maybe you update your database solely based on the notifications instead of the send receipt. You see, it is all up to you ;-)

Regarding you questions:

1)

Occurs at the user’s initial purchase of the subscription.

See documentation

  1. Theoretically this is correct, but your described use case isn't an upgrade. Would be odd, if the better subscription wouldn't contain the content of the lower one.

  2. There isn't much to handle with down- or crossgrade. The notifications only tell you that there will be a change with the next auto-renewal. Because, the user is still eligible to access the better content until the next auto-renewal. After the better subscription expired you will receive a normal DID_RENEW with the down- or crsssgrade product id.

Paul Schröder
  • 1,440
  • 1
  • 10
  • 19
  • Thank you very much! Can you also tell me about №3 question - "After the better subscription expired" - so my better subscription will expire and I can remove subscription with that content, right? Will I get receipt (from device application) with new, down-graded subscription? Or I need to rely only on DID_RENEW notification? – RedCollarPanda Jan 21 '21 at 15:29
  • To the upper comment - I mean "will my application get a receipt to downgraded subscription" so it can send it to my server-side? And, btw - what will come faster - the receipt from my client app or the DID_RENEW notification from apple server? – RedCollarPanda Jan 21 '21 at 15:41
  • Your app will get an updated receipt and your server will get the **DID_RENEW** notification. As mentioned before, your app do not send the receipt automatically. You have to implement it that way. Since your app can only send the receipt to your server when the user uses it, it is more likely that the notification will reach your server first. – Paul Schröder Jan 21 '21 at 15:57
  • Thank you, I will accept your answer as a solution. Final question - just to be sure - when user will choose downgrade or crossgrade, will my phone application get receipt (which in turn will be sent to server-side)? Cus thats a bit hard to understand - was DID_RENEW just a renew to old subscription or a downgrade to less content. – RedCollarPanda Jan 21 '21 at 16:27
  • Your app will receive an updated receipt. The server notifications are not directly bound to subscriptions but to your user. The DID_RENEW notification just indicates that your user startet a new period of the lastest product in the receipt (With a few exceptions all notifications also send along the current receipt) – Paul Schröder Jan 22 '21 at 11:11