Apple Receipt Verifier returns JsonException

There are three Parties in my purchase verification process.

  • IOS client
  • ASP.NET server (proxy for verification)
  • Apple Server

JSON-RCP in a communication method between an iOS client and an ASP.NET server

Verification process; Sending a payment check through a web service to an ASP.NET server (the server uses AppleReceiptVerifier to confirm receipt)

I have 5 product identifiers for payment, 2 of them work well and return the expected response, and the remaining three return a 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 one

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

All product identifiers are of the same type, they just change in price and I don’t know why this problem?

What to do???

+4
source share
2 answers

After reading the json-rpc spec, It seems that params is an array, try the following:

 { "method":"sendReceipt", "params" :[ { "ReceiptData":"ewoJInNpZ25hdHVyZSIgPSAiQXJ....β€Œ.", "PersonID":" sam@am.com " } ], "id":"1" } 

or that:

 { "method":"sendReceipt", "params" :[ "ewoJInNpZ25hdHVyZSIgPSAiQXJ....β€Œ.", " sam@am.com " ], "id":"1" } 

jsonrpc version 2.0:

 { "jsonrpc": "2.0", "method": "sendReceipt", "params": { "ReceiptData":"ewoJInNpZ25hdHVyZSIgPSAiQXJ....β€Œ.", "PersonID":" sam@am.com " }, "id": 1 } 

They should work depending on your needs.

+2
source

Not sure why you are using a third-party library for validation when Apple provides an environment for validating it.

Here you can directly post JSON and get a response with the correct error code. Apple also documented every mistake well in its Application Programming Guide.

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

Consult StoreKIt Verification Error: 21002 for more information.

+1
source

Source: https://habr.com/ru/post/1499561/


All Articles