private void FillSettings(AccessDataEntity accessData, uint projectId, string transactionId) { accessData.settings = new AccessDataEntity.Settings { project_id = projectId, currency = "USD", mode = XsollaSettings.IsSandbox ? "sandbox" : null, external_id = transactionId, xsolla_product_tag = PaymentsHelper.GetAdditionalInformation("simplified"), ui = new AccessDataEntity.Settings.UI { size = "medium", theme = PaystationThemeHelper.ConvertToSettings(XsollaSettings.PaystationTheme) } }; }
/// <summary> /// Executes a CloudScript function. /// This cloud script allows to open purchase url with one item. /// </summary> /// <see cref="https://docs.microsoft.com/ru-ru/rest/api/playfab/client/server-side-cloud-script/executecloudscript?view=playfab-rest"/> /// <param name="itemId">Unique identifier of the item to purchase.</param> /// <param name="orderId">Purchase order identifier.</param> /// <param name="onSuccess">Success operation callback.</param> /// <param name="onError">Failed operation callback.</param> private void ExecuteCloudScript(string itemId, string orderId, [NotNull] Action <CloudScriptResultEntity> onSuccess, [CanBeNull] Action <Error> onError = null) { var url = PlayfabApi.GetFormattedUrl(URL_CLOUD_SCRIPT); var headers = new List <WebRequestHeader> { PlayfabApi.Instance.GetAuthHeader() }; WebRequestHelper.Instance.PostRequest(url, new CloudScriptRequestEntity { FunctionName = CLOUD_SCRIPT_DEMO_METHOD, FunctionParameter = new CloudScriptRequestEntity.CloudScriptArgs { sku = itemId, amount = ITEMS_QUANTITY_FOR_CLOUD_SCRIPT, orderId = orderId, sdkTag = PaymentsHelper.GetAdditionalInformation("playfab"), theme = PaystationThemeHelper.ConvertToSettings(XsollaSettings.PaystationTheme), sandbox = XsollaSettings.IsSandbox } }, headers, (CloudScriptResponseEntity response) => onSuccess?.Invoke(response.data), onError); }