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 Google Pay payment

Manage Google Pay™ transactions.

After the successful charge or authorize 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 before money receipt (reversal)

To reduce or cancel a reservation on the customer account, perform a cancel on the initial transaction. An example of reversal would be unblocking the reserved amount on the customer account after they returned a rented car.

icon
Partial cancellation (reversal) is not supported.
POST https://api.unzer.com/v1/payments/s-pay-1/authorize/cancels

{
}
$unzer = new Unzer('s-priv-xxxxxxxxxx');
$payment = $unzer->fetchPayment('s-pay-1');
$unzer->cancelAuthorizationByPayment($payment, 20.00);
Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");
Authorization authorization = unzer.fetchAuthorization('s-pay-1');
Cancel cancel = authorization.cancel();

The response looks similar to the following example:

{
    "id": "s-cnl-1",
    "isSuccess": true,
    "isPending": false,
    "isResumed": false,
    "isError": false,
    "card3ds": true,
    "message": {
        "code": "COR.000.000.000",
        "merchant": "Transaction succeeded",
        "customer": "Your payments have been successfully processed."
    },
    "amount": "105.9500",
    "currency": "EUR",
    "date": "2024-02-14 10:34:09",
    "resources": {
        "customerId": "s-cst-b7e502fcbb10",
        "paymentId": "s-pay-1",
        "basketId": "s-bsk-7e772dd4266b",
        "metadataId": "",
        "payPageId": "",
        "traceId": "aaf9c131adb06fa4c2552cf5acf6071a",
        "typeId": "s-gop-p6gwgiuvjigm"
    },
    "orderId": "1707906783-208",
    "paymentReference": "",
    "processing": {
        "uniqueId": "31HA07BC8127F6AE26D47CFB15FCD7DA",
        "shortId": "5718.3324.9541",
        "traceId": "aaf9c131adb06fa4c2552cf5acf6071a"
    }
}

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 on the charges received through webhooks. It is also possible to perform cancel on the partial charge transaction by providing the partially charged amount in the request.

POST https://api.unzer.com/v1/payments/s-pay-1/charges/s-chg-1/cancels
{
  "amount" : "105.95",
  "paymentReference": "Test cancel transaction"
}
$unzer = new Unzer('s-priv-xxxxxxxxxx');
$charge = $unzer->fetchChargeById('s-pay-1', 's-chg-1');
$cancel = $charge->cancel();
{
    "id": "s-cnl-1",
    "isSuccess": true,
    "isPending": false,
    "isResumed": false,
    "isError": false,
    "card3ds": true,
    "message": {
        "code": "COR.000.000.000",
        "merchant": "Transaction succeeded",
        "customer": "Your payments have been successfully processed."
    },
    "amount": "105.9500",
    "currency": "EUR",
    "date": "2024-02-14 10:34:09",
    "resources": {
        "customerId": "s-cst-b7e502fcbb10",
        "paymentId": "s-pay-1",
        "basketId": "s-bsk-7e772dd4266b",
        "metadataId": "",
        "payPageId": "",
        "traceId": "aaf9c131adb06fa4c2552cf5acf6071a",
        "typeId": "s-gop-p6gwgiuvjigm"
    },
    "orderId": "1707906783-208",
    "paymentReference": "",
    "processing": {
        "uniqueId": "31HA07BC8127F6AE26D47CFB15FCD7DA",
        "shortId": "5718.3324.9541",
        "traceId": "aaf9c131adb06fa4c2552cf5acf6071a"
    }
}

The response looks similar to the following example:

{
    "id": "s-cnl-1",
    "isSuccess": true,
    "isPending": false,
    "isResumed": false,
    "isError": false,
    "card3ds": true,
    "message": {
        "code": "COR.000.000.000",
        "merchant": "Transaction succeeded",
        "customer": "Your payments have been successfully processed."
    },
    "amount": "105.9500",
    "currency": "EUR",
    "date": "2024-02-14 10:34:09",
    "resources": {
        "customerId": "s-cst-b7e502fcbb10",
        "paymentId": "s-pay-1",
        "basketId": "s-bsk-7e772dd4266b",
        "metadataId": "",
        "payPageId": "",
        "traceId": "aaf9c131adb06fa4c2552cf5acf6071a",
        "typeId": "s-gop-p6gwgiuvjigm"
    },
    "orderId": "1707906783-208",
    "paymentReference": "",
    "processing": {
        "uniqueId": "31HA07BC8127F6AE26D47CFB15FCD7DA",
        "shortId": "5718.3324.9541",
        "traceId": "aaf9c131adb06fa4c2552cf5acf6071a"
    }
}