Set up price points
Before retrieving your price points for the checkout, ensure that you've set up your price points in the Publisher Dashboard.
Retrieve price points
To retrieve your price points, call the following function:
CheckoutController.Instance.GetPricePoints()
Important: This function must be called during the game's boot process, after the initialization.
If the request is successful, the OnPricePointsSuccess
callback is triggered, returning a list of available price points. If the request fails, the OnPricePointsFailed
callback is triggered with an error code. Follow the instructions in the WebGL SDK troubleshooting article and try to retrieve your price points again based on the error.
For more details on the callbacks you need to implement and how to handle them, refer to the Implement the WebGL SDK Callbacks article.
Example code
Below is an example response code for the function:
Property | Type | Description |
---|---|---|
pricingPoints | Array | List of available price points for the product. |
basePriceInUSD | String | The product's base price in USD. |
localizedPrice | String | The product's price in the local currency, adjusted by the multiplier . |
formattedPrice | String | The localized price in string format. |
pricingPointData | Object | Currency formatting metadata. |
currencyCode | String | The ISO 4217 currency code. For example, USD for United States Dollar. |
currencySymbol | String | The symbol representing the currency. For example, "$". |
fractionalSeparator | String | The character used to separate decimal places . For example, "." or ",". |
milSeparator | String | The character used to separate thousands. For example, "," or ".". |
symbolPosition | String | The position of the currency symbol. For example, "Right" for after the amount, "Left" for before. |
spacing | Boolean | Whether there is a space between the number and the currency symbol. |
multiplier | Integer | The factor by which the localizedPrice is multiplied. In the example below, the localized price is 200 and the multiplier is 100, so the final price will be $2.00. |
{
"pricingPoints": [
{
"basePriceInUSD": "200",
"localizedPrice": "200",
"formattedPrice": "$2.00"
},
{
"basePriceInUSD": "500",
"localizedPrice": "500",
"formattedPrice": "$5.00"
}
],
"pricingPointData": {
"currencyCode": "USD",
"currencySymbol": "$",
"fractionalSeparator": ".",
"milSeparator": ",",
"symbolPosition": "Left",
"spacing": true,
"multiplier": 100
}
}