question

Rim avatar image
Rim asked

How do POST from php to playfab,How can i do POST from php to playfab

I am making my own donation system, I am a beginner and it is difficult for me. Now I can make a payment form and receive a response from the payment system, but now I need to make a payment response handler, I need to tell PlayFab using PHP or HTML, increase the player's game currency, I'm developing on Unity and I already have an idea about SendMessage in the unit, but it is not convenient in some of its moments, is there an option to make a POST request from PHP, as it is written in the PlayFab documentation, I'm really new to this, you can also use an example on the specific AddCharacterVirtualCurrency function, and is it possible to get PlayerData(Title) without login and authorization if they are public, many thanks in advance

Player Dataapisunity3dsdks
10 |1200

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

1 Answer

·
Made Wang avatar image
Made Wang answered

You can try to use the php PlayFab SDK, refer to PlayFab/PhpSdk: PHP Sdk for PlayFab https://api.playfab.com/sdks/php (github.com).

For an example of AddCharacterVirtualCurrency, you can refer to the following code (written in C# on Unity):

PlayFabServerAPI.AddCharacterVirtualCurrency(new AddCharacterVirtualCurrencyRequest
        {
            Amount = 100,
            CharacterId = [CharacterID],
            PlayFabId = [playfabid],
            VirtualCurrency = [VC]
        },
        (result) =>
        {
            Debug.Log(result.Balance);
        },
        (error) =>
        {
            Debug.LogError(error.GenerateErrorReport());
        });

Regarding PlayerData(Title), if you are on the client side, the user cannot call GetUserData to get it without logging in. The public of PlayerData(Title) refers to the information that users can access to each other in PlayFab, so they must be logged in before they can access. If you are on the server side, then you can call GetUserData to get it.

1 comment
10 |1200

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

Rim avatar image Rim commented ·

Thanks so much

0 Likes 0 ·

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.