Skip to content

Attaches carrier and tracking details to a specific capture, useful for buyer communications and for carriers/schemes that expect delivery tracking on file. It's scoped to one capture, not the whole transaction, since a single order can ship (and be captured) in multiple parts. See the official documentation for adding shipping information.

import com.ratepay.sdk.ShippingInformationOutcome;
import com.ratepay.sdk.model.api.payment.CarrierName;
import com.ratepay.sdk.model.api.payment.ShippingInformationRequest;

ShippingInformationRequest request = new ShippingInformationRequest(
    CarrierName.DHL,
    "00340434292135100002"
);

ShippingInformationOutcome outcome =
    client.sendShippingInformation(ratepayTransactionId, ratepayCaptureId, request, null);

if (outcome.kind() == ShippingInformationOutcome.Kind.ACCEPTED) {
    var accepted = (ShippingInformationOutcome.Accepted) outcome;
    System.out.println("Recorded: " + accepted.getRatepayShippingInformationId());
} else {
    var declined = (ShippingInformationOutcome.Declined) outcome;
    System.out.println("Declined: " + declined.getDecline().getCategory());
}

trackingNumber is optional as some carrier/fulfillment setups (e.g. OTHER_WITHOUT_TRACKING) don't have one. carrierName accepts a fixed enum (DHL, UPS, FEDEX, GLS, and others). See CarrierName for the full list.

Exceptions

ExceptionHTTP Status Code
RatepayAuthException401/403
RatepayValidationException400
RatepayTransactionNotFoundException404
RatepayLegalException451
RatepayNetworkException5xx/transport

Next

  • Error handling for the full exception reference across every operation.