lundi 18 juin 2018

How to test for free trial in sandbox?

I have a one year auto-renewable subscription in my app with a three day free trial. According to Apple, while testing in the sandbox, a one year subscription is equivalent to one hour but it says nothing about how long the free trial is. Add to this, when I'm testing and I sign-up for the free trial, the receipt doesn't list a separate transaction for a free trial, it simply lists the first hour long subscription:

transactionIdentifier: 1000000408088544
purchaseDate: Sat Jun 16 19:58:59 2018
originalTransactionIdentifier: 1000000408088544
originalPurchaseDate: Sat Jun 16 19:59:00 2018
subscriptionExpirationDate : Sat Jun 16 20:58:59 2018

I could just check and see if the current date is less or greater than originalPurchaseDate plus three days, but shouldn't another transaction be generated when the free trial ends and the subscription is automatically renewed? That's not happening in the sandbox so I'm unsure of the behavior to expect outside of the sandbox.

In the receipt format documentation, under "Subscription Trial Period", there is a "is_trial_period" key stored in the receipt, however I am validating the receipt locally and believe that I am unable to obtain this value since there is no ASN.1 Field Type and it seems to be stored in JSON when doing server validation.

Does anyone have any clue how to test this or what the behavior should be?

Aucun commentaire:

Enregistrer un commentaire