0

I'm trying to implement Auto Renewable Subscriptions. My app can be used across different devices (Android, Web) so I needed to implement the Status Polling technique in order to acknowledge my server when App Store manages to renew an expired subscription. The receipt is being verified on my server as elaborated here. On each transaction made on the device, I update the user's entry on the database for the last_receipt_base64 field during the receipt verification process.

On each status polling, I want to update the last_receipt_base64 and expired_date fields, so I take the last_receipt_base64 and send it to apple's /verifyReceipt route. But each time it puts a different receipt (base64) under the 'latest_receipt' key. Even more, the length of the returned (from /verifyReceipt) receipt base 64 is strangely much shorter than the receipt sent from the device (35,000 chars receipt from device, 6000 chars receipt returned from /verifyReceipt). Why is that?

I want to update the entries on my database on each status pole if there's a change but the data keeps changing! Also the extreme length differences between the receipts from the device and /verifyReceipt makes me worried that the receipt might be rejected someday, If a user won't login the iOS app for long time. Anyway I'm a bit confused, and the docs aren't very good... Some guidelines will be helpful.

Gal Shahar
  • 2,695
  • 1
  • 21
  • 29

1 Answers1

1

Gal Shahar! We are also using Apple server notifications for updating subscription status in our subscriptions managing platform.

Receipt in status poll notifications is not the one that you are looking for. You should store receipts that are sent directly from device.

You should rely only on original_transaction_id and find your customer by this id.

And by the way, there is no need to update your base64 receipt as it will always give you the latest transactions.

I could recommend you reading this article from our blog: https://blog.apphud.com/subscriptions-notifications/

Let us know, if you need help. Thanks!

apphud
  • 625
  • 4
  • 8
  • Wow you can't believe how many question you helped me resolve... Great tutorial! It says there that "Apple recommends to use Status Polling in addition to Subscriptions Notifications", why is that? – Gal Shahar Oct 17 '19 at 16:53
  • 1
    @GalShahar I beleive it's because Notifications are not reliable and they don't have actual base64 receipt. However, we didn't encounter issues with notifications arriving yet and Apple said in WWDC that they are going to add unified base64 receipt soon – apphud Oct 18 '19 at 05:02