Notifications via Callback URL
Frontpayment will notify your system of the payment status via the callback.callbackUrl
you provided in the initial request payload. This allows you to update the order status in your system accordingly.
The callback URL will include the following parameters as query strings:
Available Parameters
Parameter | Description |
---|---|
orderUuid |
The unique identifier for the order. |
status |
The current status of the order (e.g., PAID , INVOICED ). |
createdAt |
The timestamp when the order was created. |
paymentMethod |
The payment method user has selected. |
timestamp |
The current timestamp when the callback is sent. |
checksum |
A SHA256 hash for integrity verification. |
Example Callback URL:
https://your-callback-url.com/callback?orderUuid=ODR123&status=success&paymentMethod=Visa&createdAt=1755764131×tamp=1755764131&checksum=abcdef123456...
Checksum Verification
To ensure the integrity and authenticity of the callback, you must verify the checksum
included in the query string of any callback url. The checksum is generated using the following formula:
hash('sha256', orderUuid . status . createdAt . secretKey)
Where:
orderUuid
is the value of theorderUuid
parameter from the callback URL.status
is the value of thestatus
parameter from the callback URL.createdAt
is the value of thecreatedAt
parameter from the callback URL.secretKey
will be given by frontpayment.
Example Verification (Conceptual):
// In your callback handler
$receivedOrderUuid = $_GET['orderUuid'];
$receivedStatus = $_GET['status'];
$receivedCreatedAt = $_GET['createdAt'];
$receivedTimestamp = $_GET['timestamp']; // You might also want to log/check this for freshness
$receivedChecksum = $_GET['checksum'];
$secretKey = ''; //Given by Front Payment;
// Construct the string used to calculate the checksum
$stringToHash = $receivedOrderUuid . $receivedStatus . $receivedCreatedAt . $secretKey ;
$calculatedChecksum = hash('sha256', $stringToHash);
if ($receivedChecksum === $calculatedChecksum) {
// Checksum is valid, process the callback data
// e.g., update order status in your database
echo "Callback successfully processed.";
} else {
// Checksum mismatch, reject the callback as potentially tampered
// Log the discrepancy for investigation for security purposes
http_response_code(403); // Forbidden
echo "Checksum verification failed.";
}
By verifying the checksum, you can confirm that the callback data has not been altered during transmission, enhancing the security of your integration.