Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement and test a free trial on iOS in app purchase in Sandbox? How to validate the flow and trial info via Apple receipts?

I want to create a trial period ( 1 week) on my 1 month AR subscription in App purchase application via iTunes Connect. The question is, how to test it in sandbox and have the accurate information in Apple receipts that indicates the differenciation of status between the trial time period and the paying subscription? Thanks!

like image 762
Sandy Avatar asked Oct 16 '14 10:10

Sandy


People also ask

How do I test my Apple Pay sandbox?

Under Sandbox, click Testers. Click “+” to set up your tester accounts. Complete the tester information form and click Invite. Sign out of your Apple ID on all testing devices and sign back in with your new sandbox tester account.

What is sandbox testing in iOS?

Overview. Use the Apple sandbox environment to test your implementation of in-app purchases that use the StoreKit framework on devices with real product information from App Store Connect. Your development-signed app uses the sandbox environment when you sign in to the App Store using a Sandbox Apple ID.

Can I test in app purchase on simulator iOS?

It is impossible to make a purchase on a simulator (it is only possible to request a list of available purchases). To test purchases, you first need to set up products on App Store Connect and then use the user's sandbox environment and a real device. In this case, purchases for the developer are free.


1 Answers

For in-app products with Free Trials, StoreKit on the client side issues two iOS7 style receipts in the in_app section -

  1. When the user hits Buy which starts the free trial. User is not charged at this time. The receipt sent to the server for verification will have :

      expires_date_ms - purchase_date_ms = Number of Free trial days.
    
  2. When the free trial days are up and if the user has not turned OFF autorenewal from Manage subscription screen, another receipt is issued and this time the user is charged. The receipt issued will have

      expires_date_ms - purchase_date_ms = Term Length
    

If the user has turned off autorenewal before the free trial expires, the server should detect this and turn off the subscription for the user.

like image 86
Taher Saeed Avatar answered Nov 15 '22 00:11

Taher Saeed