0

We own backend services that react to the receipts generated after making in-app purchases (specifically subscriptions). Right now we are using few pre-generated test receipts for validating changes in our services.

But using these pre-generated receipts (generated using sandbox environment) restricts automation of tests as the products associated with these receipts renew/cancel/expire when we run these tests over a period of time. Looking at the apple documentation, I couldn't find any such APIs. So, is there a way I could generate these test receipts dynamically for my tests (without using UI, of course)?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Harish
  • 1,433
  • 9
  • 21

1 Answers1

1

If you want to create receipt data that Apple's endpoint will validate, that would be very difficult because it is a signed secure container generated by StoreKit. This WWDC talk goes into depth on what the receipt actually is.

The validation isn't all the important since it is outside of your system. You can mock the Apple verifyReceipt call and write a little script to just generate fake receipt responses (the JSON) that match what you expect receipts to look like. This is what we do in our unit and functional tests at RevenueCat.

Jacob Eiting
  • 1,004
  • 6
  • 9