[C2/C3] Improve Windows Store plugin for supporting IAP in project with Xbox Live integrations

0 favourites
  • 2 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • - Problem Description -

    My game was approved for IDdxo@Xbox program and now I'm integrating the achievements into game. But I found a problem with C2 IAP's - they do not work. IAP works if Test mode is "on" but not working in published game. Apparently for applications with Xbox Live we need to use a other namespace for purchases, that's what I found in the documentation:

    docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.store

    At the moment, my game is in Xbox Creators Program, and purchases also do not work. I didn't know about it, but the players told me about this issue. Before Xbox Live was added IAP worked flawlessly.

    - Attach a Capx -

    Any project with Xbox live integration for Xbox Creators Program or IDsrk@Xbox.

    - Steps to Reproduce Bug -

    Step 1 - Export project from C2 with IAP plugin (or Windows Store plugin) and Xbox Live plugin as UWP and open in Visual Studio 2017.

    Step 2 - Build app package and publish on Microsoft Dev Center.

    Step 3 - Launch app and try to purchase IAP.

    - Observed Result -

    No response from purchasing.

    - Expected Result -

    A window for confirming of purchase appears.

    - Affected Browsers -

    Chrome: (NO)

    FireFox: (NO)

    Internet Explorer: (NO)

    Visual Studio: (YES)

    - Operating System and Service Pack -

    Windows 10 version 1803

    - Construct 2 Version ID -

    r262 64bit

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi

    As a temporary solution, I managed to implement the purchase by running this js code using the Valerypopoff Javascript plugin:

    -> On touched purchase button: Execute js code:

    	var StorePurchaseStatus = Windows.Services.Store.StorePurchaseStatus;
     var storeContext = Windows.Services.Store.StoreContext.getDefault();
    
    storeContext.requestPurchaseAsync(#0).done(function (result) {
     if (result.extendedError) {
     SdkSample.reportExtendedError(result.extendedError);
     return;
     }
    
     switch (result.status) {
     case StorePurchaseStatus.alreadyPurchased:
     c2_callFunction(#1, []);
    
     case StorePurchaseStatus.succeeded:
     c2_callFunction(#2, []);
    
     case StorePurchaseStatus.notPurchased:
     c2_callFunction(#3, []);
    
     case StorePurchaseStatus.networkError:
     c2_callFunction(#3, []);
    
     case StorePurchaseStatus.serverError:
     c2_callFunction(#3, []);
    
     default:
     c2_callFunction(#3, []);
     }
     });
    

    Where:

    #0 - Purchase ID from Windows Dev Console

    #1 - name of C2 function for restoring purchase

    #2 - name of C2 function for success purchasing

    #3 - name of C2 function for unsuccess purchasing

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)