Skip to main content
Question

Testing Billing Errors


Forum|alt.badge.img+6

I am hoping we can get some guidance on how to test billing errors in the sandbox. Specifically, we are never seeing billingIssueDetectedAt populated.

As an example, we subscribe using a license tester on Android in our React Native app. The subscription goes through successfully, and afterwards, we set our payment source to “always decline” through Google Play. Because it’s a monthly subscription, we wait 5 min, and when the renewal charge is made, we get an email from Google saying the subscription was suspended because of a billing issue. However, there is no change on the customerInfo object when I call getPurchaserInfo().

Fast forward another 5 min, and the subscription is cancelled. This time, if I call getPurchaserInfo(), I immediately see the purchase is no longer active. However, there is still no value for billingIssueDetectedAt, and the expirationDate has not changed either.

I guess my questions are:

  1. should the above have generated a billingIssueDetected at value?
  2. I know the docs mention a lag w/regard to web hooks and billing/expiration, but does this also apply to a real-time customerInfo object returned from getPurchaserInfo()?
  3. Is there a better way to test billing?

Thanks in advance ...

This post has been closed for comments

3 replies

cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 501 replies
  • May 12, 2022

Hey @Gravy Developer!

This might be related to the on-device cache of PurchaserInfo - the SDK will cache PurchaserInfo for ~5 minutes, so if might just be a timing issue, where the cache isn’t being updated until after the subscription was actually cancelled.

You might be able to test this by calling `invalidatePurchaserInfoCache` before calling `getPurchaserInfo` in sandbox mode so it’s fresh each time. You shouldn’t call this in production though, as it can cause unnecessary delays (and it’s very rare in production for a brief ~5 minute cache to be noticeable to the end user, it’s just noticeable in sandbox since the durations are so short).


Forum|alt.badge.img+6

Sorry for the late reply @cody, was out on vacation. Thanks - I’ll give it a try and let you know.


Forum|alt.badge.img+6

Unfortunately @cody this did not fix the issue; billingIssueDetectedAt is still null. See screenshot below. To be clear:

  • In Sandbox environment, on Android, w/RN, payment was set to decline - which it did
  • Show as such with Google
  • I am calling invalidatePurchaserInfoCache

 


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