Important information

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


[Deprecated] Confirm shipment

Confirm shipping your goods to the customer and activate the insurance.

Shipment is the process of sending the goods to the customer. Once you have sent the goods, you must confirm the shipment to activate the insurance requested in the previous /charge request. The customer now has 40 days after this date to make the payment. You receive the money regardless of whether the customer pays or not.

Shipment is available for Unzer Invoice Secured and Unzer Installment.

To confirm a shipment, you can call the ship method of the unzer or payment object.

Your invoice payments are only paid out if you send a shipping transaction.

For a full list of the ship request parameter, please refer to API reference.

Unzer unzer = new Unzer('s-priv-xxxxxxxxxx');
Shipment shipment = unzer.shipment('s-pay-1');

Arguments to Unzer.ship

paymentIdStringThe ID of the payment resource.
Required: true
invoiceIdStringThe ID of the invoice in your shop. Only applicable in case of invoice payment types.
Required: In case of invoice payment types and if it has not been set before.
Default: null
orderIdStringThe ID of the order in your store.
This ID can be used to fetch the Payment resource from the Unzer API using the method unzer.fetchPayment(paymentId)
Required: false
Default: null

Transaction Results

The transaction response is stored in the transaction object. It contains a paymentId (for example, s-pay-1) the transactionId and other properties of the response. The transaction object provides getter functions to access those properties. For example, shipment.getPaymentId()

The status indicates the result of the transaction. Possible values: SUCCESS, PENDING, or ERROR.

If a transaction fails, the Unzer API returns an error resource instead of a transaction. In the SDK this is handled as an UnzerPaymentException. Make sure to catch that case properly.

You can find an example transaction response on the Confirm shipment page.

try {
    Unzer unzer  = new Unzer("s-priv-xxxxxxxxxx");
    Shipment shipment = unzer.shipment(paymentId);

    if (shipment.Status.equals(Shipment.Status.SUCCESS)) {
    // Transaction has to be pending at this point.
} catch (HttpCommunicationException | PaymentException e) {
    // Transaction failed. API returned error resource.
    List<PaymentError> paymentErrorList = e.getPaymentErrorList();
    //Handle API Errors
    this.redirectToFailure(); // redirect to the failure page of your shop
} catch (Exception e) {
    merchantMessage = e.getMessage();