OXXY
OXXY

Reputation: 1047

Apple Receipt Verifier returns JsonException

In my Purchase Verification Process a three Parties

  1. iOS Client
  2. ASP.NET Server (intermediary for verification)
  3. Apple Server

JSON-RCP in the communication method between iOS Client & ASP.NET Server

The Verification Process is; Sending the Payment Receipt through web-service to the ASP.NET Server ( the server use AppleReceiptVerifier to Verify the Receipt)

I have 5 Product Identifiers for the payment 2 of them operate well and return the expected response but the other three return JsonException like this

{
    error =     {
        errors =         (
                        {
                message = "Found String where Object was expected.";
                name = JsonException;
            }
        );
        message = "Found String where Object was expected.";
        name = JSONRPCError;
    };
    id = "<null>";
}

and this

{
    error =     {
        errors =         (
                        {
                message = "Missing value.";
                name = JsonException;
            }
        );
        message = "Missing value.";
        name = JSONRPCError;
    };
    id = "<null>";
}

All the product identifiers are the same type they just vary in the price and i don't know why is this problem ???

What to do ???

Upvotes: 4

Views: 1568

Answers (2)

noamtcohen
noamtcohen

Reputation: 4612

After reading the specification of json-rpc, It seems that params is an array, try this:

{
  "method":"sendReceipt",
  "params" :[
    {
      "ReceiptData":"ewoJInNpZ25hdHVyZSIgPSAiQXJ....‌.",
      "PersonID":"[email protected]"
    }
  ],
  "id":"1"
}

or this:

{
  "method":"sendReceipt",
  "params" :[
    "ewoJInNpZ25hdHVyZSIgPSAiQXJ....‌.",
    "[email protected]"
  ],
  "id":"1"
}

jsonrpc version 2.0:

{
    "jsonrpc": "2.0", 
    "method": "sendReceipt", 
    "params": 
     {
      "ReceiptData":"ewoJInNpZ25hdHVyZSIgPSAiQXJ....‌.",
      "PersonID":"[email protected]"
     }, 
     "id": 1
}

They should both work depending on your needs.

Upvotes: 2

Nilesh Patel
Nilesh Patel

Reputation: 6394

Not sure why you are using the third party Library for verification when Apple provide environment to verify it.

Here you can directly post the JSON & get response with proper error code. Apple also well documented each error in their In-App Purchase Programming Guide

FYI use https://sandbox.itunes.apple.com/verifyReceipt to verify receipt in sandbox environment.

Refer StoreKIt verification error: 21002 for more info.

Upvotes: 1

Related Questions