Host
The Host module provides access to host functionalities, including retrieving environment details and enabling the game to open the purchase form.
Purchase Form
These APIs enable the game to redirect users to the Arena purchase form, where they can complete purchases (e.g., Gems). When the purchase form is closed, the game can resume the in-game flow and take different actions based on whether the user completed a purchase.
Open Arena Purchase Form
The Arena purchase form can be opened by calling:
await sdk.host.openPurchaseForm()
Observe Arena Purchase Form state change
The state of the purchase form can be observed by calling:
sdk.host.onPurchaseFormStateChange((state) => {
log(`purchase form changed state to ${JSON.stringify(state)}`);
});
The state returned in the callback will be of the following type:
{
opened: boolean,
madePurchase: boolean
}
The state indicates whether the form is opened or closed, and whether a purchase was made by the user.
Get Game Id
Retrieves the unique identifier for the current game.
await sdk.host.getGameId();
Get Query Parameter
Retrieves the value of a specified query parameter from the URL.
await sdk.host.getQueryParameter(paramName);
Get Host Details
Retrieves detailed information about the host environment.
await sdk.host.getDetails();
Get Arena Name
Retrieves the name of the Arena on which the game is currently running.
await sdk.host.getArenaName();