How do I validate purchases on the backend?

  • 28 January 2023
  • 4 replies


So I am able to use RC to complete purchases of a product.

Here’s what happens once a user has purchased a product.


→ I grab their Revenue Cat ID, and extract their latest transactionIdentifier

→ An API request is made with this info to our backend server to process their order.


Here is a code snippet of how I am using the React-Native SDK to get their transaction Id.


On the backend I want to verify their Revenue Cat ID has indeed made the purchase based on the provided transactionIdentifier.


What’s the best way to do this?

4 replies


Can anyone help me with this?

Userlevel 4
Badge +6

Hey @Uchenna Okafor ,


A solution that I could think of for this would be to call allPurchasedIdentifiers which can be found in CustomerInfo which returns an array of strings which that is filled with all purchased skus, active and inactive from this customer. I would compare the transaction ID that you are returning above,  with that array and see if the ID shows in the array. if that ID shows in the array, it would be verified that the purchase was made. 


I hope this helps! 


Hey @Michael Fogel 

While the approach you've mentioned could work in certain scenarios, it's important to note that it's not a foolproof solution to verify transactions.

Calling the allPurchasedIdentifiers method from the RevenueCat CustomerInfo API would give you a list of all the SKUs that the customer has purchased in the past. However, this method does not provide transaction-specific details such as purchase dates, cancellation dates, and renewal dates, which are essential for verifying the current status of a subscription.

Moreover, relying solely on comparing the transaction ID with the purchased SKUs may not be accurate in all cases. For instance, a user may have multiple subscriptions or may have upgraded/downgraded their subscription plan since the transaction was made. In such cases, the transaction ID may not match the current active subscription, even though the user has made the purchase.

Therefore, while the approach you've suggested may work in certain scenarios, it's not a comprehensive solution for verifying transactions. It's still important to use web hooks and/or the Verify Receipt API to obtain real-time transaction details and keep your records up to date.

Badge +1

How can I use the Verify Receipt API?

Otherwise, is there a way to extract the transaction receipt and signature to send them to my backend for validation?