Table of Contents

Class Purchasing

Namespace
AO
Assembly
CoreAssembly.dll

Purchasing is a core engine system to work with in game purchases using Sparks.

public static class Purchasing
Inheritance
Purchasing
Inherited Members

Methods

GetProduct(string)

Get a product by its id.

public static extern Purchasing.Product GetProduct(string product)

Parameters

product string

Returns

Purchasing.Product

OwnsGamePass(Player, string)

Check if a player owns a non-consumable product.

public static bool OwnsGamePass(Player player, string product)

Parameters

player Player
product string

Returns

bool

OwnsGamePassLocal(string)

Check if the local player owns a non-consumable product.

public static extern bool OwnsGamePassLocal(string product)

Parameters

product string

Returns

bool

Remarks

Must be called on the client.

PromptPurchase(string)

Prompt the player to purchase a product.

public static extern void PromptPurchase(string product)

Parameters

product string

Remarks

Must be called on the client.

SetPurchaseHandler(Func<Player, string, bool>)

Register a purchase handler.

public static void SetPurchaseHandler(Func<Player, string, bool> handler)

Parameters

handler Func<Player, string, bool>

Examples

Purchasing.SetPurchaseHandler((Player player, string product) => {
   if (product == "myProductId") {
    // Grant the game pass to the player
    return true;
   }
   return false;
});

Remarks

This is only supported on the server.