Hi Guys - newbie here. Hope you can help me pls.
I have the Postman working and i am getting a JSON response. I now want to copy the code across to our website and use the response data there. I am having trouble converting the JSON variables into ASP variables that i can display to the website user, and store in the database. I am trying with the code generated by Postman in javascript / jQuery.
How should i extract, for example, the “total_amount” variable here so i can display it on the website to the customer? It shows in the my browser console, so i know it is being returned, i just dont know how to then extract it and use it within ASP
Would be brillaint if someone could help me
Here is the code i am using currently
< html>
< body>
< h1>Hello World!
< !-- jQuery library →
< script src=“https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js”>
< script>
var settings = {
“url”: “https://seller-transaction-api.sandbox.marketplace.taxamo.com/api/v3/seller/tax/calculate”,
“method”: “POST”,
“timeout”: 0,
“headers”: {
“x-marketplace-seller-token”: “seller_token_4_removed*”,
“Content-Type”: “application/json”
},
“data”: JSON.stringify({
“transaction”: {
“currency_code”: “GBP”,
“buyer_name”: “jason k”,
“ship_to_address”: {
“address_detail”: “498 Moo 1, Lakeside, Paris”,
“postal_code”: “77110”,
“country_code”: “FR”
},
“transaction_lines”: [
{
“product_class”: “P”,
“quantity”: 1,
“description”: “Video Games Consoles and Machines”,
“amount”: “59.99”,
“custom_id”: “51315A00-DC44-408E-A575-8CE42A32AE1B”,
“import_address”: {
“country_code”: “GB”
},
“ship_from_address”: {
“building_number”: “121”,
“street_name”: “Sandy Street”,
“city”: “Yarmouth”,
“postal_code”: “YM15 8YT”,
“country_code”: “GB”
},
“product_cn_code”: “9504500000”
}
]
}
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
< /script>
< /body>
< /html>