Manage Unzer Instalment payment

Manage Unzer Instalment payments.

After the successful charge transaction, you can perform additional operations on the payment resource. The following are sone of the most important cases for Unzer Instalment. 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).

Full Shipment

You have to make a shipment transaction in order for the merchant to actually receive money. partial shipment is not possible

Examples:

POST https://api.unzer.com/v1/payments/s-pay-1234/shipments 

{
  "invoiceId": "invoice-nr-1"
}
$unzer = new Unzer("s-priv-xxxxxxxxxxx");
$shipment = $unzer->ship('s-pay-xxxxxxxxxx', 'InvoiceId');
Unzer unzer = new Unzer("s-priv-xxxxxxxxxxx");
Shipment shipment = unzer.shipment("s-pay-xxxxxxxxxx");

The response looks similar to the following example:

{
  "id": "s-shp-1",
  "isSuccess": true,
  "isPending": false,
  "isError": false,
  "message": {
    "code": "OK",
    "customer": "Successfully created."
  },
  "amount": "119.0000",
  "currency": "EUR",
  "date": "2021-06-15 08:24:11",
  "resources": {
    "customerId": "s-cst-xxxxxxx",
    "paymentId": "s-pay-174811",
    "basketId": "s-bsk-xxxxxxx",
    "metadataId": "",
    "payPageId": "",
    "traceId": "23dc97dac8f55b870c93048d251af12f",
    "typeId": "s-ins-fiqgzhw6j2su"
  },
  "processing": {
    "externalOrderId": "8b9718f3-6b5d-40b7-9376-79bf74818cbe",
    "zgReferenceId": "4702417365603530003141093",
    "uniqueId": "31HA07BC811A66C29D3E1BD0E2B4ED4A",
    "shortId": "4876.7185.0557",
    "traceId": "23dc97dac8f55b870c93048d251af12f"
  }
}

Cancel after payment (refund)

In order to cancel the payment, you have to make a cancel transaction on the initial charge transaction

POST https://api.unzer.com/v1/payments/{paymentId}/charges/s-chg-1/cancels
$unzer = new Unzer("s-priv-xxxxxxxxxxx");
$cancellation = $unzer->cancelChargeById(
  's-pay-xxxxxxxxx,
  's-chg-1',
);
Unzer unzer = new Unzer("s-priv-xxxxxxxxxxx");
Cancel cancel = unzer->cancelChargeById(
  's-pay-xxxxxxxxx,
  's-chg-1'
);

The response looks similar to the 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": "Ihre Zahlungen wurden erfolgreich im Sandbox-Mode verarbeitet."
    },
    "amount": "12.9900",
    "currency": "EUR",
    "date": "2021-06-15 08:21:50",
    "resources": {
        "customerId": "s-cst-c8c84198f061",
        "paymentId": "s-pay-936",
        "basketId": "",
        "metadataId": "",
        "payPageId": "",
        "traceId": "38150a9ca6b89e3a8d600e00195936f8",
        "typeId": "s-ins-f0nyllaslido"
    },
    "orderId": "o949869001623745140",
    "paymentReference": "Test Cancel Transaction",
    "processing": {
        "uniqueId": "31HA07BC811A66C29D3E9CDE4C0F3DE1",
        "shortId": "4876.7171.0427",
        "traceId": "38150a9ca6b89e3a8d600e00195936f8"
    }
}