You can send POST to your server, which in the script, POSTs all the parameters for the action of the API form, but with customer_token added in your script to the server side, which clients cannot see.
So you have the original form:
<form action="http://someapi.com/blah" method="POST"> <input type="hidden" name="customer_token" value="foo"> <input type="text" name="whatever"> ... </form>
And use instead:
<form action="myapiblah.php" method="POST"> <input type="text" name="whatever"> ... </form>
Note that in the second example there is no customer_token . Then in myapiblah.php - change the name, obviously, especially depending on the server-side language you are using. I could provide more specific examples if you tell me what you are using - use something like this psuedo code:
parameters = $_POST; parameters['customer_token'] = 'foo'; send_http_request('POST', 'http://someapi.com/blah', parameters);
You will need to know the details of using send_http_request .
In PHP, you would do something like this if you can use pecl_http in PECL:
$params = $_POST; $params['customer_token'] = 'foo'; $req = new HttpRequest('http://someapi.com/blah', HttpRequest::METH_POST); $req->addQueryData($params); try { $r->send(); if ($r->getResponseCode() == 200) {
source share