none
C++ app with desktop bridge - CurrentAppSimulator not available - how to make test purchases? RRS feed

  • Question

  • Hi!

    How can I use a C++ app using the desktop bridge, to make *test* purchases that won’t actually charge a real account, and where any subscriptions can be re-tested easily … if CurrentAppSimulator is not available to me as a developer of C++ apps?

    I cannot see how to *test* in-app-purchasing without making *actual* purchases.

    By way of background, I've created a C++ app using the desktop bridge, and want to make *test* purchases that won’t actually charge a real account, and where any subscriptions can be re-tested easily.

    By way of background, according to the Microsoft documentation:
    "Use the CurrentAppSimulator to test your app's licensing and in-app products while you develop your app. After you test your app, and before you submit it to the Microsoft Store, you must replace the instances of CurrentAppSimulator with CurrentApp. Your app will fail certification if it uses CurrentAppSimulator.”

    So test purchases in a development environment can be made using Windows.ApplicationModel.Store.CurrentAppSimulator

    *HOWEVER* when using a C++ app using the desktop bridge, the CurrentAppSimulator is not available (!!!) according to other documentation: "The CurrentAppSimulator class and the other types in the Windows.ApplicationModel.Store namespace are no longer being updated with new features. If your project targets Windows 10 Anniversary Edition (10.0; Build 14393) or a later release in Visual Studio (that is, you are targeting Windows 10, version 1607, or later), we recommend that you use the Windows.Services.Store namespace instead. For more information, see In-app purchases and trials. The CurrentAppSimulator class is not supported in Windows desktop applications that use the Desktop Bridge or in apps or games that use a development sandbox in Partner Center (for example, this is the case for any game that integrates with Xbox Live). These products must use the Windows.Services.Store namespace to implement in-app purchases and trials."

    By way of reference, when I work with in-app-purchase code for iOS and macOS, if running store code within an app running in the debugger, the device (iOS or macOS) automatically uses a sandbox store, where no real payment method is actually used. Furthermore, subscriptions purchased in such an environment automatically expire in an accelerated timescale, making repeat tests easy to perform.

    Many thanks for any help,

    Pete

    Sunday, September 1, 2019 10:13 AM

All replies

  • Hi,

    For your problem, there are something that needs to know. First, the Windows.ApplicationModel.Store namespace(where CurrentAppSimulator class comes from) is not supported in Windows desktop applications that use the Desktop Bridge. You should use Windows.Services.Store Namespace instead. Second, if you are using APIs Windows.Services.Store Namespace, there is no test purchase like in Windows.ApplicationModel.Store Namespace. As a workaround, we do recommend you to create a new add-on in the Partner Center then make your purchase test locally. 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 2, 2019 6:54 AM
    Moderator
  • Oops! Update: I did this for testing Add-on purchase. There seems
    to be no way to do it for an App purchase because making the
    price zero is making it free. What happens to trial then? Not tested.

    Original answer:

    I had the same problem and found the following workaround:

    1. Make the price zero
    2. Hide the app in the store while you test a purchase

    Still, there is another problem--going through the cycle again. It's not possible
    for the same user because the system remembers the state. I ended up
    adding more users for this. That's a real pain. Ideally, there should be a
    sandbox to reset the purchase and trial states and test with the same user
    again.



    • Edited by SanjaySk Friday, September 13, 2019 3:47 AM
    Friday, September 13, 2019 3:13 AM