<?php
ini_set('display_errors', 'On');
ini_set('error_reporting', E_ALL);

function CallAPI($method, $url, $data = false){
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
if ($data){
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
$username = '7a7a7a7a7a7a7a'; // API USERNAME FROM GENERAL SETTINGS
$password = '75088XXXXXXXXXXX'; // API SECRET FROM GENERAL SETTINGS
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password"); //HTTP BASIC AUTH

$result = curl_exec($curl);
$httpCode = curl_getinfo($curl , CURLINFO_HTTP_CODE);

curl_close($curl);

return $result;
}

$generated_timestamp = date('c');
$generated_nonce = uniqid(); //UNIQUE VALUE FOR EACH REQUEST
$generated_order_reference = uniqid(); //ORDER REFERENCE OR INVOICE NUMBER

$params=array(
"timestamp"=> $generated_timestamp, //TIMESTAMP ISO 8601
"api_username"=>'7a7a7a7a7a7a7a', // API USERNAME FROM GENERAL SETTINGS
"account_name"=>"EUR3D1", //NAME OF PROCESSING ACCOUNT FROM THE PORTAL
"amount"=>0.01,
"order_reference"=>"$generated_order_reference",
"nonce"=>"$generated_nonce",
"customer_url"=>"https://httpbin.org/get" ); //URL WHERE CUSTOMER WILL BE REDIRECTED AFTER PAYMENT

print 'generated timestamp: ' . $generated_timestamp . PHP_EOL;
print 'generated_nonce: ' . $generated_nonce . PHP_EOL;

$query = http_build_query($params, null, '&', PHP_QUERY_RFC3986);

print 'params for request: ' . $query . PHP_EOL;
print 'RESPONSE: ' . PHP_EOL . CallAPI("POST","https://igw-demo.every-pay.com/api/v4/payments/oneoff", $query); //DEMO ONEOFF ENDPOINT

?>

in Integracijos dokumentacija
Ar šis straipsnis Jums buvo naudingas?