<?php
$shopId = "";
$secretPhrase = "";
$orderId = "";
$mainUrl = "https://pay.cashbill.pl/ws/rest";
$ch = curl_init();
$modifyRequest = array(
"returnUrl" => "https://cashbill.pl/ok",
"negativeReturnUrl" => "https://cashbill.pl/err",
);
$modifyRequest['sign'] = sha1($orderId . $modifyRequest['returnUrl'] . $modifyRequest['negativeReturnUrl'] . $secretPhrase);
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_URL => "{$mainUrl}/payment/{$shopId}/{$orderId}",
CURLOPT_HTTPHEADER => array("Content-Type: application/json"),
CURLOPT_POSTFIELDS => json_encode($modifyRequest)
));
$ret = curl_exec($ch);
$response = json_decode($ret);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) != "204") {
echo "Error message: {$response->errorMessage}";
} else {
echo "Done";
}