Skip to main content
Solved

How to Verify One-Time Purchases Using RevenueCat REST API (v2)?

  • December 9, 2024
  • 1 reply
  • 239 views

Forum|alt.badge.img

Hi, I’m implementing one-time purchases using RevenueCat.

I’ve set up a webhook to receive data when a user successfully completes a purchase. However, for security reasons, I don’t fully trust the data received via the webhook and want to verify the purchase using RevenueCat's REST API (v2).

I’ve gone through the documentation but couldn’t find a clear endpoint to validate one-time purchases. Could you help me with the following questions?

  1. Which endpoint should I use to validate a one-time purchase?
  2. What parameters should I include in the request? For example, should I use id, transaction_id, or app_user_id from the webhook data?
  3. Can the /v2/projects/{project_id}/purchases/{purchase_id} endpoint be used for this purpose? If so, what value should be passed as {purchase_id}?

Best answer by Haley Pace

Hi,

  1. Once a purchase is made RevenueCat will validate the purchases with Apple/Google with the fetch token received. If you wanted to make sure it went through you can listen to the purchase webhook or you could use the purchase completed callback shown here to make sure it went through/was validated
  2. If you are referring to our ‘Get a purchase’ APIv2 endpoint here then you will need to use the project_id and purchase_id and you can get the former from our ‘Get a list of projects’ APIv2 endpoint here

  3. You get the purchase_id from our ‘Get a list of purchases associated with a customer’ APIv2 endpoint here
View original
Did this post help you find an answer to your question?
This post has been closed for comments

1 reply

Forum|alt.badge.img+8
  • RevenueCat Staff
  • 577 replies
  • Answer
  • December 11, 2024

Hi,

  1. Once a purchase is made RevenueCat will validate the purchases with Apple/Google with the fetch token received. If you wanted to make sure it went through you can listen to the purchase webhook or you could use the purchase completed callback shown here to make sure it went through/was validated
  2. If you are referring to our ‘Get a purchase’ APIv2 endpoint here then you will need to use the project_id and purchase_id and you can get the former from our ‘Get a list of projects’ APIv2 endpoint here

  3. You get the purchase_id from our ‘Get a list of purchases associated with a customer’ APIv2 endpoint here

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