question

Bryan-9661 avatar image
0 Votes"
Bryan-9661 asked RoyLi-MSFT commented

How do I get the Transaction ID for a UWP purchase?

Hello,

I am using the RequestPurchaseAsync() method for in-app purchases within our UWP app as documented here: https://docs.microsoft.com/en-us/windows/uwp/monetize/enable-in-app-purchases-of-apps-and-add-ons

I am also using the MS Store Collection API to query the products for a given user as documented here: https://docs.microsoft.com/en-us/windows/uwp/monetize/query-for-products

The CollectionItemContractV6 object response includes a "transactionId" value for these purchases but I do not see where this transaction ID comes from. Where can this ID be found after/during the in-app purchase flow so that we can confirm a transaction matches in our records? Note that I am using the Windows.Services.Store namespace.

Additionally, during the RequestPurchaseAsync() call, we include custom StorePurchaseProperties that uses custom JSON data for the transaction (see https://docs.microsoft.com/en-us/uwp/api/windows.services.store.storepurchaseproperties?view=winrt-19041). How can we retrieve this data after the transaction has completed?

Thanks for any assistance,

Bryan


partner-center-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RoyLi-MSFT avatar image
1 Vote"
RoyLi-MSFT answered RoyLi-MSFT commented

Hello,

Welcome to Microsoft Q&A!

There is no way to get the transaction ID if you are using Windows.Services.Store namespace. If you are using the old Windows.ApplicationModel.Store namespace, you could get the transaction ID in the PurchaseResults object. In the old in-app purchase process using Windows.ApplicationModel.Store namespace, the transaction ID is used to check the product fulfillment for consumable in-app products-Enable consumable in-app product purchases.

If you are using Windows.Services.Store namespace, there is a different way to check if a user had purchased a project-Get info for add-ons for the current app that the user has purchased. You could check the purchase using the Store API directly without sending it to your own server. Of course, if you need, you could send the purchased product information as you want.

Thank you.


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the response, @RoyLi-MSFT .

So there is no way to directly correlate a specific transaction with any record either from the Store API or the GetUserCollectionAsync method that you referenced. We would have to "ballpark" it by date and the product ID to find the correct order rather than referencing a unique ID?

Thanks,
Bryan

0 Votes 0 ·

Yes, if you need to check the record with the local log in your server, then you will need to check the date and product ID information getting from the Store API.

0 Votes 0 ·

Hi @RoyLi-MSFT ,

Thanks.

As a note from my original question, the custom StorePurchaseProperties data (JSON) we include on the transaction. Is that used or available anywhere after the purchase? I was hoping it would be in the response from the Store API but I don't see it anywhere.

Thanks again,
Bryan

0 Votes 0 ·
Show more comments