Purchases for Windows Store

Please check 20.4pr5 with newer classes:

MBS Xojo Plugins, version 20.4pr5

OK. Christian, I appreciate your patience, but I am still lost.

Let us say I want to check if the app Store ID 9NCMFFPJRVHC (Check Print’R+) has been purchased ?

I started with
dim wsku as WindowsStoreSKUMBS
wsku.StoreId = “9NCMFFPJRVHC”

  wsku.RequestPurchaseAsync

And I am lost.

Please call

dim w as new WindowsStoreContextMBS
// later
w.RequestPurchaseAsync addressOf YourCompletionHandler, “9NCMFFPJRVHC”

And see if you get a callback later.

I’ve updated the example to include this to show how to buy something:

Sub Action() Handles Action
  Log "RequestPurchaseAsync..."
  
  // please change ID for the item to purchase
  
  Const StoreID = "9NCMFFPJRVHC"
  
  context.RequestPurchaseAsync AddressOf RequestPurchaseCompleted, StoreID
End Sub

and then we add a method to handle it:

Public Sub RequestPurchaseCompleted(AsyncStatus as Integer, result as WindowsStorePurchaseResultMBS)
  If AsyncStatus <> context.kAsyncStatusCompleted Then
    MsgBox "Async call failed."
    Return
  End If
  
  Select Case result.Status
    
  Case result.kStatusSucceeded
    MsgBox "Purchase Succeeded."
  Case result.kStatusAlreadyPurchased
    MsgBox "Already Purchased."
  Case result.kStatusNotPurchased
    MsgBox "Not Purchased."
  Case result.kStatusNetworkError
    MsgBox "Network error."
  Case result.kStatusServerError
    MsgBox "Server error."
  End Select
  
  Break // see in debugger
End Sub

Thank you Christian.

I added a button with that to the project, as well as the RequestPurchaseCompleted method.

I downloaded 20pr5 and updated plugins in 2019R3.2.

Here are the plugins I currently have:

When I try to run the project, I get all these errors:


What gives ?

Looks like a problem with loading the plugins.

Maybe clear the caches via button in preferences dialog?
Is that on Windows? You could try without all the Mac plugins.

I removed the Mac plugins, I cleared the cache, I replaced again the plugins, making sure they come indeed from 204pr5.

Same errors.

Could you verify on your end ?

Thank you.

on Windows 10 with Xojo 2019r3, I dropped all plugins from pr5 download into plugins folder, launched Xojo, opened project and run it. No problems.

I used 2019R3.2.

I will have to check with 2019R3

the .2 should not make a difference.

So I dumped ALL the plugins into 2019R3.2, and now, the example project works flawlessly. So my error was before to keep only the win plugin and WinFramework.

WindowsStoreProductMBS must be in another plugin.

Now I will be able to create a free version with iAP.

Thank you Christian :slight_smile:

1 Like

We add WindowsStoreProductQueryResultMBS class and three methods to WindowsStoreContextMBS class:

  • GetStoreProductsAsync
  • GetUserCollectionAsync
  • GetAssociatedStoreProductsAsync

So you can now query what products are available and which are bought (in user collection).

1 Like