locked
[UWP] Client & Server UWP verfiy in-app purchase on the server side RRS feed

  • Question

  • I am developing a client server UWP app. The server is an ASP.net web api site.

    A workflow is as follows -

    1. Users buy an In-App-Purchase using the windows store in-built functionality.

    2. The user is then allowed to create an account on the server using the UWP app.

    I would like to do is add security/confirmation at step 2 executed on the server.

    e.g. Send the Windows.ApplicationModel.Store.PurchaseResults.TransactionId and verify the transaction id on the server.

    Is there such a mechanism available?

    Sunday, February 21, 2016 4:56 PM

Answers

All replies

  • You could use receipts to verify product purchases. Please refer to the following links for more information. There is a code sample available on the first link.

    Use receipts to verify product purchases: https://msdn.microsoft.com/en-us/library/windows/apps/mt219692.aspx
    Validating Windows Store Purchases for Your App: https://channel9.msdn.com/Events/Build/2013/3-126
    Verifying in-app purchases: http://stackoverflow.com/questions/21562927/verifying-in-app-purchases

    Hope that helps.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    Sunday, February 21, 2016 8:05 PM
  • Thanks for the links.

    I added the code from -

    https://msdn.microsoft.com/en-us/library/windows/apps/jj649137.aspx

    and tested against the CurrentAppSimulator.RequestProductPurchaseAsync(productId). The xml returned from this method

    is missing information (no CertificateId).

    Is there anyway I can test this completely end-to-end?

    Also, any idea what the maxium size of the receipt is?

    Sunday, February 21, 2016 9:58 PM
  • Hello bjames_dev,

    >>The xml returned from this method is missing information (no CertificateId).

    When testing with CurrentAppSimulator the xml is get from the xml you write. So can you make sure you've load the right xml in your project? In my point of view, it should not be a problem when testing with CurrentAppSimulator. It returns all things from the xml your wrote. May I know more details about how you test this?

    >>Also, any idea what the maxium size of the receipt is?

    In real time, all we need to do is using class to call and ask for data. Why do you want to know the maxium size? I think the return data will not so huge.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 23, 2016 8:59 AM
  • Hello Barry,

    I have done some slight modifications to the windowsstoreproxy.xxml to allow the simulated purchase of my in-app-purchase. How can I modify it to return a valid receipt which I can later test. I want to test it by sending the receipt to my server and verifying there following this method - https://msdn.microsoft.com/en-us/library/windows/apps/jj649137.aspx.

     

    I want to know the size so I can create an appropriately sized database column to store it in.

     

    Tuesday, February 23, 2016 9:06 PM
  • Hello bjames_dev,

    The right way to create that windowsstoreproxy.xml is listed on here:

    https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.store.currentappsimulator.aspx?f=255&MSPPError=-2147217396

    I checked it and I found it's true that it does not contain the certificateID, I think the reason is that it is related to certificate. What about just use a test ID if you want to do something here? I think the above xml can help you test most of the things you need.

    >>I want to know the size so I can create an appropriately sized database column to store it in.

    So you just want to save this file to a database? Based on my idea I think it's better for you to store in some local and store the location in your database. I think this may better.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Barry Wang Tuesday, March 1, 2016 9:37 AM
    • Marked as answer by Barry Wang Tuesday, March 8, 2016 1:41 AM
    Wednesday, February 24, 2016 7:34 AM
  • I want to test the code below within my app workflow. To do this I need a valid certificate. How can I create one?

    https://msdn.microsoft.com/en-us/library/windows/apps/jj649137.aspx



    • Edited by bjames_dev Tuesday, March 1, 2016 9:49 PM
    Tuesday, March 1, 2016 9:48 PM
  • Hello bjames_dev,

    To create a test certificate we can do this with the help of Visual Studio:

    Or manually do this: How to create an app package signing certificate

    The above are for testing.

    And for product usage, you just need to upload your app by publish to store, and there will be a certificate for you.

    By the way, sorry that it seems the certificate does not support for testing:https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.store.currentappsimulator.aspx

    When checking the IAP sample code:https://code.msdn.microsoft.com/windowsapps/Licensing-API-Sample-19712f1a/sourcecode?fileId=44025&pathId=280131769

    The certificateid is also empty:

    Personally I think maybe the value is wrote in the store.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Barry Wang Wednesday, March 2, 2016 6:02 AM
    • Marked as answer by Barry Wang Tuesday, March 8, 2016 1:41 AM
    Wednesday, March 2, 2016 6:01 AM