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 "XsollaStoreSubsystem.generated.h"
13
14
15enum class EXsollaPublishingPlatform : uint8;
16class FJsonObject;
19
20DECLARE_DYNAMIC_DELEGATE(FOnStoreUpdate);
21DECLARE_DYNAMIC_DELEGATE(FOnStoreSuccessPayment);
22DECLARE_DYNAMIC_DELEGATE(FOnStoreCancelPayment);
23DECLARE_DYNAMIC_DELEGATE(FOnStoreCartUpdate);
24DECLARE_DYNAMIC_DELEGATE_OneParam(FOnStoreBrowserClosed, bool, bIsManually);
25DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnCartUpdate, const FStoreCart&, Cart);
26DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnFetchTokenSuccess, const FString&, AccessToken, int32, OrderId);
27DECLARE_DYNAMIC_DELEGATE_ThreeParams(FOnCheckOrder, int32, OrderId, EXsollaOrderStatus, OrderStatus, FXsollaOrderContent, OrderContent);
28DECLARE_DYNAMIC_DELEGATE_OneParam(FOnCurrencyUpdate, const FVirtualCurrency&, Currency);
29DECLARE_DYNAMIC_DELEGATE_OneParam(FOnCurrencyPackageUpdate, const FVirtualCurrencyPackage&, CurrencyPackage);
30DECLARE_DYNAMIC_DELEGATE_OneParam(FOnPurchaseUpdate, int32, OrderId);
31DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetPromocodeRewardsUpdate, FStorePromocodeRewardData, RewardsData);
32DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetListOfBundlesUpdate, FStoreListOfBundles, ListOfBundles);
33DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSpecifiedBundleUpdate, FStoreBundle, Bundle);
34DECLARE_DYNAMIC_DELEGATE(FOnPromocodeUpdate);
35DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetItemsListBySpecifiedGroup, FStoreItemsList, ItemsList);
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(FOnVirtualCurrenciesUpdate, const FVirtualCurrencyData&, VirtualCurrencyData);
44DECLARE_DYNAMIC_DELEGATE_OneParam(FOnStoreGamesUpdate, const FStoreGamesData&, GamesData);
45DECLARE_DYNAMIC_DELEGATE_OneParam(FOnStoreItemsUpdate, const FStoreItemsData&, ItemsData);
46DECLARE_DYNAMIC_DELEGATE_OneParam(FOnVirtualCurrencyPackagesUpdate, const FVirtualCurrencyPackagesData&, Data);
47DECLARE_DYNAMIC_DELEGATE_OneParam(FOnItemGroupsUpdate, const TArray<FXsollaItemGroup>&, ItemGroups);
48DECLARE_DYNAMIC_DELEGATE(FOnRedeemGameCodeSuccess);
49DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionPublicPlansListUpdate, FSubscriptionPlansList, SubscriptionPlansList);
50DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionPlansListUpdate, FSubscriptionPlansList, SubscriptionPlansList);
51DECLARE_DYNAMIC_DELEGATE_OneParam(FOnSubscriptionsListUpdate, FSubscriptionsList, SubscriptionsList);
52DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSubscriptionDetailsSuccess, const FSubscriptionDetails&, SubscriptionDetails);
53DECLARE_DYNAMIC_DELEGATE_OneParam(FOnGetSubscriptionPayStationLinkSuccess, const FString&, LinkToPaystation);
54DECLARE_DYNAMIC_DELEGATE(FOnCancelSubscriptionSuccess);
55
56UCLASS()
57class XSOLLASTORE_API UXsollaStoreSubsystem : public UGameInstanceSubsystem
58{
59GENERATED_BODY()
60
61public:
63
64// Begin USubsystem
65virtual void Initialize(FSubsystemCollectionBase& Collection) override;
66virtual void Deinitialize() override;
67// End USubsystem
68
74UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
75void Initialize(const FString& InProjectId);
76
91UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
92void GetVirtualItems(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
93const FOnStoreItemsUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
94
106UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
107void GetItemGroups(const FString& Locale,
108const FOnItemGroupsUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
109
123UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
124void GetVirtualCurrencies(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
125const FOnVirtualCurrenciesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
126
141UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
142void GetVirtualCurrencyPackages(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
143const FOnVirtualCurrencyPackagesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
144
160UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualItems", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
161void GetItemsListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
162const FOnGetItemsListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
163
174UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualItems", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
175void GetAllItemsList(const FString& Locale, const FOnGetItemsList& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
176
186UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback, PurchaseParams"))
187void FetchPaymentToken(const FString& AuthToken, const FString& ItemSKU,
188const FOnFetchTokenSuccess& SuccessCallback, const FOnError& ErrorCallback, const FXsollaPaymentTokenRequestPayload& PurchaseParams);
189
199UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback, PurchaseParams"))
200void FetchCartPaymentToken(const FString& AuthToken, const FString& CartId,
201const FOnFetchTokenSuccess& SuccessCallback, const FOnError& ErrorCallback, const FXsollaPaymentTokenRequestPayload& PurchaseParams);
202
217UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (WorldContext = "WorldContextObject", AutoCreateRefTerm = "SuccessCallback, ErrorCallback, BrowserClosedCallback"))
218void LaunchPaymentConsole(UObject* WorldContextObject, const int32 OrderId, const FString& AccessToken,
219const FOnStoreSuccessPayment& SuccessCallback, const FOnError& ErrorCallback, const FOnStoreBrowserClosed& BrowserClosedCallback,
220const EXsollaPayStationVersion PayStationVersion = EXsollaPayStationVersion::v4);
221
229UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
230void CheckOrder(const FString& AuthToken, const int32 OrderId,
231const FOnCheckOrder& SuccessCallback, const FOnError& ErrorCallback);
232
241UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
242void CheckPendingOrder(const FString& AccessToken, const int32 OrderId,
243const FOnStoreSuccessPayment& SuccessCallback, const FOnError& ErrorCallback, bool bIsUserInvolvedToPayment = false);
244
254UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
255void CreateOrderWithSpecifiedFreeItem(const FString& AuthToken, const FString& ItemSKU,
256const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback, const int32 Quantity = 1);
257
266UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
267void CreateOrderWithFreeCart(const FString& AuthToken, const FString& CartId,
268const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
269
278UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "PurchaseParams, SuccessCallback, ErrorCallback"))
279void PurchaseStoreItem(const FString& AuthToken, const FStoreItem& StoreItem, const FXsollaPaymentTokenRequestPayload& PurchaseParams,
280const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
281
290UFUNCTION(BlueprintCallable, Category = "Xsolla|Store", meta = (AutoCreateRefTerm = "PurchaseParams, SuccessCallback, ErrorCallback"))
291void PurchaseCurrencyPackage(const FString& AuthToken, const FVirtualCurrencyPackage& CurrencyPackage, const FXsollaPaymentTokenRequestPayload& PurchaseParams,
292const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
293
302UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
303void ClearCart(const FString& AuthToken, const FString& CartId,
304const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
305
317UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
318void UpdateCart(const FString& AuthToken, const FString& CartId,
319const FString& Currency, const FString& Locale,
320const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
321
332UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
333void UpdateItemInCart(const FString& AuthToken, const FString& CartId, const FString& ItemSKU, const int32 Quantity,
334const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
335
345UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
346void RemoveFromCart(const FString& AuthToken, const FString& CartId, const FString& ItemSKU,
347const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
348
358UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
359void FillCartById(const FString& AuthToken, const FString& CartId, const TArray<FStoreCartItem>& Items,
360const FOnStoreCartUpdate& SuccessCallback, const FOnError& ErrorCallback);
361
370UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Bundle", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
371void GetSpecifiedBundle(const FString& Sku, const FOnGetSpecifiedBundleUpdate& SuccessCallback, const FOnError& ErrorCallback, const FString& AuthToken = TEXT(""));
372
386UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Bundle", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
387void GetBundles(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
388const FOnGetListOfBundlesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const FString& AuthToken = TEXT(""));
389
401UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
402void GetVirtualCurrency(const FString& CurrencySKU,
403const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
404const FOnCurrencyUpdate& SuccessCallback, const FOnError& ErrorCallback);
405
418UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
419void GetVirtualCurrencyPackage(const FString& PackageSKU,
420const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
421const FOnCurrencyPackageUpdate& SuccessCallback, const FOnError& ErrorCallback);
422
434UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|VirtualCurrency", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
435void BuyItemWithVirtualCurrency(const FString& AuthToken, const FString& ItemSKU, const FString& CurrencySKU,
436const EXsollaPublishingPlatform Platform, const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
437
446UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
447void GetPromocodeRewards(const FString& AuthToken, const FString& PromocodeCode,
448const FOnGetPromocodeRewardsUpdate& SuccessCallback, const FOnError& ErrorCallback);
449
458UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
459void RedeemPromocode(const FString& AuthToken, const FString& PromocodeCode,
460const FOnPromocodeUpdate& SuccessCallback, const FOnError& ErrorCallback);
461
469UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Promocode", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
470void RemovePromocodeFromCart(const FString& AuthToken,
471const FOnPromocodeUpdate& SuccessCallback, const FOnError& ErrorCallback);
472
484UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys" , meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
485void GetGamesList(const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
486const FOnStoreGamesUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
487
500UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
501void GetGamesListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
502const FOnGetGamesListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
503
513UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
514void GetGameItem(const FString& GameSKU, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
515const FOnGameUpdate& SuccessCallback, const FOnError& ErrorCallback);
516
527UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
528void GetGameKeyItem(const FString& ItemSKU, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
529const FOnGameKeyUpdate& SuccessCallback, const FOnError& ErrorCallback);
530
543UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
544void GetGameKeysListBySpecifiedGroup(const FString& ExternalId, const FString& Locale, const FString& Country, const TArray<FString>& AdditionalFields,
545const FOnGetGameKeysListBySpecifiedGroup& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
546
552UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
553void GetDRMList(const FOnDRMListUpdate& SuccessCallback, const FOnError& ErrorCallback);
554
566UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "AdditionalFields, SuccessCallback, ErrorCallback"))
567void GetOwnedGames(const FString& AuthToken, const TArray<FString>& AdditionalFields,
568const FOnOwnedGamesListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0, const bool bIsSandbox = false);
569
577UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|GameKeys", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
578void RedeemGameCodeByClient(const FString& AuthToken, const FString& Code,
579const FOnRedeemGameCodeSuccess& SuccessCallback, const FOnError& ErrorCallback);
580
594UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "PlanId, PlanExternalId, SuccessCallback, ErrorCallback"))
595void GetSubscriptionPublicPlans(const TArray<int> PlanId, const TArray<FString>& PlanExternalId, const FString& Country, const FString& Locale,
596const FOnSubscriptionPublicPlansListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
597
612UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "PlanId, PlanExternalId, SuccessCallback, ErrorCallback"))
613void GetSubscriptionPlans(const FString& AuthToken, const TArray<int> PlanId, const TArray<FString>& PlanExternalId, const FString& Country, const FString& Locale,
614const FOnSubscriptionPlansListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
615
627UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
628void GetSubscriptions(const FString& AuthToken, const FString& Locale,
629const FOnSubscriptionsListUpdate& SuccessCallback, const FOnError& ErrorCallback, const int Limit = 50, const int Offset = 0);
630
641UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
642void GetSubscriptionDetails(const FString& AuthToken, const int32 SubscriptionId, const FString& Locale,
643const FOnGetSubscriptionDetailsSuccess& SuccessCallback, const FOnError& ErrorCallback);
644
654UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
655void GetSubscriptionPurchaseUrl(const FString& AuthToken, const FString& PlanExternalId, const FString& Country,
656const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
657
666UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
667void GetSubscriptionManagementUrl(const FString& AuthToken, const FString& Country,
668const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
669
678UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
679void GetSubscriptionRenewalUrl(const FString& AuthToken, const int32 SubscriptionId,
680const FOnGetSubscriptionPayStationLinkSuccess& SuccessCallback, const FOnError& ErrorCallback);
681
690UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Subscriptions", meta = (AutoCreateRefTerm = "SuccessCallback, ErrorCallback"))
691void CancelSubscription(const FString& AuthToken, const int32 SubscriptionId,
692const FOnCancelSubscriptionSuccess& SuccessCallback, const FOnError& ErrorCallback);
693
698UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Xsolla|Store|Utils", meta = (WorldContext = "WorldContextObject"))
699static bool IsCustomTabsBrowserAvailable(UObject* WorldContextObject);
700
701protected:
702void GetVirtualItems_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
703const bool bSucceeded, FOnStoreItemsUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
704void GetItemGroups_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
705const bool bSucceeded, FOnItemGroupsUpdate SuccessCallback, FOnError ErrorCallback);
706void GetVirtualCurrencies_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
707const bool bSucceeded, FOnVirtualCurrenciesUpdate SuccessCallback, FOnError ErrorCallback);
708void GetVirtualCurrencyPackages_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
709const bool bSucceeded, FOnVirtualCurrencyPackagesUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
710void GetItemsListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
711const bool bSucceeded, FOnGetItemsListBySpecifiedGroup SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
712void GetAllItemsList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
713const bool bSucceeded, FOnGetItemsList SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
714
715void FetchPaymentToken_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
716const bool bSucceeded, FOnFetchTokenSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
717void CheckOrder_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
718const bool bSucceeded, FOnCheckOrder SuccessCallback, FOnError ErrorCallback);
719
720void CreateOrderWithSpecifiedFreeItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
721const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
722void CreateOrderWithFreeCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
723const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
724
725void CreateCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
726const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
727void ClearCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
728const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
729void UpdateCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
730const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
731void AddToCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
732const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
733void RemoveFromCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
734const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FOnError ErrorCallback);
735void FillCartById_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
736const bool bSucceeded, FOnStoreCartUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
737
738void GetListOfBundles_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
739const bool bSucceeded, FOnGetListOfBundlesUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
740void GetSpecifiedBundle_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
741const bool bSucceeded, FOnGetSpecifiedBundleUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
742
743void GetVirtualCurrency_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
744const bool bSucceeded, FOnCurrencyUpdate SuccessCallback, FOnError ErrorCallback);
745void GetVirtualCurrencyPackage_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
746const bool bSucceeded, FOnCurrencyPackageUpdate SuccessCallback, FOnError ErrorCallback);
747
748void BuyItemWithVirtualCurrency_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
749const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
750
751void GetPromocodeRewards_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
752const bool bSucceeded, FOnGetPromocodeRewardsUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
753void RedeemPromocode_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
754const bool bSucceeded, FOnPromocodeUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
755void RemovePromocodeFromCart_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
756const bool bSucceeded, FOnPromocodeUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
757
758void GetGamesList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
759const bool bSucceeded, FOnStoreGamesUpdate SuccessCallback, FOnError ErrorCallback);
760
761void GetGamesListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
762const bool bSucceeded, FOnGetGamesListBySpecifiedGroup SuccessCallback, FOnError ErrorCallback);
763
764void GetGameItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
765const bool bSucceeded, FOnGameUpdate SuccessCallback, FOnError ErrorCallback);
766
767void GetGameKeyItem_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
768const bool bSucceeded, FOnGameKeyUpdate SuccessCallback, FOnError ErrorCallback);
769
770void GetGameKeysListBySpecifiedGroup_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
771const bool bSucceeded, FOnGetGameKeysListBySpecifiedGroup SuccessCallback, FOnError ErrorCallback);
772
773void GetDRMList_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
774const bool bSucceeded, FOnDRMListUpdate SuccessCallback, FOnError ErrorCallback);
775
776void GetOwnedGames_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
777const bool bSucceeded, FOnOwnedGamesListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
778
779void RedeemGameCodeByClient_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
780const bool bSucceeded, FOnRedeemGameCodeSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
781
782void GetSubscriptionPublicPlans_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
783const bool bSucceeded, FOnSubscriptionPublicPlansListUpdate SuccessCallback, FOnError ErrorCallback);
784
785void GetSubscriptionPlans_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
786const bool bSucceeded, FOnSubscriptionPlansListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
787
788void GetSubscriptions_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
789const bool bSucceeded, FOnSubscriptionsListUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
790
791void GetSubscriptionDetails_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
792const bool bSucceeded, FOnGetSubscriptionDetailsSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
793
794void GetSubscriptionPaystationLink_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
795const bool bSucceeded, FOnGetSubscriptionPayStationLinkSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
796
797void CancelSubscription_HttpRequestComplete(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
798const bool bSucceeded, FOnCancelSubscriptionSuccess SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
799
801void HandleRequestError(XsollaHttpRequestError ErrorData, FOnError ErrorCallback);
802
803void HandlePurchaseFreeItemsRequest(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
804const bool bSucceeded, FOnPurchaseUpdate SuccessCallback, FErrorHandlersWrapper ErrorHandlersWrapper);
805
806protected:
808void LoadData();
809
811void SaveData();
812
814bool IsSandboxEnabled() const;
815
816void InnerPurchase(const FString& AuthToken, const FString& Sku, bool bIsFree, const TArray<FXsollaVirtualCurrencyPrice>& VirtualPrices,
817const FXsollaPaymentTokenRequestPayload PaymentTokenRequestPayload, const FOnPurchaseUpdate& SuccessCallback, const FOnError& ErrorCallback);
818
819UFUNCTION()
820void FetchTokenCallback(const FString& AccessToken, int32 InOrderId);
821
822UFUNCTION()
823void BuyVirtualOrFreeItemCallback(int32 InOrderId);
824
825UFUNCTION()
826void CheckPendingOrderSuccessCallback();
827
828private:
830TSharedRef<IHttpRequest, ESPMode::ThreadSafe> CreateHttpRequest(const FString& Url, const EXsollaHttpRequestVerb Verb = EXsollaHttpRequestVerb::VERB_GET,
831const FString& AuthToken = FString(), const FString& Content = FString());
832
834FString SerializeJson(const TSharedPtr<FJsonObject> DataJson) const;
835
837void ProcessNextCartRequest();
838
840TSharedPtr<FJsonObject> PreparePaymentTokenRequestPayload(const FXsollaPaymentTokenRequestPayload& PaymentTokenRequestPayload);
841
843TSharedPtr<FJsonObject> PreparePaystationSettings(const bool bAddAdditionalParameters = false, const bool bShowCloseButton = false, const FString& CloseButtonIcon = TEXT("cross"), const bool bGpQuickPaymentButton = false);
844
846bool GetSteamUserId(const FString& AuthToken, FString& SteamId, FString& OutError);
847
849TArray<TSharedRef<IHttpRequest, ESPMode::ThreadSafe>> CartRequestsQueue;
850
851FString GetPayStationVersionPath(const EXsollaPayStationVersion PayStationVersion) const;
852
853FString GetTokenQueryParameterName(const EXsollaPayStationVersion PayStationVersion) const;
854
855public:
857UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
858TArray<FStoreItem> GetVirtualItemsWithoutGroup() const;
859
861UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
862const FStoreItemsData& GetItemsData() const;
863
865UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart")
866const FStoreCart& GetCart() const;
867
869UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
870const FString& GetPendingPaystationUrl() const;
871
873UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
874FString GetItemName(const FString& ItemSKU) const;
875
877UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
878const FStoreItem& FindItemBySku(const FString& ItemSku, bool& bHasFound) const;
879
881UFUNCTION(BlueprintCallable, Category = "Xsolla|Store")
882const FVirtualCurrencyPackage& FindVirtualCurrencyPackageBySku(const FString& ItemSku, bool& bHasFound) const;
883
885UFUNCTION(BlueprintCallable, Category = "Xsolla|Store|Cart")
886bool IsItemInCart(const FString& ItemSKU) const;
887
888public:
890UPROPERTY(BlueprintAssignable, Category = "Xsolla|Store|Cart")
891FOnCartUpdate OnCartUpdate;
892
893protected:
895FString ProjectID;
896
899
902
904FVirtualCurrencyPackagesData VirtualCurrencyPackages;
905
907FString CachedCartCurrency;
908
910FString CachedAuthToken;
911
913FXsollaPaymentTokenRequestPayload CachedPaymentTokenRequestPayload;
914
916FString CachedCartId;
917
919FString CachedCartLocale;
920
922FString PendingPaystationUrl;
923
925
926private:
927UPROPERTY()
928TSubclassOf<UXsollaStoreBrowserWrapper> DefaultBrowserWidgetClass;
929
930UPROPERTY()
931TArray<UXsollaOrderCheckObject*> CachedOrderCheckObjects;
932
933UPROPERTY()
934UXsollaLoginSubsystem* LoginSubsystem;
935
936UPROPERTY()
937FString PaymentAccessToken;
938
939UPROPERTY()
940FString PaymentRedirectURI;
941
942UPROPERTY()
943bool PaymentEnableSandbox;
944
945UPROPERTY()
946int32 PaymentOrderId;
947
948UPROPERTY()
949int32 PaymentPayStationVersionNumber;
950
951FOnPurchaseUpdate PaymentSuccessCallback;
952
953FOnError PaymentErrorCallback;
954
955UPROPERTY()
956FOnStoreBrowserClosed PaymentBrowserClosedCallback;
957};
Definition: XsollaLoginSubsystem.h:49
Definition: XsollaOrderCheckObject.h:21
Definition: XsollaStoreBrowserWrapper.h:16
Definition: XsollaStoreSubsystem.h:58
Definition: XsollaStoreDataModel.h:544
Definition: XsollaStoreDataModel.h:459
Definition: XsollaStoreDataModel.h:116
Definition: XsollaStoreDataModel.h:248
Definition: XsollaStoreDataModel.h:380
Definition: XsollaStoreDataModel.h:443