question

tomtominc1 avatar image
tomtominc1 asked

Steam PlayFabAPI.ConfirmPurchase is not adding inventory Items

Hello, I've run into a problem with PlayFabAPI.ConfirmPurchase with Steam. When making a purchase things are working as expected, I make a purchase, the Steam Window opens and allows me to purchase the items, I then confirm this purchase with Steam using the ConfirmPurchase API. Upon doing so, I get the items that I'm supposed on the Client.

My issue is that PlayFab is not adding the items/currency to my inventory. I've checked the docs many times and it does say:

"This adds the items to the player's inventory and returns the information about the items purchased to the title."

So I believe I'm doing everything correctly, it only skips the step of adding to the inventory.

I'm on Sandbox mode, Steam is properly set up on the Additions section of PlayFab. Any help would be greatly appreciated!

apis
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.

Rick Chen avatar image Rick Chen ♦ commented ·

Could you please provide your title id, the PlayFabId of the player, and the Order ID of the purchase for us to diagnose?

0 Likes 0 ·
tomtominc1 avatar image tomtominc1 Rick Chen ♦ commented ·

Title ID: CCABC

Player ID: 3F36F3635787AB08 (notnasiul)

The player is a developer on the project and the one leading the steam port, he'll be discussing in this chat too. Please let us know if you find anything, thank you.

0 Likes 0 ·
Rick Chen avatar image
Rick Chen answered

Thank you for trying. I have inspected the event. The player who generates the event has the PlayFabID 582B38D132BA6138. In the purchase history of that player, there is successful purchase for that order. I can also find the expired item instance with ID 1FD8EBF3284B3B5C in that player’s inventory. The previous order id CF796D22DCE5DB0 is also in that player’s purchase history. Maybe you used the wrong player account to do the purchase?

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.

PlayMedusa avatar image PlayMedusa commented ·

That was it, @Rick Chen

Following the tutorial (I may have missed something), I begun the process with a LOGIN WITH STEAM call, instead of a LINK STEAM ACCOUNT call. So it was indeed a new user.

I unlinked that steam account and now I begin the process with PlayFabClientAPI.LinkSteamAccount.

It's working now. Thanks! ':)

0 Likes 0 ·
PlayMedusa avatar image
PlayMedusa answered

Just my two cents, as I'm working with the project too: we even tried without sandbox mode (buying on Steam once the game was uploaded), but it didn't work.

TitleID: CCABC

Player PlayFabid: 3F36F3635787AB08 (notnasiul)

OrderID changes with every purchase right? There's no trace of a purchase in the user's Purchases history (last one was on the 05/28, which is not true, we tried buying yesterday). Nor the operation creates events in PlayStream for that player (which is me)

But the whole process looks right on the client side. Client starts purchase, tells playfab, steam overlay appears, accepting the purchase tells the client and we get the items on the client side. But they are not updated on playfab...

Any clue about what could be happening?

10 |1200

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

PlayMedusa avatar image
PlayMedusa answered
@Rick Chen

I'm the player and developer that @tomtominc1 mentioned. We just tried again at 17:35 (05/28)


Title ID: CCABC

Player ID: 3F36F3635787AB08 (notnasiul)

Order ID: CF796D22DCE5DB0

No luck.

I would also like to add that we tried without sandbox mode and it didn't work. The database is never updated. I bought some virtual currency (Void Core) but while it's updated in the client (for that session), playfab never updates the value. It's still 68, should be +100.

To sum it up: the whole process seems to be working, but updating the database. Client tells playfab to begin a purchase, playfab tells Steam, we see the overlay with the right information, we accept the purchase, Steam tells the client(game) and we get the item in game, completing the purchase.

But not only the ConfirmPurchase doesn't add items to the database. Thing is there's no record in the user's Purchases list (last one is from a few days ago, made from an Android device, nothing to do with Steam).

We are running out of things to try! Halp? : )

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.

Rick Chen avatar image Rick Chen ♦ commented ·

I have inspected the player in your title. I noticed that there were many purchase with the “Cart created” state, but they were neither succeeded or failed. I have also checked the event of Order ID “C63E150E2EFE247D”. There was only 1 event “player_started_purchase” related to this order. It seems the confirm purchase call was not able to make it to PlayFab. Which SDK are you using? Have you tried to capture the error for that API call? Could you please try using the Postman to call the confirm purchase API and see if it works?

0 Likes 0 ·
PlayMedusa avatar image PlayMedusa Rick Chen ♦ commented ·

Sorry for the repost! I thought I never got to send the reply because I couldn't see it, so I wrote a second one. Anyways:

The Cart Created states you mention are old, aren't they? My last test was on Friday not the 05/28 (though I said that in the post, sorry!! I meant to write the oldest entry), but the last try was on Friday 04/06

So: no new Cart Created states have been created since I started implementing platyfab with steam.

I'm using Steamworks.NET with Unity. But please keep in mind there's no error: the whole thing seems to be working client-side, but the purchase won't add items in the server. BUT there must be some communication, or nothing would be seen on the client! After all, the Steam Overlay appears when Playfab sends the message to Steam, right? Then the ConfirmPurchase API returns successfully, or the purchase would not continue on the client... I'll have a look at postman, but is there something else I could do?

0 Likes 0 ·
PlayMedusa avatar image
PlayMedusa answered

So I tried with Postman, and this was the response for the ConfirmPurchase call after the whole process:

{
    "code": 200,
    "status": "OK",
    "data": {
        "OrderId": "6A35AFDF4E9DEFC9",
        "PurchaseDate": "2021-06-07T10:54:44.961Z",
        "Items": [
            {
                "ItemId": "com.creaturesofaether.abyssorbssmall",
                "ItemInstanceId": "1FD8EBF3284B3B5C",
                "ItemClass": "Iap",
                "PurchaseDate": "2021-06-07T10:54:44.961Z",
                "Expiration": "2021-06-07T10:54:54.961Z",
                "RemainingUses": 1,
                "UsesIncrementedBy": 1,
                "Annotation": "Fake description",
                "CatalogVersion": "1",
                "DisplayName": "FISTFUL OF ORBS",
                "UnitCurrency": "RM",
                "UnitPrice": 99,
                "BundleContents": []
            }
        ]
    }
}

Still, no updates in the server. Nothing was added to my user's virtual currency. No cart was oppened in the player's purchases tab.

Something I had to figure out is that the SessionTicket that is required in the Headers of ConfirmPurchase is the one that Steam return with the LoginWithSteam, not the one you have to create to begin the login process. But I undestand this is handled internally by PlayFab, because it's never used again in following calls.

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.