Implementing Microsoft Store in-app purchases for a Python desktop application can be challenging due to the specific requirements for calling WinRT APIs, which are primarily designed for use in environments like C# or C++. Here are some insights regarding your questions:
- Support for Python Desktop Applications: While Microsoft Store in-app purchases are officially supported, the implementation is typically more straightforward in C# or C++ environments. Using Python may require additional workarounds, such as creating a bridge with C# as you have done.
- Using the WinRT Store API in Python: The error "This function must be called from a UI thread" indicates that the
request_purchase_asyncmethod must be executed on the UI thread. You may need to ensure that your Python application properly manages threading. Using a C# helper to call the WinRT API is a common approach, but you need to ensure that the window handle is correctly passed and recognized by the C# application. - Add-ons Visibility in the Store: If add-ons are not visible in the Store app despite being listed in Partner Center, it could be due to several reasons, including incorrect configurations or the need for additional metadata. Ensure that the add-ons are properly published and that their status is correctly reflected in the Partner Center.
- C# Bridge Approach: Your approach of using a C# console application as a bridge is valid, especially if it helps you bypass threading issues in Python. However, ensure that the bridge correctly handles the window handle and that the C# application is set up to interact with the WinRT API as intended.
For further guidance, consider reviewing the documentation on in-app purchases and the specific requirements for using the Windows.Services.Store namespace. You may also want to explore forums or communities focused on Microsoft Store development for additional support.
References: