Yariv Adam
Yariv Adam

Reputation: 884

Implementing iOS auto-renewing subscription sever

I'm looking to implement auto-renewing subscriptions in my iOS app. As noted in the great blog post here, that's not easy. I know I can use RevenueCat, but I'm looking to implement my own solution through a subscriptions management server (storing receipts, validating through Apple, getting notifications from Apple, and storing status per user).

My questions is this: are there any resources out there (blogs, guides, GitHub samples) of how to set up such a server? I was amazed to not be able to find anything at all. I would assume that thousands of developers deployed such servers (on AWS for example), but I can't find anything to moderate the learning curve.

If anyone has any links to any resources (I'm looking for server setup specific resources, like server side code, or configuration, or ready-made instances - NOT Apple documentation) I would very much appreciate it.

Thanks!

Upvotes: 1

Views: 185

Answers (1)

Jacob Eiting
Jacob Eiting

Reputation: 1004

Jacob here, co-founder of RevenueCat and self-anointed IAP Whisperer.

Glad you found my post about the unreasonable difficulty of in-app subscriptions. That post does a lot of complaining but isn't really a great code-level guide.

There is a lot more content here that goes into detail on more topics, however, I think the best approach is to start with the most limited sophistication, and build out functionality as you grow your app. I presented at AltConf earlier this year and talked about building a good IAP server in a bit more detail.

I would build out functionality in roughly this order:

  1. Validation and Expiration Tracking - Start sending receipts from StoreKit to the server and validating it there, extracting the expiration date, and sending it back.
  2. Add refresh tracking - This one is the most annoying since it requires an always on script looping over all the receipts. You'll need to, about once a day, send the receipts you have stored to Apple and fetch the latest expiration dates. You still need to do this even with Server Notifications you'll need to still loop and refresh daily.

I think those two things will be enough to get you started. But, it is a multi-month project to fully support everything. It's a great learning experience, but I'm not sure it's something most folks really want to learn about haha. If you have any specific questions, hit me up jacob at revenuecat dot com.

Upvotes: 1

Related Questions