Manage SEPA Direct Debit payment
Manage SEPA Direct Debit payments.
Manage payments
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)
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-xxxx/charges/s-chg-1/cancels
{
"amount" : "12.450",
"paymentReference": "Test cancel transaction"
}
$unzer = new Unzer('s-priv-xxxxxxxxxx');
$charge = $unzer->fetchChargeById('s-pay-xxxx', 's-chg-1');
$cancel = $charge->cancel();
Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");
Charge charge = unzer.fetchChargeById("s-pay-xxxx", "s-chg-1");
Cancel cancel = charge.cancel();
Update the bank details (mandate amendment)
To change the IBAN, BIC or account holder of a payment type, send a PUT request with your public key. Only the fields that you send are changed.
If the payment type has a recurring mandate (recurring: true), the change is recorded on the existing mandate as an amendment. The mandateId and mandateSignatureDate stay the same, and the payment type stays recurring. The mandate is flagged as amended (SEPA amendment indicator), and the previous IBAN or account holder is kept in the mandate’s amendment history.
For a payment type with recurring: false, only the payment type is updated. The next charge creates a new one-off mandate with the new bank details.
If the mandate was revoked, the bank details are updated, but the payment type can still not be charged. Create a new payment type instead.
PUT https://api.unzer.com/v1/types/sepa-direct-debit/s-sdd-x9z2efxuebce
{
"iban" : "DE46940594210000012345",
"holder" : "Maximilian Mustermann"
}
The response contains the updated payment type.
Revoke the mandate
When the customer withdraws the mandate, for example when they cancel a subscription, revoke it with a DELETE request on the payment type, using your private key.
DELETE https://api.unzer.com/v1/types/sepa-direct-debit/s-sdd-x9z2efxuebce
The response contains the updated payment type, with recurring set to false:
{
"id": "s-sdd-x9z2efxuebce",
"method": "sepa-direct-debit",
"recurring": false,
"geoLocation": {
"clientIp": "127.0.0.143",
"countryIsoA2": "DE"
},
"iban": "DE89370400440532013000",
"bic": "",
"holder": "Maximilian Mustermann",
"mandateId": "3f2a9c1e-7b4d-4e8a-9f61-2c5d8e0b4a17"
}
- For a payment type with
recurring: true, the reusable mandate is cancelled. The response keeps themandateIdof the revoked mandate, sorecurring: falsetogether with amandateIdmeans that the mandate was revoked. - For a payment type with
recurring: false, no mandate is stored on the payment type, so only the payment type is revoked. - After the revocation, every
chargewith this payment type is rejected with HTTP status400and the error codeAPI.330.010.028(You are not allowed to charge the type resource {typeId}, as its SEPA mandate has been revoked.). Refunds (cancelon a charge) of payments that were already collected are still possible. - If you revoke a payment type that is already revoked, the request succeeds and nothing changes.
- If the payment type does not belong to your merchant account, the response is
404.
Mandate expiry
A recurring mandate (recurring: true) expires if it is not used for 36 months. The 36 months start on the signature date and start again with every charge under the mandate. For example, this can happen when a subscription is paused for a long time.
A charge on an expired mandate is rejected with the error code 000.100.211 (Mandate expired and can no longer be used for collections). To collect again, create a new payment type with recurring: true and get the customer’s approval for the new mandate.
