amazon-pay-api-sdk-java icon indicating copy to clipboard operation
amazon-pay-api-sdk-java copied to clipboard

JSONException on 405 error

Open rougou opened this issue 5 years ago • 0 comments

Hi, we got the following exception calling updateCheckoutSession in our production (LIVE) environment. Not sure the cause of the 405 to begin with, but the SDK attempts to convert the response to JSON despite it being HTML.

A JSONObject text must begin with '{' at character 1 of <html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>Server</center>
</body>
</html>
net.sf.json.JSONException: A JSONObject text must begin with '{' at character 1 of <html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>Server</center>
</body>
</html>
        at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:499)
        at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:972)
        at net.sf.json.JSONObject._fromString(JSONObject.java:1201)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:165)
        at net.sf.json.JSONObject.fromObject(JSONObject.java:134)
        at com.amazon.pay.api.AmazonPayClient.processRequest(AmazonPayClient.java:215)
        at com.amazon.pay.api.AmazonPayClient.callAPI(AmazonPayClient.java:163)
        at com.amazon.pay.api.WebstoreClient.updateCheckoutSession(WebstoreClient.java:128)

rougou avatar Dec 10 '20 09:12 rougou