alt

Important information

Please be advised that there will be a scheduled downtime across our API network on November 05 and November 07, 2024. For more information, visit our platform status portal.:
- Scheduled maintenance on November 5, 2024
- Scheduled maintenance on November 7, 2024

Unzer

Manage Bancontact payment

Manage Bancontact transactions.

After the successful charge transaction, you can perform additional operations on the payment resource. Some of the important ones are described in the following section.

For a full reference of managing payments, go to relevant server-side integration documentation page: Manage API resources (direct API calls), Manage API resources (PHP SDK), or Manage API resources (Java SDK).

Cancel after payment (refund)

You can refund up to the amount of the received payment. To do this, you have to make a cancel transaction for an existing charge transaction.

POST https://api.unzer.com/v1/payments/s-pay-1/charges/s-chg-1/cancels
{
  "amount" : "12.450",
  "paymentReference": "Test cancel transaction"
}
$unzer = new Unzer('s-priv-xxxxxxxxxx');
$charge = $unzer->fetchChargeById('s-pay-1', 's-chg-1');
$cancel = $charge->cancel();
Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");
Cancel cancel = unzer.cancelCharge("s-pay-1", "s-chg-1");

The response looks similar to the following example:

{
  "id": "s-cnl-1",
  "isSuccess": true,
  "isPending": false,
  "isError": false,
  "message": {
    "code": "COR.000.100.112",
    "merchant": "Request successfully processed in 'Merchant in Connector Test Mode'",
    "customer": "Your payments have been successfully processed in sandbox mode."
  },
  "amount": "12.4500",
  "currency": "EUR",
  "date": "2021-06-04 10:32:50",
  "resources": {
    "customerId": "",
    "paymentId": "s-pay-172782",
    "basketId": "",
    "metadataId": "",
    "payPageId": "",
    "traceId": "b1b01f0559bb6ba251066c128be31d3d",
    "typeId": ""
  },
  "paymentReference": "Test cancel transaction",
  "processing": {
    "uniqueId": "31HA07BC8198C2F9107E689737A69227",
    "shortId": "4867.2916.5327",
    "traceId": "b1b01f0559bb6ba251066c128be31d3d"
  }
}