Open Suraez opened 3 years ago
Are you trying to communicate api from client side ??
yeah
I tried to implement from the server but no luck. Got this
xhr.js:184 GET http://localhost:7655/khalti/M6aERNTpGNk9wukyi8n22a/1000/my_secret_key (Internal Server Error)
above is my own API which eventually calls merchant API with token, amount and secret key in req.params. I extract these from req.params and call the API as:
let data = {
token: req.params.token,
amount: req.params.amount,
};
let config = {
headers: {
Authorization: "MY-TEST-SECRET-KEY",
},
};
axios
.post(
"https://khalti.com/api/v2/payment/verify/",
data,
config
)
.then((response) => {
console.log(response.data);
console.log("Yay!, It's done");
})
.catch((error) => {
console.log(error);
});
Any update on this??
any update?
geez, it's still an open issue
i am getting cors error while making POST request to merchant API for verification. And when i try to use reverse proxy i.e. https://cors-anywhere.herokuapp.com , i got 403 unuathorized error
Access to XMLHttpRequest at 'https://khalti.com/api/v2/payment/verify/' from origin 'http://localhost:3000/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
while using reverse proxy
Failed to load resource: the server responded with a status of 403 (Forbidden)