How to migrate to SDK version 2.0.0 and higher
Structure changes in version 2.0.0
- Request methods and classes have been replaced with static ones.
- The project ID is not passed to methods as a parameter. The SDK uses the value specified in the project settings.
- The user’s authorization token is not passed to methods as a parameter and is not returned by callback functions. The SDK determines the token based on the user’s previous authentication and passes it to the methods for getting a catalog, purchasing, and displaying the inventory.
- The logic for determining the information about a mobile device has been added to the SDK. The data is encapsulated in a
DeviceInfostructure.
See the full list of changes in the сhangelog.
XsollaAuth class upgrade
- Replace
XsollaAuth.Instancecalls withXsollaAuth. - Change the signature of the
onSuccesscallback method used when calling the authentication method. ReplaceAction<string>withAction. - Remove the passing of the
refreshTokenparameter when calling theRefreshOAuthTokenmethod. - Remove the passing of the
tokenparameter when calling theGetUserInfomethod. - Replace the call to
XsollaAuth.Instace.OAuthLogoutwithXsollaAuth.Logoutand remove the passing of thetokenparameter when calling the method. - Remove the passing of the
deviceType,deviceId,deviceparameters when calling theAuthViaDeviceIDmethod. Remove the logic for determining mobile device information. - Change the signature of the
onSuccesscallback method used when calling theRegistermethod. ReplaceAction<int>, Action, Action<LoginUrlResponse>withAction<LoginLink>. - Remove the passing of the
rememberMeparameter when calling theSignInmethod. - Change the signature of the
onSuccesscallback method used when calling theStartAuthByEmailandStartAuthByPhoneNumbermethods. ReplaceAction<string>withAction<OperationId>.
XsollaCart class upgrade
- Replace
XsollaCart.Instancecalls withXsollaCart. - Replace the
XsollaCart.Instance.PurchaseCartcalls withXsollaCart.CreateOrder. - Remove the passing of the
projectIdparameter when calling class methods. - If you are only working with the current user’s cart, remove the passing of the
cartIdparameter when calling class methods.
XsollaOrders class upgrade
- Replace the
XsollaOrders.Instancecalls withXsollaOrders. - Change the code for calling the
OpenPurchaseUImethod. Pass the payment token as thepaymentTokenparameter (thepurhaseDataparameter has been replaced withpaymentToken). - Change the signature of the
onBrowserClosedcallback method used when calling theOpenPurchaseUImethod. ReplaceAction<bool>withAction<BrowserCloseInfo>. - Remove the passing of the
projectIdparameter when calling class methods.
XsollaUserAccount class upgrade
- Replace the
XsollaUserAccount.Instancecalls withXsollaUserAccount. - Remove the passing of the
tokenparameter when calling class methods.
XsollaSubscriptions class upgrade
- Replace the
XsollaSubscriptions.Instancecalls withXsollaSubscriptions. - Remove the passing of the
projectIdparameter when calling class methods.
XsollaInventory class upgrade
- Replace the
XsollaInventory.Instancecalls withXsollaInventory. - Remove the passing of the
projectIdparameter when calling class methods.
XsollaGameKeys class upgrade
- Replace the
XsollaGameKeys.Instancecalls withXsollaGameKeys. - Remove the passing of the
projectIdparameter when calling class methods.
Token class upgrade
- Replace the
Token.Instancecalls withXsollaToken. - Replace the
Token.Instance.GetSteamUserIDcalls withSteamUItils.GetSteamUserId. - Modify the code to get the value of the access and refresh tokens. Use the
XsollaToken.AccessTokenandXsollaToken.RefreshTokenproperties.
Upgrade utility classes
- Replace the use of the
AndroidSDKSocialAuthHelperandIosSDKSocialAuthHelperclasses with theXsollaAuth.AuthViaSocialNetworkcall. - Replace the use of the
AndroidSDKPaymentsHelperandIosSDKPaymentsHelperclasses with theXsollaWebBrowser.OpenPurchaseUIcall.
Package replacement
- Open your Unity project.
- Delete the
Xsollafolder. - Download the SDK or demo project package.
Note
If you use code snippets or a demo scene UI in your project, download the demo project package because it already contains the SDK files. If you included a demo project in your Unity project, you don’t need to integrate the SDK.
- Unzip the package.
- In the Unity Editor, go to
Assets > Import Package > Custom Package in the main menu and select the SDK or demo project package. - In the dependency warning window, click
Install/Upgrade . As a result, theImport Unity Package window opens with a list of files checked and ready for installation. The list will indicate which files remain unchanged, which will be added, and which will be replaced. - Click
Import . - Test your application and make changes to the project code if necessary.
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.