Initialize SDK
Initialize the SDK in one of the following ways:
- Use the
XsollaSettingsManager
component:- Add an empty node to the scene and select it in the
Hierarchy panel. - In the
Inspector panel, clickAdd Component and selectXsollaSettingsManager
. - Specify the parameters of your project from Publisher Account:
- Add an empty node to the scene and select it in the
- In the
Project ID field, specify the project ID that can be found in Publisher Account next to the name of your project. - In the
Login ID field, specify the ID of the Login project. To get it, open Publisher Account, go to the Login > Dashboard > your Login project section, and click Copy ID next to the name of the Login project. - In the
Client ID field, specify OAuth 2.0 client ID. It can be found in Publisher Account in the Login > your Login project > Security > OAuth 2.0 section. - In the
Redirect URL field, specify the URL or path where users are redirected after they have been successfully authenticated, confirmed their email, or reset their password. The value must match the one specified in Publisher Account in the Login > your Login project > Security > OAuth 2.0 section. - Set other settings if necessary (e.g., display options for the payment UI in the
Pay Station UI WebGL section).
- In the
- Add the following lines to your project’s source code in Cocos Creator, where:
<yourLoginId>
— Login ID. To get it, open Publisher Account, go to the Login > Dashboard > your Login project section, and click Copy ID next to the name of the Login project.<yourProjectId>
— project ID. It can be found in your Publisher Account next to the name of your project.<yourClientId>
— Client ID. It can be found in Publisher Account in the Login > your Login project > Security > OAuth 2.0 section.<redirectURI>
— the URL or path where users are redirected after they have been successfully authenticated, confirmed their email, or reset their password. The value must match the one specified in Publisher Account in the Login > your Login project > Security > OAuth 2.0 section.
Copy
- typescript
var settings: XsollaSettings = {
loginId: '<yourLoginId>',
projectId: '<yourProjectId>',
clientId: '<yourClientId>',
redirectURI: '<redirectURI>',
enableSandbox: IsSandbox
}
Xsolla.init(settings);
Was this article helpful?
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.Found a typo or other text error? Select the text and press Ctrl+Enter.