Purchases for Windows Store

and uploaded 20.4pr4 plugin:

I’ll add WindowsStoreSKUMBS class, so you can query SKUs for a product, pick one which is subscription and start purchase. Maybe someone can try this soon?

I don’t plan on going the subscription model.

But I would certainly like to implement the freemium one.

I would post a free version that has limits, such as it can print only one check per minute.

The user could buy the full version inside, and lift all limitations.

After which, the app would be able to check at launch if the license has been bought and lift limitations.

So, I have no real idea about which plugins are necessary from the list you posted.

I thought you can read on MSDN how this should work with a trial and in-app purchase.
Then you can check our classes.

Probably you only need the queries in our new WindowsStoreContextMBS class to check WindowsStoreAppLicenseMBS and check for the trial flag and remaining time.
And offer a button to start purchase in the app.

If you need more methods (show on MSDN) compared to what I added to the plugin, please let me know.

I am going to experiment and get back to you.

1 Like

I am stuck in Android development for a few days. I will get to Windows next.

1 Like

Hi Christian,

I am looking at your example windowsstore.xojo_binary_project.

It is a bit unclear where I should enter critical data, like the product identity.

For instance, GetAppLicense needs to know which app needs to verify current license. Same thing for GetStoreProductForCurrentApp.

Likewise, I don’t see how to get the customer to the review page. Note that this part, I already do simply by pointing the user browser to the review page.

I tried to look at your site, but I am still uncertain what for instance the product property of
WindowsStoreProductMBS expects :
* 3 properties
* property ExtendedError as Integer
* property Handle as Integer
* property Product as WindowsStoreProductMBS
* method Constructor

Your example does not give a clue.

In Product Identity on the Windows Store, I have several possible values:

  • Package identity: CN=EB4109EB-09FE-4802-BE08-B95CE8C73C52
  • Package SID: S-1-15-2-1187865254-3464091738-2715693961-1777672873-3064389457-2142277337-4278015206

Which one does the plugin expect in the Product property?

We’ll upload newer plugins later today.

But you should already be able to use WindowsStoreContextMBS class and call RequestPurchaseAsync passing the Store ID for your product to order.

1 Like

Great. I will experiment.

Thank you Christian :slight_smile:

Christian, I am sorry, I cannot make heads or tails from the description at https://www.monkeybreadsoftware.net/topic-windowsstore.shtml or the example project.

Here is what I need to do:

  1. Upon launch of the app, I need to check if the user has already acquired the license, in which case I will unlock all features.

I suppose I need to provide the Store ID.

If the result is positive, I will unlock all features in the app.

  1. If the app is still limited (free version with iAP), an option in the menu will give access to the in-app purchase. The option will read as “Unlock all features”

I will provide the store ID, and probably use StorePurchaseMBS.

I thought I could quickly modify your example project to do these two things, or that your web site would provide examples and snippets. Unfortunately, neither one make it easy.

Perhaps I am thick, but I have been at that for a day, now, with no result whatsoever.

Please help.


Well, you would first run GetAppLicenseAsync to learn the license status and see whether it’s in trial mode or not.

Then on a purchase button you call RequestPurchaseAsync method and pass a method via addressOf. You pass Store ID of the article for full version.

this delegate then gets the purchase result. And there you check the status property to see whether you got a successful purchase completed.

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”


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."
  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