Search Unity

UWP App Xbox Payments

Discussion in 'Windows' started by skyrusfxg, Feb 19, 2020.

  1. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Hello. Is there anyone who made the game on unity and published it on the Xbox? What API was used for IAP payments? We published our game on the Xbox, and our code that worked in other published games in the store (not for the Xbox) does not work.

    We used Windows.ApplicationModel.Store namespace before. It does not working.

    "Windows.ApplicationModel.Store.CurrentApp.LoadListingInformationAsync()" returns nothing.

    "Windows.ApplicationModel.Store.CurrentApp.RequestProductPurchaseAsync(productId)" deducts money from the account but no receipt is sent to verify the payment.

    So we tried to use "Windows.Services.Store" namespace. And it works fine on PC, but the same build does not working on XboxOne.

    StoreContext.GetDefault() returns nothing.
    StoreContext.GetForUser() returns nothing.

    So is there anyone with published games and with in-game payments. What API do you use? Are there any problems? How did you decide?

    UnityPaymentSystem working and tested for XBox? I heard that it uses Windows.ApplicationModel.Store namespace. It does not working.

    I got an email today from xbox developer support department: "I think you may be using an alternate API that isn’t supposed to be used for games. You should be calling the inventory service or the CatalogService for associated Xbox Live calls, specifically the inventory service if you are making IAP calls. You should start with Microsoft::Xbox::Services::Marketplace::InventoryService as that contains the methods for retrieving inventory quantity and consuming it."

    But ... there is no InventoryService defined for UWP App. And I need full service with purchasing IAPs. Not only for retrieving inventory quantity and consuming it.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I was under impression that "Windows.Services.Store" should work for all UWP apps. It's very weird that it doesn't work. Did you mention to the Xbox developer support that you're making a UWP app?

    I also googled for that namespace/class you mentioned and it landed me here:

    https://github.com/microsoft/xbox-l.../Marketplace/WinRT/InventoryService_WinRT.cpp
    https://github.com/microsoft/xbox-live-api/releases

    Looks like it's part of Xbox Live API.

    AFAIK Unity IAP is using Windows.Services.Store namespace.
     
  3. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127

    Hello. Yes, I mentioned to the Xbox developer support that I am making a UWP app

    https://github.com/microsoft/xbox-l...Services/Common/WinRT/XboxLiveContext_WinRT.h

    Code (CSharp):
    1. #if TV_API || UNIT_TEST_SERVICES
    2. Marketplace::CatalogService^ m_catalogService;
    3. Marketplace::InventoryService^ m_inventoryService;
    4. EntertainmentProfile::EntertainmentProfileListService^ m_entertainmentProfileListService;
    5. #endif
    upload_2020-2-20_6-55-53.png

    There is no CatalogService and InventoryService defined in XboxLiveContext for UWP App. Only for (TV_API || UNIT_TEST_SERVICES)
     

    Attached Files:

    Last edited by a moderator: Feb 20, 2020
  4. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    On XboxOne I obtain StoreContext after signing in to XboxLive as:

    m_storeContext = StoreContext::GetForUser(m_user->WindowsSystemUser);


    (On PC i got StoreContext as:
    m_storeContext = StoreContext::GetDefault();
    )

    But, when i am asking for StoreProducts:


    auto filter = ref new Platform::Collections::Vector<Platform::String^>();
    filter->Append("UnmanagedConsumable");

    auto ids = ref new Platform::Collections::Vector<Platform::String^>(storeIds);

    auto asyncOp = m_storeContext->GetStoreProductsAsync(filter, ids);
    create_task(asyncOp).then([this](task <Windows::Services::Store::StoreProductQueryResult^> t)
    {


    i got an aswer with no items:

    res->Products->Size == 0 , ExtendedError: -2143330041


    the same code on PC returns list of products normally. Everithing is Ok. But on XboxOne there is a problem.
     
    Last edited: Feb 20, 2020
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    TV_API is defined if you're making non-UWP Xbox App. Given what you linked, it seems that this API is not available for UWP apps at all. I really have no idea why Xbox developer support was telling you that you need to use it. Was this conversation carried out via email or on Xbox Developer forums?

    The extended error being -2143330041 lead me to this page: https://social.msdn.microsoft.com/F...ption-from-hresult-0x803f6107?forum=wpdevelop

    Is your generated VS project associated with one in the Windows Store?
     
  6. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    It's ok. Build on XboxOne must be first loaded to sendbox (at Microsoft Dev Center) to test it. After publishing it to this sandbox in the store, build must be downloaded right from windows store. Only in this case all are working on XboxOne (products info downloading, products can be purchased). On PC all are working right by local build instalation.
     
    Last edited: Feb 20, 2020
  7. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Thank you for your support!!! Big thanks!!!
     
  8. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Does anyone know how to check unfulfilled to the store "Unmanaged Consumable" items existance with Windows.Services.Store API?

    m_storeContext->GetConsumableBalanceRemainingAsync(storeId)


    if (result->BalanceRemaining == 0)
    - Unfulfilled ?

    For example, after game was initialized I will request balance for each store product (iap) by
    GetConsumableBalanceRemainingAsync
    . And if for some item
    result->BalanceRemaining == 0
    (the user bought the product, but due to a network error, for example, I did not receive the result of the purchase) I should to fulfill product to the store.

    Is such condition
    if (result->BalanceRemaining == 0)
    proper for understanding for "Unmanaged Consumable" item that user bought the product, but i did not fulfill it to the store?
     
  9. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    The answer from dev support: