Request Examples

This example demonstrates how to use a POST request to create a SecureLink API integration.

function request() {
	$url = "https://test.link.allsecure.xyz/api/v1/generate";
	$data =  array('apiUser' => 'username',
		'currency' => 'EUR',
		'paymentType' => 'DB',
		'invoiceNumber' => '123456',
		'invoiceDate' => '2020-12-31',
		'invoiceDescription1' => 'The first item',
		'invoiceQuantity1' => '3',
		'invoicePrice1' => '2322',
		'invoiceDescription2' => 'The second item',
		'invoiceQuantity2' => '4',
		'invoicePrice2' => '244',
		'invoiceDescription3' => 'The third item',
		'invoiceQuantity3' => '5',
		'invoicePrice3' => '23',
		'customerFullname' => 'Mark Musterman',
		'customerEmail' => '[email protected]',
		'customerBillingAddress' => 'Some street 1A',
		'customerBillingCity' => 'New Berlin',
		'customerBillingCountry' => 'DE',
		'customerBillingPostcode' => '11000',
		'customerBillingPhone' => '021123456',
		'customerCompany' => 'Test Co');	

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(
		'x-api-key: ICCtytvJFsYfn0quOVkS9dc9QEoGjvhLpcuCz0mqqsjvvUQStPGIwWQQ91XE5zXh',
		'x-api-user: test'
	));
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$responseData = curl_exec($ch);
	if(curl_errno($ch)) {
		return curl_error($ch);
	}
	curl_close($ch);
	return $responseData;
}
$responseData = request();
echo $responseData;
var form = new FormData();
form.append("currency", "EUR");
form.append("paymentType", "PA");
form.append("invoiceQuantity1", "3");
form.append("invoicePrice1", "2322");
form.append("customerCompany", "neka firma");
form.append("customerBillingCountry", "RS");
form.append("customerFullname", "Marko");
form.append("customerEmail", "[email protected]");
form.append("customerBillingCity", "Subotica");
form.append("customerBillingPhone", "3434433434");
form.append("customerBillingAddress", "Bulevar Oslobodjenja 5a");
form.append("invoiceDate", "20-12-2019");
form.append("invoiceNumber", "12344554");
form.append("invoiceDescription1", "test description");

var settings = {
  "url": "https://test.link.allsecure.xyz/api/v1/generate",
  "method": "POST",
  "timeout": 0,
  "headers": {
	"x-api-key": "ICCtytvJFsYfn0quOVkS9dc9QEoGjvhLpcuCz0mqqsjvvUQStPGIwWQQ91XE5zXh",
    "x-api-user": "test"
  },
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form
};

$.ajax(settings).done(function (response) {
  console.log(response);
});