SDK for / Overview

XsollaStoreSubsystem.h

1// Copyright 2024 Xsolla Inc. All Rights Reserved.
2
3#pragma once
4
5#include "XsollaStoreDataModel.h"
6#include "XsollaUtilsHttpRequestHelper.h"
7#include "Blueprint/UserWidget.h"
8#include "Subsystems/GameInstanceSubsystem.h"
9#include "Subsystems/SubsystemCollection.h"
10#include "XsollaOrderCheckObject.h"
11#include "XsollaUtilsDataModel.h"
12#include "XsollaStoreDelegates.h"
13#include "XsollaStoreAuxiliaryDataModel.h"
14#include "XsollaStoreSubsystem.generated.h"
15
16
17enum class EXsollaPublishingPlatform : uint8;
18class FJsonObject;
21
22DECLARE_DYNAMIC_DELEGATE(FOnStoreUpdate);
23DECLARE_DYNAMIC_DELEGATE(FOnStoreSuccessPayment);
24DECLARE_DYNAMIC_DELEGATE(FOnStoreCancelPayment);
25DECLARE_DYNAMIC_DELEGATE(FOnStoreCartUpdate);
26DECLARE_DYNAMIC_DELEGATE_OneParam(FOnStoreBrowserClosed, bool, bIsManually);
27DECLARE_DYNAMIC_DELEGATE_OneParam(FOnCartUpdate, const FStoreCart&, Cart);
28DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnFetchTokenSuccess, const FString&, AccessToken, int32, OrderId);
29DECLARE_DYNAMIC_DELEGATE_ThreeParams(FOnCheckOrder, int32, OrderId, EXsollaOrderStatus, OrderStatus, FXsollaOrderContent, OrderContent);
30DECLARE_DYNAMIC_DELEGATE_OneParam(FOnCurrencyUpdate, const FVirtualCurrency&, Currency);
31DECLARE_DYNAMIC_DELEGATE_OneParam(FOnCurrencyPackageUpdate, const FVirtualCurrencyPackage&, CurrencyPackage);
32DECLARE_DYNAMIC_DELEGATE_OneParam(FOnPurchaseUpdate, int32, OrderId);
33DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetPromocodeRewardsUpdate, FStorePromocodeRewardData, RewardsData);
34DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSpecifiedBundleUpdate, FStoreBundle, Bundle);
35DECLARE_DYNAMIC_DELEGATE_OneParam(FOnPromocodeUpdate, const FStoreCart&, Cart);
36DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetItemsList, FStoreItemsList, ItemsList);
37DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetGamesListBySpecifiedGroup, FStoreGamesList, GamesList);
38DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGameUpdate, const FGameItem&, Game);
39DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGameKeyUpdate, const FGameKeyItem&, GameKey);
40DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetGameKeysListBySpecifiedGroup, FStoreGameKeysList, GameKeysList);
41DECLARE_DYNAMIC_DELEGATE_OneParam(FOnDRMListUpdate, FStoreDRMList, DRMList);
42DECLARE_DYNAMIC_DELEGATE_OneParam(FOnOwnedGamesListUpdate, FOwnedGamesList, GamesList);
43DECLARE_DYNAMIC_DELEGATE_OneParam(FOnStoreGamesUpdate, const FStoreGamesData&, GamesData);
44DECLARE_DYNAMIC_DELEGATE_OneParam(FOnItemGroupsUpdate, const FStoreItemGroupsData&, ItemGroupsData);
45DECLARE_DYNAMIC_DELEGATE(FOnRedeemGameCodeSuccess);
46DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionPublicPlansListUpdate, FSubscriptionPlansList, SubscriptionPlansList);
47DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionPlansListUpdate, FSubscriptionPlansList, SubscriptionPlansList);
48DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionsListUpdate, FSubscriptionsList, SubscriptionsList);
49DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSubscriptionDetailsSuccess, const FSubscriptionDetails&, SubscriptionDetails);
50DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSubscriptionPayStationLinkSuccess, const FString&, LinkToPaystation);
51DECLARE_DYNAMIC_DELEGATE(FOnCancelSubscriptionSuccess);
52
53UCLASS()
54class XSOLLASTORE_API UXsollaStoreSubsystem : public UGameInstanceSubsystem
55{
56GENERATED_BODY()
57
58public:
60
61// Begin USubsystem
62virtual void Initialize(FSubsystemCollectionBase& Collection) override;
63virtual void Deinitialize() override;
64// End USubsystem
65
71UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
72void Initialize(const FString& InProjectId);
73
86UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
87void GetPaginatedVirtualItems(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
88const FOnStoreItemsUpdate& SuccessCallback, const FOnError& ErrorCallback,
89const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
90
101UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
102void GetVirtualItems(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
103const FOnStoreItemsUpdate& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
104
112UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
113void GetItemGroups(const FString& PromoCode, const FOnItemGroupsUpdate& SuccessCallback, const FOnError& ErrorCallback);
114
126UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
127void GetPaginatedVirtualCurrencies(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
128const FOnVirtualCurrenciesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
129
139UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
140void GetVirtualCurrencies(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
141const FOnVirtualCurrenciesUpdate& SuccessCallback, const FOnError& ErrorCallback);
142
155UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
156void GetPaginatedVirtualCurrencyPackages(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
157const FOnVirtualCurrencyPackagesUpdate& SuccessCallback, const FOnError& ErrorCallback,
158const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
159
160
171UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
172void GetVirtualCurrencyPackages(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
173const FOnVirtualCurrencyPackagesUpdate& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
174
188UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualItems", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
189void GetPaginatedItemsListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
190const FOnGetItemsListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
191
203UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualItems", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
204void GetItemsListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
205const FOnGetItemsListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
206
215UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualItems", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
216void GetAllItemsList(const FString& Locale, const FOnGetItemsList& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
217
227UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback, PurchaseParams"))
228void FetchPaymentToken(const FString& AuthToken, const FString& ItemSKU,
229const FOnFetchTokenSuccess& SuccessCallback, const FOnError& ErrorCallback, const FXsollaPaymentTokenRequestPayload& PurchaseParams);
230
240UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback, PurchaseParams"))
241void FetchCartPaymentToken(const FString& AuthToken, const FString& CartId,
242const FOnFetchTokenSuccess& SuccessCallback, const FOnError& ErrorCallback, const FXsollaPaymentTokenRequestPayload& PurchaseParams);
243
258UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (WorldContext = "WorldContextObject", AutoCreateRefTerm = "SuccessCallback, ErrorCallback, BrowserClosedCallback"))
259void LaunchPaymentConsole(UObject* WorldContextObject, const int32 OrderId, const FString& AccessToken,
260const FOnStoreSuccessPayment& SuccessCallback, const FOnError& ErrorCallback, const FOnStoreBrowserClosed& BrowserClosedCallback,
261const EXsollaPayStationVersion PayStationVersion = EXsollaPayStationVersion::v4);
262
270UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
271void CheckOrder(const FString& AuthToken, const int32 OrderId,
272const FOnCheckOrder& SuccessCallback, const FOnError& ErrorCallback);
273
282UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
283void CheckPendingOrder(const FString& AccessToken, const int32 OrderId,
284const FOnStoreSuccessPayment& SuccessCallback, const FOnError& ErrorCallback, bool bIsUserInvolvedToPayment = false);
285
295UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
296void CreateOrderWithSpecifiedFreeItem(const FString& AuthToken, const FString& ItemSKU,
297const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback, const int32 Quantity = 1);
298
307UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
308void CreateOrderWithFreeCart(const FString& AuthToken, const FString& CartId,
309const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
310
319UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "PurchaseParams, SuccessCallback, ErrorCallback"))
320void PurchaseStoreItem(const FString& AuthToken, const FStoreItem& StoreItem, const FXsollaPaymentTokenRequestPayload& PurchaseParams,
321const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
322
331UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "PurchaseParams, SuccessCallback, ErrorCallback"))
332void PurchaseCurrencyPackage(const FString& AuthToken, const FVirtualCurrencyPackage& CurrencyPackage, const FXsollaPaymentTokenRequestPayload& PurchaseParams,
333const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
334
343UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
344void ClearCart(const FString& AuthToken, const FString& CartId,
345const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
346
357UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
358void GetCart(const FString& AuthToken, const FString& CartId, const FString& Currency, const FString& Locale,
359const FOnCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
360
371UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
372void UpdateItemInCart(const FString& AuthToken, const FString& CartId, const FString& ItemSKU, const int32 Quantity,
373const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
374
384UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
385void RemoveFromCart(const FString& AuthToken, const FString& CartId, const FString& ItemSKU,
386const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
387
397UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
398void FillCartById(const FString& AuthToken, const FString& CartId, const TArray<FStoreCartItem>& Items,
399const FOnCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
400
409UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Bundle", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
410void GetSpecifiedBundle(const FString& Sku, const FOnGetSpecifiedBundleUpdate& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
411
424UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Bundle", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
425void GetPaginatedBundles(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
426const FOnGetListOfBundlesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
427
428
439UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Bundle", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
440void GetBundles(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
441const FOnGetListOfBundlesUpdate& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
442
452UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
453void GetVirtualCurrency(const FString& CurrencySKU,
454const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
455const FOnCurrencyUpdate& SuccessCallback, const FOnError& ErrorCallback);
456
467UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
468void GetVirtualCurrencyPackage(const FString& PackageSKU,
469const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
470const FOnCurrencyPackageUpdate& SuccessCallback, const FOnError& ErrorCallback);
471
483UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
484void BuyItemWithVirtualCurrency(const FString& AuthToken, const FString& ItemSKU, const FString& CurrencySKU,
485const EXsollaPublishingPlatform Platform, const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
486
495UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
496void GetPromocodeRewards(const FString& AuthToken, const FString& PromocodeCode,
497const FOnGetPromocodeRewardsUpdate& SuccessCallback, const FOnError& ErrorCallback);
498
508UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
509void RedeemPromocode(const FString& AuthToken, const FString& PromocodeCode, const FString& CartId,
510const FOnPromocodeUpdate& SuccessCallback, const FOnError& ErrorCallback);
511
520UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
521void RemovePromocodeFromCart(const FString& AuthToken, const FString& CartId,
522const FOnPromocodeUpdate& SuccessCallback, const FOnError& ErrorCallback);
523
534UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys" , meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
535void GetGamesList(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
536const FOnStoreGamesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
537
549UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
550void GetGamesListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
551const FOnGetGamesListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
552
562UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
563void GetGameItem(const FString& GameSKU, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
564const FOnGameUpdate& SuccessCallback, const FOnError& ErrorCallback);
565
576UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
577void GetGameKeyItem(const FString& ItemSKU, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
578const FOnGameKeyUpdate& SuccessCallback, const FOnError& ErrorCallback);
579
591UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
592void GetGameKeysListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
593const FOnGetGameKeysListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
594
600UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
601void GetDRMList(const FOnDRMListUpdate& SuccessCallback, const FOnError& ErrorCallback);
602
614UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
615void GetOwnedGames(const FString& AuthToken, const TArray<FString>& AdditionalFields,
616const FOnOwnedGamesListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const bool bIsSandbox = false);
617
625UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
626void RedeemGameCodeByClient(const FString& AuthToken, const FString& Code,
627const FOnRedeemGameCodeSuccess& SuccessCallback, const FOnError& ErrorCallback);
628
642UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "PlanId, PlanExternalId, SuccessCallback, ErrorCallback"))
643void GetSubscriptionPublicPlans(const TArray<int> PlanId, const TArray<FString>& PlanExternalId, const FString& Country, const FString& Locale,
644const FOnSubscriptionPublicPlansListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
645
660UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "PlanId, PlanExternalId, SuccessCallback, ErrorCallback"))
661void GetSubscriptionPlans(const FString& AuthToken, const TArray<int> PlanId, const TArray<FString>& PlanExternalId, const FString& Country, const FString& Locale,
662const FOnSubscriptionPlansListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
663
675UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
676void GetSubscriptions(const FString& AuthToken, const FString& Locale,
677const FOnSubscriptionsListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
678
689UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
690void GetSubscriptionDetails(const FString& AuthToken, const int32 SubscriptionId, const FString& Locale,
691const FOnGetSubscriptionDetailsSuccess& SuccessCallback, const FOnError& ErrorCallback);
692
702UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
703void GetSubscriptionPurchaseUrl(const FString& AuthToken, const FString& PlanExternalId, const FString& Country,
704const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
705
714UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
715void GetSubscriptionManagementUrl(const FString& AuthToken, const FString& Country,
716const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
717
726UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
727void GetSubscriptionRenewalUrl(const FString& AuthToken, const int32 SubscriptionId,
728const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
729
738UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
739void CancelSubscription(const FString& AuthToken, const int32 SubscriptionId,
740const FOnCancelSubscriptionSuccess& SuccessCallback, const FOnError& ErrorCallback);
741
746UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Xsolla|Store|Utils", meta = (WorldContext = "WorldContextObject"))
747static bool IsCustomTabsBrowserAvailable(UObject* WorldContextObject);
748
749protected:
750void GetVirtualItems_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
751const bool bSucceeded, FOnStoreItemsUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
752void GetItemGroups_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
753const bool bSucceeded, FOnItemGroupsUpdate SuccessCallback, FOnError ErrorCallback);
754void GetVirtualCurrencies_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
755const bool bSucceeded, FOnVirtualCurrenciesUpdate SuccessCallback, FOnError ErrorCallback);
756void GetVirtualCurrencyPackages_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
757const bool bSucceeded, FOnVirtualCurrencyPackagesUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
758void GetItemsListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
759const bool bSucceeded, FOnGetItemsListBySpecifiedGroup SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
760void GetAllItemsList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
761const bool bSucceeded, FOnGetItemsList SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
762
763void FetchPaymentToken_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
764const bool bSucceeded, FOnFetchTokenSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
765void CheckOrder_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
766const bool bSucceeded, FOnCheckOrder SuccessCallback, FOnError ErrorCallback);
767
768void CreateOrderWithSpecifiedFreeItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
769const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
770void CreateOrderWithFreeCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
771const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
772
773void ClearCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
774const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
775void GetCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
776const bool bSucceeded, FOnCartUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
777void UpdateItemInCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
778const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
779void RemoveFromCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
780const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
781void FillCartById_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
782const bool bSucceeded, FOnCartUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
783
784void GetListOfBundles_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
785const bool bSucceeded, FOnGetListOfBundlesUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
786void GetSpecifiedBundle_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
787const bool bSucceeded, FOnGetSpecifiedBundleUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
788
789void GetVirtualCurrency_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
790const bool bSucceeded, FOnCurrencyUpdate SuccessCallback, FOnError ErrorCallback);
791void GetVirtualCurrencyPackage_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
792const bool bSucceeded, FOnCurrencyPackageUpdate SuccessCallback, FOnError ErrorCallback);
793
794void BuyItemWithVirtualCurrency_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
795const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
796
797void GetPromocodeRewards_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
798const bool bSucceeded, FOnGetPromocodeRewardsUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
799void RedeemPromocode_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
800const bool bSucceeded, FOnPromocodeUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
801void RemovePromocodeFromCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
802const bool bSucceeded, FOnPromocodeUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
803
804void GetGamesList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
805const bool bSucceeded, FOnStoreGamesUpdate SuccessCallback, FOnError ErrorCallback);
806
807void GetGamesListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
808const bool bSucceeded, FOnGetGamesListBySpecifiedGroup SuccessCallback, FOnError ErrorCallback);
809
810void GetGameItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
811const bool bSucceeded, FOnGameUpdate SuccessCallback, FOnError ErrorCallback);
812
813void GetGameKeyItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
814const bool bSucceeded, FOnGameKeyUpdate SuccessCallback, FOnError ErrorCallback);
815
816void GetGameKeysListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
817const bool bSucceeded, FOnGetGameKeysListBySpecifiedGroup SuccessCallback, FOnError ErrorCallback);
818
819void GetDRMList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
820const bool bSucceeded, FOnDRMListUpdate SuccessCallback, FOnError ErrorCallback);
821
822void GetOwnedGames_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
823const bool bSucceeded, FOnOwnedGamesListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
824
825void RedeemGameCodeByClient_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
826const bool bSucceeded, FOnRedeemGameCodeSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
827
828void GetSubscriptionPublicPlans_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
829const bool bSucceeded, FOnSubscriptionPublicPlansListUpdate SuccessCallback, FOnError ErrorCallback);
830
831void GetSubscriptionPlans_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
832const bool bSucceeded, FOnSubscriptionPlansListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
833
834void GetSubscriptions_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
835const bool bSucceeded, FOnSubscriptionsListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
836
837void GetSubscriptionDetails_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
838const bool bSucceeded, FOnGetSubscriptionDetailsSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
839
840void GetSubscriptionPaystationLink_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
841const bool bSucceeded, FOnGetSubscriptionPayStationLinkSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
842
843void CancelSubscription_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
844const bool bSucceeded, FOnCancelSubscriptionSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
845
847void HandleRequestError(XsollaHttpRequestError ErrorData, FOnError ErrorCallback);
848
849void HandlePurchaseFreeItemsRequest(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
850const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
851
852protected:
854bool IsSandboxEnabled() const;
855
856void InnerPurchase(const FString& AuthToken, const FString& Sku, bool bIsFree, const TArray<FXsollaVirtualCurrencyPrice>& VirtualPrices,
857const FXsollaPaymentTokenRequestPayload PaymentTokenRequestPayload, const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
858
859UFUNCTION()
860void FetchTokenCallback(const FString& AccessToken, int32 InOrderId);
861
862UFUNCTION()
863void BuyVirtualOrFreeItemCallback(int32 InOrderId);
864
865UFUNCTION()
866void CheckPendingOrderSuccessCallback();
867
868// virtual items
869UFUNCTION()
870void GetVirtualItemsCallback(const FStoreItemsData& InItemsData);
871
872UFUNCTION()
873void GetVirtualItemsError(int32 StatusCode, int32 ErrorCode, const FString& ErrorMessage);
874
875void CallGetVirtualItems();
876
877// virtual currencies
878UFUNCTION()
879void GetVirtualCurrenciesCallback(const FVirtualCurrencyData& InCurrenciesData);
880
881UFUNCTION()
882void GetVirtualCurrenciesError(int32 StatusCode, int32 ErrorCode, const FString& ErrorMessage);
883
884void CallGetVirtualCurrencies();
885
886// virtual currency packages
887UFUNCTION()
888void GetVirtualCurrencyPackagesCallback(const FVirtualCurrencyPackagesData& InPackagesData);
889
890UFUNCTION()
891void GetVirtualCurrencyPackagesError(int32 StatusCode, int32 ErrorCode, const FString& ErrorMessage);
892
893void CallGetVirtualCurrencyPackages();
894
895// items by specified group
896UFUNCTION()
897void GetAllItemsListBySpecifiedGroupCallback(const FStoreItemsList& InItemsList);
898
899UFUNCTION()
900void GetAllItemsListBySpecifiedGroupError(int32 StatusCode, int32 ErrorCode, const FString& ErrorMessage);
901
902void CallGetAllItemsListBySpecifiedGroup();
903
904// bundles
905UFUNCTION()
906void GetBundlesCallback(const FStoreListOfBundles& InBundlesData);
907
908UFUNCTION()
909void GetBundlesError(int32 StatusCode, int32 ErrorCode, const FString& ErrorMessage);
910
911void CallGetBundles();
912
913private:
915TSharedRef<IHttpRequest, ESPMode::ThreadSafe> CreateHttpRequest(const FString& Url, const EXsollaHttpRequestVerb Verb = EXsollaHttpRequestVerb::VERB_GET,
916const FString& AuthToken = FString(), const FString& Content = FString());
917
919FString SerializeJson(const TSharedPtr<FJsonObject> DataJson) const;
920
922TSharedPtr<FJsonObject> PreparePaymentTokenRequestPayload(const FXsollaPaymentTokenRequestPayload& PaymentTokenRequestPayload);
923
925TSharedPtr<FJsonObject> PreparePaystationSettings(const bool bAddAdditionalParameters = false, const bool bDisableSdkParameter = false, const bool bShowCloseButton = false, const FString& CloseButtonIcon = TEXT("cross"), const bool bGpQuickPaymentButton = false);
926
928bool GetSteamUserId(const FString& AuthToken, FString& SteamId, FString& OutError);
929
930FString GetPayStationVersionPath(const EXsollaPayStationVersion PayStationVersion) const;
931
932FString GetTokenQueryParameterName(const EXsollaPayStationVersion PayStationVersion) const;
933
934FString GetBrowserType() const;
935
936FString GetBuildPlatform() const;
937
938public:
940UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
941static TArray<FStoreItem> GetVirtualItemsWithoutGroup(const FStoreItemsData& StoreItemsData);
942
944UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
945const FString& GetPendingPaystationUrl() const;
946
948UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
949static FString GetItemName(const FStoreItemsData& StoreItemsData, const FString& ItemSKU);
950
952UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
953static const FStoreItem& FindItemBySku(const FStoreItemsData& StoreItemsData, const FString& ItemSku, bool& bHasFound);
954
956UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
957static const FVirtualCurrencyPackage& FindVirtualCurrencyPackageBySku(const FVirtualCurrencyPackagesData& VirtualCurrencyPackagesData,
958const FString& ItemSku, bool& bHasFound);
959
961UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart")
962static bool IsItemInCart(const FStoreCart& Cart, const FString& ItemSKU);
963
964protected:
966FString ProjectID;
967
969FString CachedAuthToken;
970
972FXsollaPaymentTokenRequestPayload CachedPaymentTokenRequestPayload;
973
975FString PendingPaystationUrl;
976
978
979private:
980UPROPERTY()
981TSubclassOf<UXsollaStoreBrowserWrapper> DefaultBrowserWidgetClass;
982
983UPROPERTY()
984TArray<UXsollaOrderCheckObject*> CachedOrderCheckObjects;
985
986UPROPERTY()
987UXsollaLoginSubsystem* LoginSubsystem;
988
989UPROPERTY()
990FString PaymentAccessToken;
991
992UPROPERTY()
993FString PaymentRedirectURI;
994
995UPROPERTY()
996bool PaymentEnableSandbox;
997
998UPROPERTY()
999int32 PaymentOrderId;
1000
1001UPROPERTY()
1002int32 PaymentPayStationVersionNumber;
1003
1004UPROPERTY()
1005FOnPurchaseUpdate PaymentSuccessCallback;
1006
1007UPROPERTY()
1008FOnError PaymentErrorCallback;
1009
1010UPROPERTY()
1011FOnStoreBrowserClosed PaymentBrowserClosedCallback;
1012
1013UPROPERTY(Transient)
1014FGetAllVirtualItemsParams GetAllVirtualItemsParams;
1015
1016UPROPERTY(Transient)
1017FGetAllVirtualCurrenciesParams GetAllVirtualCurrenciesParams;
1018
1019UPROPERTY(Transient)
1020FGetAllVirtualCurrencyPackagesParams GetAllVirtualCurrencyPackagesParams;
1021
1022UPROPERTY(Transient)
1023FGetAllItemsListBySpecifiedGroupParams GetAllItemsListBySpecifiedGroupParams;
1024
1025UPROPERTY(Transient)
1026FGetAllBundlesParams GetAllBundlesParams;
1027};
Definition: XsollaLoginSubsystem.h:49
Definition: XsollaOrderCheckObject.h:21
Definition: XsollaStoreBrowserWrapper.h:16
Definition: XsollaStoreSubsystem.h:55
Definition: XsollaStoreAuxiliaryDataModel.h:347
Definition: XsollaStoreAuxiliaryDataModel.h:258
Definition: XsollaStoreAuxiliaryDataModel.h:95
Definition: XsollaStoreAuxiliaryDataModel.h:174
Definition: XsollaStoreAuxiliaryDataModel.h:11
Definition: XsollaStoreDataModel.h:550
Definition: XsollaStoreDataModel.h:465
Definition: XsollaStoreDataModel.h:116
Definition: XsollaStoreDataModel.h:248
Definition: XsollaStoreDataModel.h:236
Definition: XsollaStoreDataModel.h:658
Definition: XsollaStoreDataModel.h:338
Definition: XsollaStoreDataModel.h:386
Definition: XsollaStoreDataModel.h:449