Please Select Your Location
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malta
المملكة العربية السعودية (Arabic)
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
Please Select Your Location
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
España
Suisse
Suomi
Sverige

Function usage

IsReady()

void IsReady(IAPurchaseListener listener, string pchApiKey);
Parameter Type Description
listener IAPurchaseListener Callback function
pchApiKey string API Key

Initializes the IAP API. When initialization completes, the OnSuccess() function of the listener callback will retrieve the end user’s currency type, which will be available to other functions.

Request()

void Request(IAPurchaseListener listener, string pchPrice);
Parameter Type Description
listener IAPurchaseListener Callback function
pchPrice string Purchase price in end-user’s currency in the format "1.50" . Note that decimals are marked by a period, not a comma.

Requests the price of an IAP item. When complete, the OnRequestSuccess() callback of IAPurchaseListener listener will retrieve the purchase ID for the requested item. The purchase ID is a parameter for Purchase() .

Request() [NEW]

void Request(IAPurchaseListener listener, string pchPrice, string pchItemName);
Parameter Type Description
listener IAPurchaseListener Callback function
pchPrice string Purchase price in end-user’s currency in the format "1.50" . Note that decimals are marked by a period, not a comma.
pchItemName string Item name specified in the VIVEPORT backend

Requests the price of an IAP item-by-item name pchItemName . When complete, the OnRequestSuccess() callback of IAPurchaseListener listener will retrieve the purchase ID of the requested item. The purchase ID is a parameter for Purchase() .

Purchase()

void Request(IAPurchaseListener listener, string pchPurchaseId);
Parameter Type Description
listener IAPurchaseListener Callback function
pchPurchaseId string Purchase ID, from Request()

Purchases the item specified by pchPurchaseId . When complete, the OnPurchaseSuccess() callback of IAPurchaseListener listener will retrieve the purchase ID for later query. The end user will be prompted for a PIN when making any subscriptions or purchases. The PIN UI is implemented by the SDK.

Query()

void Query(IAPurchaseListener listener, string pchPurchaseId);
Parameter Type Description
listener IAPurchaseListener Callback function
pchPurchaseId string Purchase ID, from Request()

Checks if the end user has already purchased the item specified by pchPurchaseId . When complete, the OnQuerySuccess() function of IAPurchaseListener listener will retrieve the purchase ID for later query.

Query() [New]

void Query(IAPurchaseListener listener);
Parameter Type Description
listener IAPurchaseListener Callback function

Shows a list of everything that the end user has purchased so the developer can deliver virtual goods. When complete, the OnQuerySuccess() function of IAPurchaseListener listener will retrieve the list of all purchased items via IaPurchase.QueryListResponse .

GetBalance()

void GetBalance(IAPurchaseListener listener);
Parameter Type Description
listener IAPurchaseListener Callback function

Gets the balance of the end user’s wallet. When complete, the OnBalanceSuccess() function of IAPurchaseListener listener will output the balance of the end user’s wallet via string pchBalance .

RequestSubscription()

void RequestSubscription(IAPurchaseListener listener, string pchPrice, string pchFreeTrialType, 
int nFreeTrialValue, string pchChargePeriodType, int nChargePeriodValue, 
int nNumberOfChargePeriod, string pchPlanId);
Parameter Type Description
listener IAPurchaseListener Callback function
pchPrice string Purchase price in end-user’s currency in the format "1.50" . Note that decimals are marked by a period, not a comma.
pchFreeTrialType string Free trial period unit, specify “month” or “day”
nFreeTrialValue int Number of free trial units (months or days)
pchChargePeriodType string Subscription period unit, specify “month” or “day”
nChargePeriodValue int Number of months/days per charge period
nNumberOfChargePeriod int Number of charge periods in this subscription
pchPlanId string Specify a plan ID

Requests a subscription ID to subscribe to a plan that has not been specified in the VIVEPORT Developer Console. All subscription details are passed as parameters. When complete, the OnRequestSubscriptionSuccess() function of IAPurchaseListener listener will retrieve a subscription ID which can be used as a parameter for Subscribe() . For pchChargePeriodType , nChargePeriodValue , and nNumberofChargePeriod , if pchChargePeriodType == "month" , nChargePeriodValue == 2 , and nNumberofChargePeriod == 1 , then the end user will be charged once every two months.

RequestSubscriptionWithPlanID()

void RequestSubscriptionWithPlanID(IAPurchaseListener listener, string pchPlanId);
Parameter Type Description
listener IAPurchaseListener Callback function
pchPlanId string Plan ID to subscribe to

Uses a plan ID to subscribe to a plan in the VIVEPORT Developer Console. The plan ID is set in the VIVEPORT Developer Console at the time of configuration. When complete, the OnRequestSubscriptionSuccess() function of IAPurchaseListener listener will retrieve the subscription ID which can be used as a parameter for Subscribe() .

Subscribe()

void Subscribe(IAPurchaseListener listener, string pchSubscriptionId);
Parameter Type Description
listener IAPurchaseListener Callback function
pchSubscriptionId string Plan ID to subscribe to

Subscribes to a plan. pchSubsciptionID comes from the callback of RequestSubscription() or RequestSubscriptionWithPlanID() , and is used to complete the subscription process. When successful, the IAPurchaseListener.OnSubscribeSuccess will retrieve a pchSubscriptionId , which can be used to check or cancel a subscription. The end user will be prompted for a PIN when making any subscriptions or purchases. The PIN UI is implemented by the SDK.

QuerySubscription()

void QuerySubscription(IAPurchaseListener listener, string pchSubscriptionId);
Parameter Type Description
listener IAPurchaseListener Callback function
pchSubscriptionId string Subscription ID to query

Checks subscription status using the subscription ID received from the callback of Subscribe() . Subscriptions are output via IAPurchaseListener.OnQuerySuccess.subscriptionlist of type Subscription[] . If pchSubscriptionId is null, the callback will retrieve all subscriptions as an array.

QuerySubscriptionList(IAPurchaseListener listener)

void QuerySubscription(IAPurchaseListener listener);
Parameter Type Description
listener IAPurchaseListener Callback function

Checks subscription status of all of the end user’s subscriptions. Subscriptions are retrieved through IAPurchaseListener.OnQuerySubscriptionListSuccess().subscriptionlist of type Subscription[] .

CancelSubscription()

void CancelSubscription(IAPurchaseListener listener, string pchSubscriptionId);
Parameter Type Description
listener IAPurchaseListener Callback function
pchSubscriptionId string Subscription ID to cancel

Cancels the subscription specified by pchSubscriptionId .