Host
The Host module provides access to host functionalities, like getting the environment details or allowing the game to open the purchase form.
Purchase Form
These APIs can be used by the game to redirect the user to the Arena purchase form, so the user can buy something (e.g. Gems), and then the game can resume the in-game flow when the purchase form is closed, being able to take different actions depending on if the user completed a purchase or not.
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 listened by calling:
sdk.host.onPurchaseFormStateChange((state) => {
log(`purchase form changed state to ${JSON.stringify(state)}`);
});
The state returned on the callback will be of the following type:
{
opened: boolean,
madePurchase: boolean
}
This way the state shows if the form is opened or closed, and if a purchase was made by the user.
Game Id
Get Game Id
await sdk.host.getGameId();
Get Query Parameter
await sdk.host.getQueryParameter(paramName);
Get Host Details
await sdk.host.getDetails();