Manage TWINT payment
Manage TWINT transactions.
Manage paymentsAfter 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.
Option 1: Without a charge ID
POST https://api.unzer.com/v1/payments/s-pay-5/charges/cancels
{}
$unzer = new Unzer('s-priv-xxxxxxxxxx');
$cancel = $unzer->cancelChargedPayment('s-pay-1', new Cancellation(10.00));
Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");
Cancel cancel = unzer.cancelCharge("s-pay-1", new BigDecimal("10.00"));
Option 2: With a charge ID
POST https://api.unzer.com/v1/payments/s-pay-5/charges/s-chg-1/cancels
{
"amount" : "10.00",
"paymentReference": "Test cancel transaction"
}
$unzer = new Unzer('s-priv-xxxxxxxxxx');
$cancel = $unzer->cancelChargedPayment('s-pay-1', new Cancellation(10.00));
Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");
Cancel cancel = unzer.cancelCharge("s-pay-1", new BigDecimal("10.00"));
The response looks similar to the following example:
{
"id": "s-cnl-1",
"isSuccess": true,
"isPending": false,
"isResumed": false,
"isError": false,
"card3ds": false,
"message": {
"code": "COR.000.000.000",
"merchant": "Transaction succeeded",
"customer": "Your payments have been successfully processed."
},
"amount": "10.0000",
"currency": "CHF",
"date": "2024-04-16 08:22:46",
"resources": {
"customerId": "",
"paymentId": "s-pay-5",
"basketId": "",
"metadataId": "",
"payPageId": "",
"traceId": "6c3d421d0573d5dcf351d35f2514d57f",
"typeId": "s-twt-npwvzkmfsnza"
},
"paymentReference": "",
"processing": {
"uniqueId": "176a2553.03c8.493c.b453.dac1c91440cf",
"shortId": "8777.5842.1376",
"traceId": "6c3d421d0573d5dcf351d35f2514d57f"
}
}