question

Esa Salminen avatar image
Esa Salminen asked

Can't get ValidateIOSReceipt to working

I can't get validation working with a receipt. It's always failed with a response that receipt does not match with catalog item. I can't figure out what is problem with the validation. It seems that receipt is legit like errorMessage told us. But receipt not match any items. OS version is 8.2 which I used for the testing. Response is same both device and when I try it validation directly on your site with a receipt.
I use Unity IAP for purchasing service and it's response for validating receipt. http://docs.unity3d.com/Manual/UnityIAPPurchaseReceipts.html I use directly payload value for receiptData field. Do I have to do something to this value before validation?

{ "code": 400, "status": "BadRequest", "error": "NoMatchingCatalogItemForReceipt", "errorCode": 1178, "errorMessage": "iTunes validation result: 0 (Success) from https://sandbox.itunes.apple.com/verifyReceipt", "CallBackTimeMS": 1465 }
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.

michaelmekies avatar image michaelmekies commented ·

@Brendan I am currently experiencing this with all product IDs from apple that have previously worked. Title IDs : AEE68 and 70CDF. The default catalog and the In-App catalog stores

0 Likes 0 ·
brendan avatar image
brendan answered

I'd recommend reviewing this blog post (which we'll turn into a Tutorial on the main site as well, soon): https://playfab.com/blog/show-me-money-receipt-validation-ios-and-android/.

The key is that the Product ID in your receipt (and so, your catalog in iTunes, Google Play, etc.) needs to match the ItemId of an item in your catalog. That's how we provide a secure means for your to deliver the digital goods to the player - we control everything on the server side. So, we check that the receipt is valid, is actually for your game, hasn't been used before, etc., and then we take the item from your catalog specified (by the Product ID) and put it in the player's inventory.

10 |1200

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

Esa Salminen avatar image
Esa Salminen answered

I made my own plugin for validating receipt and check the items inside receipt and all the product ids will match with the catalog item ids. What is the price which I should give the validation? I did try currency "RM" and price which is defined in catalog and also price given by real purchase process "EUR" and price € 0.99. So is it price which cause problems?

Your tutorial says following:

If you defined prices in other currencies for your item in the iTunes or Google Play store, you need to enter those currency types and values in RealCurrencyPrices, as shown.

I can't find a place in dashboard where to set real currency prices for the product.

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.

swapnilnegi avatar image swapnilnegi commented ·

@Esa Salminen Did you send the encoded payload ? Or you first decoded and then sent the payload.?

0 Likes 0 ·
brendan avatar image
brendan answered

When using receipt validation, you should use the CurrencyCode (the standard three-letter currency code, like USD or EUR) and PurchasePrice (integer value, stated in the minimal form of that currency, so USD 199 is $1.99 US dollars, for example) to tell our service the actual price paid. The reason this is necessary is because the actual price paid (amount and currency) is really only available in the store in question (iTunes, Google Play, etc.), and it is not included in the receipt info.

10 |1200

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

Esa Salminen avatar image
Esa Salminen answered

It just don't work, no matter what I tried. Here is example how items are set and also receipt data.

GetStoreItems returning

{
 "code": 200,
 "status": "OK",
 "data": {
  "Store": [
   {
    "ItemId": "com.company.game.man_1",
    "VirtualCurrencyPrices": {
     "CO": 100,
     "RM": 99
    }
   },
   {
    "ItemId": "com.company.game.man_2",
    "VirtualCurrencyPrices": {
     "CO": 100,
     "RM": 99
    },
    "RealCurrencyPrices": {
     "EUR": 99,
     "USD": 99
    }
   },
   {
    "ItemId": "com.company.game.man_3",
    "VirtualCurrencyPrices": {
     "CO": 100,
     "RM": 99
    }
   }
  ]
 },
 "CallBackTimeMS": 1288
}

GetCatalogItems return following for my example item (only one item in this example)
{
 "code": 200,
 "status": "OK",
 "data": {
  "Catalog": [
   {
    "ItemId": "com.company.game.man_2",
    "ItemClass": "man_2",
    "CatalogVersion": "1",
    "DisplayName": "Man 2",
    "Description": "Unlock this character.",
    "VirtualCurrencyPrices": {
     "CO": 100,
     "RM": 99,
     "D0": 0
    },
    "Tags": [],
    "CustomData": "null",
    "Consumable": {},
    "CanBecomeCharacter": false,
    "IsStackable": false,
    "IsTradable": false
   }

 

Receipt data returned from apple after validation
{
    environment = Sandbox;
    receipt =     {
        "adam_id" = 0;
        "app_item_id" = 0;
        "application_version" = 0;
        "bundle_id" = "com.company.game";
        "download_id" = 0;
        "in_app" =         (
                        {
                "is_trial_period" = false;
                "original_purchase_date" = "2016-02-04 15:04:36 Etc/GMT";
                "original_purchase_date_ms" = 1454598276000;
                "original_purchase_date_pst" = "2016-02-04 07:04:36 America/Los_Angeles";
                "original_transaction_id" = 1000000192372667;
                "product_id" = "com.company.game.man_1";
                "purchase_date" = "2016-02-04 15:04:36 Etc/GMT";
                "purchase_date_ms" = 1454598276000;
                "purchase_date_pst" = "2016-02-04 07:04:36 America/Los_Angeles";
                quantity = 1;
                "transaction_id" = 1000000192372667;
            },
                        {
                "is_trial_period" = false;
                "original_purchase_date" = "2016-02-10 16:42:19 Etc/GMT";
                "original_purchase_date_ms" = 1455122539000;
                "original_purchase_date_pst" = "2016-02-10 08:42:19 America/Los_Angeles";
                "original_transaction_id" = 1000000193367568;
                "product_id" = "com.company.game.man_2";
                "purchase_date" = "2016-02-10 16:42:19 Etc/GMT";
                "purchase_date_ms" = 1455122539000;
                "purchase_date_pst" = "2016-02-10 08:42:19 America/Los_Angeles";
                quantity = 1;
                "transaction_id" = 1000000193367568;
            },
        );
        "original_application_version" = "1.0";
        "original_purchase_date" = "2013-08-01 07:00:00 Etc/GMT";
        "original_purchase_date_ms" = 1375340400000;
        "original_purchase_date_pst" = "2013-08-01 00:00:00 America/Los_Angeles";
        "receipt_creation_date" = "2016-02-11 11:14:23 Etc/GMT";
        "receipt_creation_date_ms" = 1455189263000;
        "receipt_creation_date_pst" = "2016-02-11 03:14:23 America/Los_Angeles";
        "receipt_type" = ProductionSandbox;
        "request_date" = "2016-02-11 11:14:25 Etc/GMT";
        "request_date_ms" = 1455189265647;
        "request_date_pst" = "2016-02-11 03:14:25 America/Los_Angeles";
        "version_external_identifier" = 0;
    };
    status = 0;
}

10 |1200

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

brendan avatar image
brendan answered

Can you check to make sure you have a Primary Catalog set in your catalog definitions? The receipt validation calls currently use the Primary Catalog as their target for purchased goods.

10 |1200

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

Esa Salminen avatar image
Esa Salminen answered

That was a reason, catalog need to be marked as primary catalog. Thanks a lot! :)

10 |1200

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

swapnilnegi avatar image
swapnilnegi answered

@Brendan I get the same error while trying to validate IOS Receipt, the item which I have purchased is in the primary catalog. Any other solution?
Thanks

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.

brendan avatar image brendan commented ·

Can you please provide the Title ID, Catalog Version, and the Product ID you have set up in your App Store catalog, which matches an Item ID in your catalog?

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.