Renewable subscription and backed

492 views Asked by At

I read many materials about ios renewable subscriptions and have this workflow:

  1. The application gets receipts from apple and sends it to the backend
  2. Backend vefify receipt by apple verify-url
  3. Backend gets real transaction_id and expires_date only from latest_receipt_info
  4. If backend does not have this transaction in DB it will increase subscription for user

That workflow because:

  1. Apple can send in receipt check-notifications - why I got information from latest_receipt_info
  2. Apple recommends this flow for renewals

But I have some problems/questions:

  1. I want to exclude application from this flow. I want create like android-flow - sync all renewals from backend. How can I create it?
  2. What happend if user does not start application for 1 year? Will apple get money from user? How will I get notification if application is not started?

Please give me links or answers for my questions.

UPD:

I have one question Now. How to connect with apple servers for sync renewals like android flow.

Current scheme:

+--------------+           +--------------+          +---------------+
|              |           |              |          |               |
|   Mobile     |           |    Backend   |          |      Apple    r
|              |           |              |          |               |
+------+-------+           +-------+------+          +--------+------+
       |          Sync             |                          |       
       +------------------------------------------------------>       
       <------------------------------------------------------+       
       |          Renew            |                          |       
       +--------------------------->        Verify            |       
       |                           +-------------------------->       
       |           Renewed         <--------------------------+       
       <---------------------------+                          |       
       +                           +                          + 

But I want flow without mobile inapp:

+--------------+           +--------------+          +---------------+
|              |           |              |          |               |
|   Mobile     |           |    Backend   |          |      Apple    r
|              |           |              |          |               |
+------+-------+           +-------+------+          +--------+------+
       |         Data for sync     |                          |       
       +--------------------------->        Check renewals    |       
       |                           +-------------------------->       
       |                           <--------------------------+       
       |                           +--+                       |       
       |                           |  |  Renew                |       
       |                           <--+                       |       
       |                           |         Check renewals   |       
       |                           +-------------------------->       
       |                           <--------------------------+       
       |                           |                          |       
      ++                           +                          +  
1

There are 1 answers

6
Daniel Galasko On

Welcome to Apple Sir, there are a few things you should note before attempting to create an "Android flow".

  1. In-App purchases are managed by Apple. There is no way to circumvent this and get approved. The only reason you would send the receipt to your backend is to validate the purchase. This is to prevent Malice from Jailbreaking their device and somehow being able to make a fake purchase. Your server should then be able to detect whether or not this receipt came from Apple or from some other source and unlock the content accordingly. Naturally the level of security you provide in receipt validation is proportional to the value of your in-app purchases
  2. Auto-renewable subscriptions will continue indefinitely until the user chooses to cancel. You have absolutely no control over managing a users subscription. The only thing you can do is provide the user with a link to open iTunes so that they can manage their own subscriptions.

So Apple is always in control of this process. You will not be able to identify a user using their receipt or even get any credit card information from them. You simply rely on the fact that when Apple provide you with a receipt that it is a valid receipt and you will be paid for it

Regarding renewals, heres an excerpt from the documentation regarding how they should be handled:

After a subscription is successfully renewed, Store Kit adds a transaction for the renewal to the transaction queue. Your app checks the transaction queue on launch and handles the renewal the same way as any other transaction. Note that if your app is already running when the subscription renews, the transaction observer is not called; your app finds out about the renewal the next time it’s launched.

So every time your App launches you get the opportunity to add any existing transactions to your queue. This is the time where you can inform the server that a receipt has been renewed.