Server : LiteSpeed System : Linux nl-srv-web1396.main-hosting.eu 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64 User : u107206879 ( 107206879) PHP Version : 7.2.34 Disable Function : NONE Directory : /home/u107206879/domains/escort46.de/public_html/admin/ |
<?php
// The API URL
$url = "https://cluster11.api-test.cashtocode.com/merchant/paytokens";
$user_id = "e9652636_user";
$password = "ccu8N8YTHpVeDBfNFuQDNuSYMuEJ3nX2";
$data = array(
"transactionId"=>"2",
"userId"=>"2",
"amount"=>501.5,
"currency"=>"CHF",
"firstname"=>"san",
"lastname"=>"Doe",
"dateOfBirth"=>"1972-08-03",
"userAlias"=>"SAN.doe",
"returningCustomer"=>true,
"country"=>"DE",
"requestedUrl"=>"https://www.escort46.de/admin/test-pay",
"cancelUrl"=>"https://www.escort46.de/admin/test_pay_cancel",
"repayUrl"=>"https://www.escort46.de/admin/test_pay_repay",
"mid"=>"e9652636",
"brand"=>"my-sub-brand" ,
);
// Convert the data to JSON format
$jsonData = json_encode($data);
// Initialize cURL
$ch = curl_init($url);
// Set the cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response
curl_setopt($ch, CURLOPT_POST, true); // Set method to POST
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); // Attach the JSON data
// Add HTTP headers
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json', // Send JSON data
'Content-Length: ' . strlen($jsonData) // Set content length
));
// Set the basic authentication header (user ID and password)
curl_setopt($ch, CURLOPT_USERPWD, $user_id . ":" . $password);
// Execute the cURL request and get the response
$response = curl_exec($ch);
// Check for cURL errors
if ($response === false) {
echo 'cURL Error: ' . curl_error($ch);
} else {
// Output the API response
echo 'Response: ' . $response;
}
// Close the cURL session
curl_close($ch);
?>