Question

Not getting the onSuccess callback on Android

  • 14 November 2022
  • 0 replies
  • 15 views

Badge

We’re using RevenueCat for subscriptions, but am now having issues with receiving the `onSuccess` callback when a user subscribes.

If the user cancels the flow, we end up in the `onError` callback as expected, but when signing up we just don’t receive the callback, so the flow stops and doesn’t continue.

Our implementation is working fine in production, but we’ve redone some of our signup flow, but we haven’t really (to my knowledge at least) changed anything in regards to subscription.

The subscription code is called from a `ViewModel` and the function is called from a button click, so the call should be running on the mainthread (not sure if it matters really since it’s a callback).

The code is fairly straightforward:
 

Purchases.purchasePackageWith(    
  activity = activity,
  packageToPurchase = packageToBuy,
onError = { error, userCancelled →
// Tell the View something went wrong.
},
onSuccess = { transaction, customerInfo →
// Call the View to update itself
}
)

 

In Google Play Store I’m successfully subscribed, but after I see the succesful subscription I’m just returned to our paywall and that’s it.

 

Anyone have any ideas as to how to proceed?

 

I’m testing on a release build with debug enabled, so I can definitely see I’m hitting some of the breakpoints until I get to the part with the `onSuccess` block.

We’ve also tried to wrap the callbacks in a coroutine, but it doesn’t help.

Could it be that the callback is being GC’ed while I’m subscribing and never receive the callback then or?


0 replies

Be the first to reply!

Reply