Skip to main content
Answer

How to get a purchase for specific store_purchase_identifier avoiding extracting all purchases

  • April 13, 2025
  • 4 replies
  • 115 views

Forum|alt.badge.img+3

Hi there,

 

I’m currently calling https://api.revenuecat.com/v2/projects/{project_id}/customers/{customer_id}/purchases for extracting all purchases and then check for a specific one using store_purchase_identifier.
Is there a way to avoid extracting all purchases from the server every time I need to find a specific store_purchase_identifier? 

Thank you,

Yury

Best answer by hussain

Hi Yury,

Thanks for reaching out. Happy to help.

Currently, to find a specific purchase by its store_purchase_identifier, you need to extract all purchases for a customer and then search for the identifier. Unfortunately, there isn't a direct way to query for a specific store_purchase_identifier without fetching all purchases first.

If you're looking for a more efficient way to handle transactions and updates, you might consider setting up webhooks to receive real-time notifications for purchase events. This way, you can maintain a local database of relevant purchases without querying the entire history each time. You can learn more about webhooks on our docs here: https://www.revenuecat.com/docs/integrations/webhooks

Hope this helps, let me know if you have questions about anything else.

Best,

Hussain

This post has been closed for comments

4 replies

hussain
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • Answer
  • April 16, 2025

Hi Yury,

Thanks for reaching out. Happy to help.

Currently, to find a specific purchase by its store_purchase_identifier, you need to extract all purchases for a customer and then search for the identifier. Unfortunately, there isn't a direct way to query for a specific store_purchase_identifier without fetching all purchases first.

If you're looking for a more efficient way to handle transactions and updates, you might consider setting up webhooks to receive real-time notifications for purchase events. This way, you can maintain a local database of relevant purchases without querying the entire history each time. You can learn more about webhooks on our docs here: https://www.revenuecat.com/docs/integrations/webhooks

Hope this helps, let me know if you have questions about anything else.

Best,

Hussain


Forum|alt.badge.img+3
  • Author
  • New Member
  • April 16, 2025

Thanks Hussain. 
One more question please, any chance I can have the very last purchases on the first page? I can’t see any “sort” parameters available in the API.

 


hussain
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • April 18, 2025

Hi Yury,

Great question—The REST API currently doesn’t support a sort parameter or a way to retrieve purchases ordered by most recent first. However, I’ve passed your feedback along to our engineering team.

Let me know if there's anything else I can help with!

Best,

Hussain


Forum|alt.badge.img+3
  • Author
  • New Member
  • April 18, 2025

Thanks for your help Hussain