I am using Amazon sp-api and confirming the Tracking Number like below:
public bool UpdateTrackingNumber(DtoShipment dto)
{
ConfirmShipmentOrderItemsList orderItems = new ConfirmShipmentOrderItemsList();
foreach (OrderItem item in dto.LstOrderItem)
{
orderItems.Add(new ConfirmShipmentOrderItem(item.OrderItemId, item.Quantity));
}
ConfirmShipmentRequest confirmShipmentRequest = new ConfirmShipmentRequest()
{
MarketplaceId = getMarketPlaceId(dto.CountryCode),
PackageDetail = new PackageDetail()
{
TrackingNumber = dto.TrackingNumber,
CarrierName = dto.CarrierName, // "DPD Home 0-31.5kg"
CarrierCode = dto.CarrierCode, // "DPD"
PackageReferenceId = "1",
ShipDate = DateTime.UtcNow,
OrderItems = orderItems
}
};
AmazonConnection _connAmazon = createAmazonConnection("marketplaceId");
return _connAmazon.Orders.ConfirmShipment(dto.AmazonOrderId, confirmShipmentRequest);
}
It sets the Tracking Number successfully, but the "Delivery Service" field stays empty. I am not sure that was a problem or not, but I am wondering if it is possible to set that value also with this method?
Edit: When I set the tracking number by using Amazon interface, "DPD" is automatically selected for "Carrier" and "Other" is automatically selected for "Delivery Service" and "DPD Home 0-31.5kg" is under that.
Edit 2:
When I set via API, Tracking Number and Carrier have been set, but "Delivery Service" is not."

If I use Amazon interface, Amazon brings me all fields filled like that. I only write the "Tracking Number" and confirm shipment.

Edit 3: Thanks @Charlieface, It worked like that:
PackageDetail = new PackageDetail()
{
TrackingNumber = dto.TrackingNumber,
CarrierName = "",
CarrierCode = dto.CarrierCode, // "DPD"
PackageReferenceId = "1",
ShipDate = DateTime.UtcNow,
OrderItems = orderItems,
ShippingMethod = dto.CarrierName // "DPD Home 0-31.5kg"
}
Thanks in advance.
The documentation indicates a
shippingMethodproperty.Process of elimination leads to this property being the one used for the "Delivery Srevice", and that is what we have found works.