Cancel Devalue
Reverse a previous giftcard deduction. Use this when a customer does not complete their purchase after the card has been charged.
How it works:
When you devalue a card, the response includes a one-time
cancel_token. Send this token to the Cancel Devalue endpoint and we reload the exact deducted amount back onto the card.
Endpoint
Live
POST
https://business.festivalcadeau.com/api/endpoint/v1/canceldevalue
Sandbox
POST
https://business.festivalcadeautestsite.nl/api/endpoint/v1/canceldevalue
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apikey |
string | Yes | Your API key |
company_id |
integer | Yes | Your company ID |
cancel_token |
string | Yes | The one-time token received from the Devalue response |
Success Response 200 OK
{
"success": true,
"amount_refunded": 2500,
"card_new_balance": 5000
}
Error Responses
401 Authentication Failed
{
"success": false,
"error": "Authentication Failed"
}
422 Missing Token
{
"success": false,
"error": "Missing required field: cancel_token"
}
404 Invalid Token
{
"success": false,
"error": "Invalid cancel token"
}
409 Token Already Used
{
"success": false,
"error": "Cancel token has already been used"
}
Example Usage (PHP)
<?php
$url = 'https://business.festivalcadeau.com/api/endpoint/v1/canceldevalue';
$data = [
'apikey' => 'your-api-key',
'company_id' => 123,
'cancel_token' => 'a1b2c3d4e5f6...' // from your /devalue response
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "Refunded: €" . number_format($result['amount_refunded'] / 100, 2) . "\n";
echo "Card new balance: €" . number_format($result['card_new_balance'] / 100, 2) . "\n";
} else {
echo "Cancel failed: " . $result['error'] . "\n";
}
Important Notes
- Each
cancel_tokencan only be used once. After a successful cancellation, the token is invalidated. - The refunded amount is always the exact amount that was deducted in the original devalue call. You cannot specify a custom amount.
- Store the
cancel_tokenon your side immediately after a successful devalue. If the customer abandons the checkout, call this endpoint to refund the card.