How to implement and test a free iOS trial when purchasing an app from Sandbox? How do I validate flow and trial information using Apple receipts?

I want to create a trial period (1 week) on my 1 month subscription in the App Purchase via iTunes Connect. The question is, how do I sandbox it and get the accurate information in Apple receipts that indicates the difference in status between the trial period and the paid subscription? Thank!

+3


source to share


3 answers


For In-App products with free trials, StoreKit on the client side issues two iOS7 style receipts in the in_app section -

  • When the user clicks "Buy" that launches the free trial. The user is not paying at the moment. A receipt sent to the server for verification will have:

      expires_date_ms - purchase_date_ms = Number of Free trial days.
    
          

  • When the free trial days end and if the user has not turned off auto-renewal from the Manage Subscription screen, another receipt is issued and the user is charged this time. The issued receipt will have

      expires_date_ms - purchase_date_ms = Term Length
    
          



If the user turned off auto-renewal before the free trial expired, the server should detect this and turn off the subscription for the user.

+1


source


First you need to create test user from your iTunes account

and register your application for in app purchase

. Then you can use your test user to buy a subscription. Here apple has provided some kind of remedy, for example your 1 month subscription would be equivalent to 5 minutes, and 3 is equal to 15 minutes, and so on. Also if you use it as auto-renewable on in-app purchase, it will refresh 3-4x, not fixable as I tested.



0


source


I performed a trial payment on a production account and received a receipt from the appstore. This receipt included the "is_trial_period" field as "true". But after the trial period I get a receipt with a real account and it has no trial fields.

I write logic like:

  • If the receipt has a field "is_trial_period" after verification, and it is true - this is a trial receipt
  • If the get fields "original_transaction_id"! = "Transaction_id" is a real account, then I find the original transaction in my own DB and update it.

But the appstore documentation doesn't have the same information about the probe field. The sandbox does not belong to this field.

0


source







All Articles