Solved

Best practice for server-side CI testing?

  • 6 December 2021
  • 1 reply
  • 130 views

Badge +2

Hey,

because of how our subscriptions work in general, we have decided to not use the RevenueCat SDK to create purchases, but announce them to our own API, which will in turn make an HTTP call to RecenueCat’s /receipts route, passing the neccessary data.

Arguably the most important piece of data is the fetch_token from the app store.

The problem arises when we’re trying to run automated integration tests via our CI server - without doing an actual purchase on an actual hardware device, we won’t have a valid fetch token, so the API will always answer with the (reasonable) error: "The receipt is not valid.".

So my question is two-fold:

  1. is there any way to simulate a purchase for testing purposes?
  2. how to others solve the testing issue?

Or is our use-case really this particularly rare?

Regards,
Markus

 

icon

Best answer by cody 14 December 2021, 13:58

View original

1 reply

Userlevel 6
Badge +8

Hey @Markus Wolff!

We definitely recommend using the SDK when possible (at least in observer mode, where you can handle the purchase logic and we’ll still pick up on the purchases in the background automatically).

Speaking to the question of testing though, I think you’ll want to use the StoreKitTest framework and our testing in sandbox guide using StoreKit configuration files. It takes a little bit of setup, but will allow you to set up tests to simulate purchases: https://docs.revenuecat.com/docs/apple-app-store#ios-14-only-testing-on-the-simulator

Reply