question

Michael avatar image
Michael asked

ValidateGooglePlayPurchase results in 500 Internal Server Error

Hi..

the following method returns a 500 internal server error



public static void PurchaseCurrencyPack (string receiptJson, string signature)

    {

        ValidateGooglePlayPurchaseRequest request = new ValidateGooglePlayPurchaseRequest () {

            ReceiptJson = receiptJson,

            Signature = signature

        };



        PlayFabClientAPI.ValidateGooglePlayPurchase (request, (result) => {

            Debug.Log ("DEBUG Purchase Currency Pack");

        },

            (error) => {

                Debug.Log ("DEBUG Error PurchaseAnItem:");

                Debug.Log ("DEBUG " + error.ErrorMessage);

                Debug.Log ("DEBUG " + error.ErrorDetails);

                Debug.Log ("DEBUG " + error.Error);

            });

    }

Output:

08-22 21:59:18.951  4548  4597 I Unity   : DEBUG 500: Internal Server Error
08-22 21:59:18.951  4548  4597 I Unity   : DEBUG System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.List`1[System.String]]
08-22 21:59:18.951  4548  4597 I Unity   : DEBUG InternalServerError

Actually i am trying to buy the product with a testaccount (so that it's for free, maybe that will not work?).

Best, Michael

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.

Michael avatar image Michael commented ·

Sometimes i get the following with the same code:

08-22 22:18:10.141  4548  4597 I Unity   : DEBUG Invalid signature
08-22 22:18:10.141  4548  4597 I Unity   : DEBUG
08-22 22:18:10.141  4548  4597 I Unity   : DEBUG InvalidReceipt

0 Likes 0 ·

1 Answer

·
brendan avatar image
brendan answered

Can you re-check your Google App License Key? It appears to be incorrect, as it's not a valid Base64 string length. From looking at it in your Add-ons Marketplace settings, it appears to be quite a bit longer than it's supposed to be.

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

Michael avatar image Michael commented ·

Thank you, Brendan. Actually it was the wrong key. Now it works.

Please, could you explain in a few words, how the flow should be to add amount to a virtual currency after buying it through the store?

For example if i buy a currency pack of 150 Coins through googles play store. When and how should i increase the amount in the player account?

0 Likes 0 ·
brendan avatar image brendan Michael commented ·

The way to do this is by creating a Bundle in your game's catalog which contains the VC amount in question. Set the Bundle to expire after 5 seconds (Usage Period), so that it gets cleaned up after depositing the VC in the player's account, and you should be set.

0 Likes 0 ·
Michael avatar image Michael commented ·

Thank you very much, Brendan! It works like a charm.

The only thing i am wondering about is the price in the list of made purchases: Total in USD: $1.00

The price should be $1.49. Anyway, the play store shows the right price and that is what the user sees. But i am actually wondering why the price in the list is wrong.

0 Likes 0 ·
Michael avatar image Michael commented ·

Thank you @Brendan

In the list of made purchases of the players it seems that the price is wrong. The item costs $1.49 but in the list i see "Total in USD": $1.00

In the Play Stream i see correctly:

  • Google Play: $1.49 USD

Do you know why?

0 Likes 0 ·
brendan avatar image brendan Michael commented ·

Whether you're sending the price in the call or using the one from your catalog, the price should be in the smallest currency unit for the currency in question. So for USD $1.49, you would enter that as 149 (no decimal).

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.