We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Failed to parse JSON body

Questions and answers about Plum Fuse+

Moderators: admin, support

Post Reply
Fivable
Posts: 11
Joined: Fri May 11, 2018 7:32 am

Failed to parse JSON body

Post by Fivable »

I am sending a POST_RAW request to Authorize.net's API, expecting a JSON response back. The request goes through and receives a successful transaction response from Authorize.net formatted in JSON, but I am getting an JSON body parse error. I am confused because it seems everything has worked, and I don't know what is causing the parsing error. I'd greatly appreciate any clarification I can get.

Note: This is test card data for Authorize.net's sandbox API in the request/response. None of this is actual sensitive information.

11 MAY 2018 11:38:38 AM -0400: Auth_capture, [rest] - »
ERROR:
Failed to parse the json body.
REQUEST:
URL: https://apitest.authorize.net/xml/v1/request.api
TYPE: POST_RAW
Content-Type: application/json
Accept: application/json
User-Agent: curl/7.43.0
REQUEST: { "createTransactionRequest": { "merchantAuthentication": { "name": "XXXXXXXXX", "transactionKey": "XXXXXXXXX" }, "transactionRequest": { "transactionType": "authCaptureTransaction", "amount": "100", "payment": { "creditCard": { "cardNumber": "2223000010309711", "expirationDate": "1221", "cardCode": "444" } } } } }
RESPONSE:
HTTP: 200
Cache-Control: private
Content-Type: application/json; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: x-requested-with,cache-control,content-type,origin,method,SOAPAction
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: PUT,OPTIONS,POST,GET
X-Cnection: close
Content-Length: 466
Date: Fri, 11 May 2018 15:38:38 GMT
Connection: keep-alive

Raw
{"transactionResponse":{"responseCode":"1","authCode":"APOR5J","avsResultCode":"Y","cvvResultCode":"P","cavvResultCode":"2","transId":"60103188851","refTransID":"","transHash":"2D14E2A9A4220C8C1A03BA73CC321CB4","testRequest":"0","accountNumber":"XXXX9711","accountType":"MasterCard","messages":[{"code":"1","description":"This transaction has been approved."}],"transHashSha2":""},"messages":{"resultCode":"Ok","message":[{"code":"I00001","text":"Successful."}]}}

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: Failed to parse JSON body

Post by support »

Hi,

The parse error was caused by Authorize.net returning a Byte Order Mark within their JSON response, which our system does not support. At this time, our engineers have deployed a patch to resolve the matter. Please let us know if you experience any further issues.

Regards,
Plum Support

Fivable
Posts: 11
Joined: Fri May 11, 2018 7:32 am

Re: Failed to parse JSON body

Post by Fivable »

Thank you very much this did the trick!

Post Reply