question

Sebastien Saintomer avatar image
Sebastien Saintomer asked

How does XSolla workflow work ?

Hey !

I have been trying for a few weeks now to setup XSolla with Playfab but I cannot figure out what I am doing wrong.


My Playfab webhook URL is correctly set up on XSolla however I don't understand nor have I found any code sample to guide me on how to make the correct calls and send the correct data to XSolla, does anyone have a C#/.NET sample they are willing to share ?

I am just lost on how things are supposed to be going, and XSolla support hasn't been able to help at all. I am just willing to know the steps I need to take to go from pressing the button in my app to the user getting his virtual currency on his Playfab Account.

Ideally, I would only want to use XSolla as a gateway and perform every UI related thing on my own app, if at all possible.

Here is my current code that is supposed to call the Payment Gateway on XSolla but instead opens the store where none of my items are shown :

public static void XsollaRequest()
        {
            var requestPaymentToken = new GetPaymentTokenRequest { TokenProvider = "xsolla" };
            var PaymentTokenTask = PlayFabClientAPI.GetPaymentTokenAsync(requestPaymentToken);
            var requestPurchase = new GetPurchaseRequest { OrderId = PaymentTokenTask.Result.Result.OrderId };
            var PurchaseTask = PlayFabClientAPI.GetPurchaseAsync(requestPurchase);


            if (PaymentTokenTask.IsCompleted)
            {
                OnPurchaseComplete(PaymentTokenTask);
                string target = "https://sandbox-secure.xsolla.com/paystation3/?access_token=" + PaymentTokenTask.Result.Result.ProviderToken;
                try
                {
                    Process.Start(new ProcessStartInfo(target) { UseShellExecute = true });
                }
                catch (System.ComponentModel.Win32Exception noBrowser)
                {
                    if (noBrowser.ErrorCode == -2147467259)
                        Console.WriteLine(noBrowser.Message);
                        MessageBox.Show(noBrowser.Message);
                }
                catch (System.Exception other)
                {
                    Console.WriteLine(other.Message);
                    MessageBox.Show(other.Message);
                }
                Console.WriteLine(PurchaseTask.Result.Result);
            }
        }

        private static void OnPurchaseComplete(Task<PlayFabResult<GetPaymentTokenResult>> TokenTaskResult)
        {
            var apiError = TokenTaskResult.Result.Error;
            var apiResult = TokenTaskResult.Result.Result;

            if (apiError != null)
            {
                Console.WriteLine("Something went wrong with API call.  :(");
                Console.WriteLine(PlayFabUtil.GenerateErrorReport(apiError));
            }
            else if (apiResult != null)
            {
                Console.WriteLine("Congratulations, successful API call!");
            }
        }

        private void PurchaseButton(object sender, RoutedEventArgs e)
        {
            XsollaRequest();
        }


Any help is greatly appreciated and thanks a million in advance !

datasupportwebhooks
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

PlayFab doesn't provide an out-of-box Xsolla integration project, but there is a detailed step-by-step tutorial. Please refer to Non-Receipt Payment Processing - PlayFab | Microsoft Doc. May I ask in which step do you meet any issues?

0 Likes 0 ·
Sebastien Saintomer avatar image Sebastien Saintomer Seth Du ♦ commented ·

I have seen and tried to put that doc every way around but eventually, I stay stuck at this step. It just opens the store where none of my items are shown as said above.

0 Likes 0 ·

1 Answer

·
JayZuo avatar image
JayZuo answered

There is no big issue in your code. Since the problem here is your items are not shown in Xsolla Store, I'd still suggest you seek help from Xsolla as PlayFab does not control the payment UI.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.