alt

Important information

There was an update of Unzer TLS/SSL certificates. Learn more

Unzer

Manage Unzer Prepayment payments

Manage Unzer prepayment transactions

After the successful charge transaction, you can perform additional operations on the payment resource. Below you can see the most important cases for the Prepayment payment type.

For a full description of the charge transaction, refer to the relevant server-side integration documentation page: Charge a payment (direct API calls), Charge a payment (PHP SDK), Charge a payment (Java SDK).

Cancel before money receipt (reversal)

If the customer wants to cancel an order, before the money has been received, you have to make a cancel call on the initial Charge transaction.

POST https://api.unzer.com/v1/payments/s-pay-xxxxxxx/charges/s-chg-1/cancels
$cancellation = $unzer->cancelChargeById(
  's-pay-xxxxxxxxx,
  's-chg-1'
);
Cancel cancel = unzer.cancelCharge(
  "s-pay-xxxxxxxxx",
  "s-chg-1"
);
icon
The reversal will always be done on the initial transaction, thus the id will always be s-chg-1 or p-chg-1 respectively.

Cancel after payment (refund)

In case you received a payment for an order the customer wants to cancel, you can refund it up to the amount of the received payments. To do this you have to make a Cancel transaction on Charge(s) received via notification.

POST: https://api.unzer.com/v1/payments/s-pay-xxxxxxx/charges/s-chg-2/cancels
{
  "amount": 12.99,
  "paymentReference": "Test cancel transaction"
}
$cancellation = $unzer->cancelChargeById(
  's-pay-xxxxxxxxx,
  's-chg-2'
);
Cancel cancel = unzer.cancelCharge(
  "s-pay-xxxxxxxxx",
  "s-chg-2"
);

The response will look similar ot te 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.9900",
  "currency": "EUR",
  "date": "2021-06-09 10:09:47",
  "resources": {
    "customerId": "s-cst-a0b2dc42b4f9",
    "paymentId": "s-pay-2127",
    "basketId": "",
    "metadataId": "",
    "payPageId": "",
    "traceId": "a902d887e266e24c4a36d0f80ed0555f",
    "typeId": "s-ppy-eh15lfuhrfus"
  },
  "orderId": "o191564001623233177",
  "paymentReference": "",
  "processing": {
    "uniqueId": "31HA07BC8159F6CC0D414B67FABD1444",
    "shortId": "4871.5978.7781",
    "traceId": "a902d887e266e24c4a36d0f80ed0555f"
  }
}
icon
The charges received after the initial charge are actual payments and can be refunded by canceling them.