You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting JSON.parse: unexpected character at line 1 column 1 of the JSON data because the response from the API is a single String (Token).
Using the following config
const externalApi = configureApi({
root: process.env.ELAVON_TRANSACTION_TOKEN_ENDPOINT,
mode: 'cors'
})
externalApi.post('/hosted-payments/transaction_token', {
ssl_merchant_id: process.env.ELAVON_SSL_MERCHANT_ID,
ssl_user_id: process.env.ELAVON_SSL_USER_ID,
ssl_pin: process.env.ELAVON_SSL_PIN,
ssl_transaction_type: "ecspurchase"
})
.then((data) => {
console.log(data); // Doesn't reach this point
})
.catch((results) => {
console.log("HERE"); // Throws the exception and consoles this one
});
Response from the api
Content-Type is application/json
While using axios, I'm able to get the response back as a String but lp-requests fails with the above error. It looks like axios by default will return the plain response if JSON.parse fails.
The text was updated successfully, but these errors were encountered:
Getting
JSON.parse: unexpected character at line 1 column 1 of the JSON
data because the response from the API is a single String (Token).Using the following config
Response from the api
Content-Type is
application/json
While using axios, I'm able to get the response back as a String but lp-requests fails with the above error. It looks like axios by default will return the plain response if
JSON.parse
fails.The text was updated successfully, but these errors were encountered: