I’m working on a payment integration and sadly i don’t have a static IP and my country is banned.
Working from my personal hosting and that IP has been whitelisted but it seems like the initial request to their servers fails.
Possibly that the ajax request that runs uses my IP adress and not the server one?
The code is something like this:
return jQuery.ajax({
type: "POST",
url: serviceUrlCard,
data: JSON.stringify(x),
contentType: "application/json",
dataType: "json"
})
Is it possible to maybe send the “IP” of the server and not mine ?
If the AJAX request is sending data directly to the payment service then your local computer’s ip address is being used. You need to send the data first to your server through a view that accepts an AJAX request.
Then define a view to accept the data and hopefully the payment service you’re integrating has a binding for your language or you can at least interact with their API using a cURL binding.
You can instead send a AJAX request to your server and then send the information from your server to there server…
Some file in your Server will have
In the same file accept data as post / get, and make a ajax call to this file ..
I know this is not optimal way of doing , but cannot thing of another ..
Normally, the Ajax request should go back to your server, and then from your server to the external service.
If this is not an option, and all you need is a fixed IP in a whitelisted country (i.e. US), then you can rent a proxy server for ~2 USD per month.
You can then modify your Ajax to use this proxy server by using a library such as https://www.ajaxproxy.com/ – and modifying your code as follows: