alt

Important information

The API reference is now available here.
The deprecated API reference is available here.

Unzer

Manage Unzer Invoice payment

Manage Unzer Invoice payments for your customers

After the successful charge transaction, you can perform additional operations on the payment resource. Below you can see the most important cases for Unzer Invoice. For a full reference of managing payments, see the relevant server-side integration documentation page: Manage API resources (direct API calls), Manage API resources (PHP SDK), Manage API resources (Java SDK).

Cancel before money receipt (reversal)

If the customer returns an item from the order or cancels it all together, before the money has been received, then this amount is deducted from the charge amount. In the example below, if the customer cancels goods worth 15 EUR, it is deducted from the total amount of 70 EUR and 55 EUR is now the updated total amount.

POST https://api.unzer.com/v1/payments/s-pay-xxxxxxxxx/charges/s-chg-1/cancels \

Body:
{
  "amount": "100.0",
}
$cancellation = $unzer->cancelChargeById(
  's-pay-xxxxxxxxx,
  's-chg-1'
);
Cancel cancel = unzer.cancelCharge(
  "s-pay-1",
  "s-chg-1"
);

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 money receipt (refund)

In case you already 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-xxxxxx/charges/s-chg-2/cancels \

Body:
{
  "amount" : "12.450",
  "paymentReference": "Test cancel transaction"
}
$cancellation = $unzer->cancelChargeById(
  's-pay-xxxxxxxxx,
  's-chg-2'
);
Cancel cancel = unzer.cancelCharge(
  "s-pay-xxxxxxxxx",
  "s-chg-2"
);

The charges received after the initial charge are actual payments and can be refunded by canceling them.