# Adding shipping information 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](https://docs.ratepay.com/docs/developer/api_integration/payment_2.0/payment_api_2.0). ```java Java 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()); } ``` ```kotlin Kotlin import com.ratepay.sdk.ShippingInformationOutcome import com.ratepay.sdk.model.api.payment.CarrierName import com.ratepay.sdk.model.api.payment.ShippingInformationRequest val request = ShippingInformationRequest( carrierName = CarrierName.DHL, trackingNumber = "00340434292135100002", ) when (val outcome = client.sendShippingInformation(ratepayTransactionId, ratepayCaptureId, request)) { is ShippingInformationOutcome.Accepted -> println("Recorded: ${outcome.ratepayShippingInformationId}") is ShippingInformationOutcome.Declined -> println("Declined: ${outcome.decline.category}") } ``` `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 | Exception | HTTP Status Code | | --- | --- | | `RatepayAuthException` | 401/403 | | `RatepayValidationException` | 400 | | `RatepayTransactionNotFoundException` | 404 | | `RatepayLegalException` | 451 | | `RatepayNetworkException` | 5xx/transport | ## Next - [Error handling](/docs/developer/sdk/errors-and-resilience/exception-hierarchy) for the full exception reference across every operation.