5

I'm currently trying to implement an in-app purchase (auto-renewal) into my app.

I would like to save the receipt of each user in my database, in order to have a historic. (as prescribed here: iOS & Firebase Auto-renewable Subscriptions)

My question now is, how do I have to save the receipt? Do I have to save it encoded or decoded?

I'm using Firebase to do that (Firestore)

halfer
  • 19,824
  • 17
  • 99
  • 186
KevinB
  • 2,454
  • 3
  • 25
  • 49

1 Answers1

5

Definitely save the entire encrypted receipt (String). This becomes your source-of-truth since you can continually refresh it with Apple's /verifyReceipt endpoint.

You'll most likely also be saving some of the receipt fields (decrypted) that will be updated as you refresh the receipt.

enc_life
  • 4,973
  • 1
  • 15
  • 27
  • could you provide 'some of the receipt fields (decrypted)' you store in your database? – hustas88 Aug 02 '19 at 19:28
  • 1
    At a minimum you'll probably need `product_id` and `expiration_date` so you can answer the question "Is this user subscribed?". It's better to save everything since you may want to use it in the future: the transaction identifiers will help you understand renewal and churn, the auto-renew status flag is good to understand if annual subscriptions are churning early, etc. – enc_life Aug 05 '19 at 16:43