General information

We highly recommend to inform users about trial period duration and it’s price after trial period is over.
In case of user complaints we have a right to demand you to change game’s user interface according to our recommendations or disable game subscriptions for your game.

Shows a dialog for purchasing a subscription to periodic game bonuses or service. For a purchase to be successful game’s callback service must process and verify our callback request.

If user has successfully purchased a subscription, he will be charged for a selected amount of OKs each subscription period. Period and subscription cost can be configured for every subscription.

Method signature

FAPI.invokeUIMethod("showPaymentSubscription", productId, productPrice);
NameRequiredTypeDescription
productIdYesStringSubscription id
priceYesIntegerSubscription cost. Selected amount of OKs will be charged from user every subscription period

Example usage

/*
* showPaymentSubscription() example
* Attention! Game's callback service must verify subscription for it to be proceed correctly
*/
function showPaymentSubscription() {
    FAPI.invokeUIMethod("showPaymentSubscription", "productId", 10);
}

Callback example

Client callback is only supported on mobile

API_callback can be called with following parameters:

Callback in case of a successful payment

method: “showPaymentSubscription”

result: “ok”

data: “ok”

Callback in case of a cancelled payment

method: “showPaymentSubscription”

result: “error”

data: “cancel”

Adding new subscription

To enable in-game subscription for your application you need to register it in OK.ru first.

To add a subscription please write an e-mail to api-support@ok.ru with following data:

ParameterDescriptionUnit
Trial period durationDuration of a trial period. On trial period subscription is free for userDays, hours, minutes
Period durationSubscription period. Every set amount of time user is charged for selected amount of OKsDays, hours, minutes
PriceSingle period price.OKs
Subscription iconSubscription image URL. Image’s size must be 256x256 
product idString identifier of a subscription 
NameSubscription name. Must have a size of 1 to 3 words. 
DescriptionShort subscription description. It must describe what user is purchasing with corresponding subscription