How to enable bridge desktop Unity App (lower .Net version app) with latest IAP APIs for Windows Store

1. Create C# class library and follow this link to create purchase method:

here is the sample code:

public static string PurchaseAddon (…..)



static async void purchase(object o)
     IInitializeWithWindow initWindow = (IInitializeWithWindow)(object)storeContext;
     var ptr = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
     var result = await storeContext.RequestPurchaseAsync((o as PurchaseObject).Productid);
     if (result.ExtendedError != null)
        MessageBox.Show( result.ExtendedError.Message,result.ExtendedError.HResult.ToString());
      switch (result.Status)

2. Install DLLExport nuget, and claim [DllExport] in the C# project:


3. In Unity script, import the above library:

    extern static IntPtr PurchaseAddon (….);

4. Exactly follow below five steps to test IAP:

Important: The RequestPurchaseAsync must be raised from UI thread, refer to




Leave a Reply

Your email address will not be published. Required fields are marked *