Technical Support: In-App Purchase Implementation Issues in Python Desktop App (Add-on IDs: 9N1PM2731J1C, 9NKBQPS9MN9L, 9PHVFL7KTVNQ)

youngsik kim 0 Reputation points
2025-12-11T13:44:34.9733333+00:00

Dear Microsoft Store Support Team,

I am developing a desktop application called "geul-bridge" using Python and PyQt5, which is currently published on the Microsoft Store. I am attempting to implement in-app purchases using consumable add-ons, but I am encountering technical difficulties and would appreciate your guidance.

Application Information**:**

  • App Name: geul-bridge
  • Package Name: yskim.geul-bridge
  • Publisher: CN=4E022697-639B-45EF-8218-1429BA19B5CA
  • Development Platform: Python 3.x + PyQt5, packaged as MSIX
  • Current Store Version: 1.2.0.0
  • Test Flight Version: 1.3.0.0

Add-on Information:

  1. points_250k (Store ID: 9N1PM2731J1C) - Status: In the Microsoft Store
  2. points_650k (Store ID: 9NKBQPS9MN9L) - Status: In the Microsoft Store
  3. points_1500k (Store ID: 9PHVFL7KTVNQ) - Status: In the Microsoft Store

Issues Encountered:

  1. UI Thread Error
  • When calling WinRT API (Windows.Services.Store) directly from Python:
  • Error Message: "OSError: [WinError -2147023496] This function must be called from a UI thread"
  • Occurs when calling: context.request_purchase_async(product_id)
  1. Window Handle Error
  • Created a C# helper executable to call WinRT API on behalf of Python app:
  • Error Message: "Invalid window handle. (0x80070578)"
  • Despite attempting to pass the PyQt window handle to the C# helper, the error persists
  1. Catalog Error
  • In some cases: "PEX-CatalogAvailabilityDataNotFound" error
  • Add-ons are not visible in the Microsoft Store app or web page
  • Add-ons show "In the Microsoft Store" status in Partner Center

Attempted Solutions:

  1. Used Python asyncio and QThread for asynchronous processing
  2. Created a C# console application as a bridge to call WinRT RequestPurchaseAsync() API
  3. Attempted to set window handle using InitializeWithWindow.Initialize()
  4. Deployed test version via Package Flight with Store-signed package
  5. Used self-signed certificate for MSIX packaging and installed it in trusted root

Questions**:**

  1. Is implementing Microsoft Store in-app purchases officially supported for Python desktop applications?
  2. If supported, what is the correct way to use the WinRT Store API in a Python environment?
  3. Why are the add-ons not visible in the Store app? Are there additional configurations required?
  4. Is the C# bridge approach appropriate? Are there other recommended methods?

The backend receipt verification logic (Firebase Functions) is already implemented and working, and the automatic detection of unfulfilled purchases is functional. However, I am stuck at the point where users initiate the actual purchase.

Any technical guidance, documentation, or sample code would be greatly appreciated.

Thank you for your assistance.

Best regards

Microsoft Partner Center | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-11T13:44:49.47+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    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:

    1. 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.
    2. Using the WinRT Store API in Python: The error "This function must be called from a UI thread" indicates that the request_purchase_async method 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.
    3. 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.
    4. 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:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.