Finding purchase_token from Android purchases

  • 9 September 2021
  • 3 replies


We wish to integrate our sales data with ChartMogul. We need to send payloads to ChartMogul with data about every purchase. 


In section 3 of this link from ChartMogul, it is described: 

  • purchase_token - Mandatory - The purchaseToken returned by Google Play as soon as a purchase is completed. This is usually returned within the INAPP_PURCHASE_DATA object in the getBuyIntent() method.


How can we access this purchase_token? We are using the webhooks sent from RevenueCat to our backend, to align our userbase with the purchasing events from RevenueCat. However there is no purchase_token field on any of these events. I assume it has been renamed..?


Best answer by tina 14 September 2021, 22:39

View original

3 replies

Userlevel 5
Badge +10

Hey @Johan!

The purchase token isn’t exposed through RevenueCat’s APIs/webhooks. RevenueCat tries to abstract in-app purchases as much as possible and exposing the receipt/purchase_token is a different process between Android and iOS. If you’re utilizing the native Android Purchases SDK, you should be able to get the original token in the purchase completion block in the SDK and save it from there. 

There are some technical limitations that keep us from returning the raw receipt data in the GET /subscribers API response, so the best way to access this information would be directly from the device. The purchase token is available through native Android methods so you shouldn't need any third party libraries to access this.

Does this sound like it would work for you?


Hey @tina,

Thanks for getting back to me. 
We are working with React-Native and would prefer to avoid meddling with native code, at least if it’s possible. Ideally we would be able to access the purchase token for Android purchases through the webhooks sent to our backend. 

Is there any other way for us to access the token besides implementing native Java/Kotlin code? 

Userlevel 5
Badge +10

Unfortunately RevenueCat does not send over the purchase_token through webhooks or API :/ The purchase token would need to accessed directly from the device through native Android code.