Skip to main content
Solved

How can I get the transaction or order ID in Flutter?


Forum|alt.badge.img+5

How can ı. get order id in flutter for android 

Best answer by cody

Hey @seyhmus gumus!

We don’t currently send the transaction or order ID in the purchase response from the Flutter SDK.

If you need access to the transaction ID, I’d recommend setting up webhooks as we include transaction identifiers in webhooks for purchases. You can consume webhooks from your server and save the transaction identifier server-side.

View original
Did this post help you find an answer to your question?

11 replies

cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 487 replies
  • Answer
  • October 18, 2021

Hey @seyhmus gumus!

We don’t currently send the transaction or order ID in the purchase response from the Flutter SDK.

If you need access to the transaction ID, I’d recommend setting up webhooks as we include transaction identifiers in webhooks for purchases. You can consume webhooks from your server and save the transaction identifier server-side.


Forum|alt.badge.img+5
  • Author
  • New Member
  • 1 reply
  • October 19, 2021

Thank you so much for letting me know this


Forum|alt.badge.img+1
  • New Member
  • 1 reply
  • November 19, 2021
cody wrote:

Hey @seyhmus gumus!

We don’t currently send the transaction or order ID in the purchase response from the Flutter SDK.

If you need access to the transaction ID, I’d recommend setting up webhooks as we include transaction identifiers in webhooks for purchases. You can consume webhooks from your server and save the transaction identifier server-side.


Please add the order ID to the response, setting up webhook to save server side and then reading from there complicates what should be a pretty simple transaction. (Make an order -> get your order id in the success response)


Forum|alt.badge.img+2

HI, there is some way to identify the purchase?

I understand that I can validate the purchase with a webhook, but if i dont have any ID (like order ID o transaction ID) How i can verify if the purchase is the same that the webhook send to my server?

please, can you helpme?


Forum|alt.badge.img+2
cody wrote:

Hey @seyhmus gumus!

We don’t currently send the transaction or order ID in the purchase response from the Flutter SDK.

If you need access to the transaction ID, I’d recommend setting up webhooks as we include transaction identifiers in webhooks for purchases. You can consume webhooks from your server and save the transaction identifier server-side.

I review your code in the library purchases-hybrid-common you can add the order Id, but you filter that in this line

 

https://github.com/RevenueCat/purchases-hybrid-common/blob/1f0c0fdff9803299644891dd6e8b5c913b75e91a/android/src/main/java/com/revenuecat/purchases/hybridcommon/common.kt#L322


Forum|alt.badge.img+1
  • New Member
  • 1 reply
  • December 23, 2022

So, there’s currently no way of getting the order-id from the Flutter SDK when a purchase is made?
This is a problem for my use case where I need to correlate a consumable purchase to the item that’s purchased in my app


ling-li-d6f2fc
Forum|alt.badge.img+3

I was looking for a similar solution to this. On the flutter side after calling purchaseProduct() you can get the last transaction from the returned CustomerInfo object and then send this details to your backend.

 

CustomerInfo? customerInfo = await Purchases.purchaseProduct(
                               “myProduct”,type: PurchaseType.inapp).then((value) {
              if (value.nonSubscriptionTransactions.length > 0) {
                int lastItem = value.nonSubscriptionTransactions.length - 1;
                StoreTransaction item = value.nonSubscriptionTransactions[lastItem];
                // send item to your backend

 

In the backend implement the webhook and when you receive the webhook, call the subscriber endpoint:
 

https://api.revenuecat.com/v1/subscribers/{app_user_id}

to get a list of the transactions, then you should be able to match up the 2 on the transaction_id

 

 

 


Forum|alt.badge.img+1
  • New Member
  • 1 reply
  • March 11, 2024

It is ridiculous not to share this ID, it is very difficult to find it from the user database in case of refunds or problematic payments. Isn't this identity still shared in flutter? If it is not shared, why is it not shared yet?


Forum|alt.badge.img+1

I don't understand why this is marked as solved,  this is a very critical issue and it's giving me a lot of trouble. How are we supposed to verify purchases, some people can use software's like lucky patcher to fool the app into thinking that the purchase has been made on Google play while it has not been made anywhere, how are we supposed to fight this threat if we can't verify purchases on our backend. From my testing the transaction Id returned from Customer info does not match the one sent by the web webhook, you can't even find it anywhere on the dashboard. Please someone let me know how I'm supposed to verify consumable purchases in my flutter app. This has been tormenting my app for days 


Forum|alt.badge.img
  • New Member
  • 2 replies
  • December 17, 2024
marcus-jacob-6ba4e2 wrote:

I don't understand why this is marked as solved,  this is a very critical issue and it's giving me a lot of trouble. How are we supposed to verify purchases, some people can use software's like lucky patcher to fool the app into thinking that the purchase has been made on Google play while it has not been made anywhere, how are we supposed to fight this threat if we can't verify purchases on our backend. From my testing the transaction Id returned from Customer info does not match the one sent by the web webhook, you can't even find it anywhere on the dashboard. Please someone let me know how I'm supposed to verify consumable purchases in my flutter app. This has been tormenting my app for days 

Same issue, it feels like a no-brainer to just get the transaction ID so u can verify everything went smooth on the backend. Such webhook-unfriendly structure choice.


jeffrey_bunn
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 139 replies
  • January 3, 2025

@marcus-jacob-6ba4e2 ​@nagram Thanks for bumping this, and I apologize that there isn’t a good solution for you right now. I have shared this with my SDK team, but just for clarity, can you describe in detail the flow you’re looking to implement and issue you’re trying to solve? I’d like to understand if I can suggest a better workaround in the meantime, before the SDK update lands. Thanks!


Reply


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