public void ConsumeInventoryItem(string projectId, ConsumeItem item, [CanBeNull] Action onSuccess, [CanBeNull] Action <Error> onError)
        {
            var urlBuilder = new StringBuilder(string.Format(URL_INVENTORY_ITEM_CONSUME, projectId)).Append(AdditionalUrlParams);

            var headers = new List <WebRequestHeader>()
            {
                WebRequestHeader.AuthHeader(Token), WebRequestHeader.ContentTypeHeader()
            };

            WebRequestHelper.Instance.PostRequest(urlBuilder.ToString(), item, headers, onSuccess, onError, Error.ConsumeItemErrors);
        }
Exemple #2
0
        /// <summary>
        /// Consumes item from inventory.
        /// </summary>
        /// <remarks> Swagger method name:<c>Consume item</c>.</remarks>
        /// <see cref="https://developers.xsolla.com/store-api/inventory-client/consume-item"/>
        /// <param name="projectId">Project ID from your Publisher Account.</param>
        /// <param name="item">Contains consume parameters.</param>
        /// <param name="onSuccess">Successful operation callback.</param>
        /// <param name="onError">Failed operation callback.</param>
        public void ConsumeInventoryItem(string projectId, ConsumeItem item, [CanBeNull] Action onSuccess, [CanBeNull] Action <Error> onError)
        {
            var url           = string.Format(URL_INVENTORY_ITEM_CONSUME, projectId);
            var platformParam = GetPlatformUrlParam();

            url = ConcatUrlAndParams(url, platformParam);

            var headers = new List <WebRequestHeader>()
            {
                WebRequestHeader.AuthHeader(Token.Instance), WebRequestHeader.ContentTypeHeader()
            };

            WebRequestHelper.Instance.PostRequest(SdkType.Store, url, item, headers, onSuccess, onError, Error.ConsumeItemErrors);
        }