Skip to main content
Solved

Best practice for server-side CI testing?

  • December 6, 2021
  • 1 reply
  • 142 views

Forum|alt.badge.img+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

 

Best answer by cody

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

View original
Did this post help you find an answer to your question?

1 reply

cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 497 replies
  • Answer
  • December 14, 2021

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings