- I am receiving the below error message after the implementation return service.
Failure: Invalid merchandise description of package (120623)
Code what we used.
if (isset($return_order) && $return_order==1) {
$returnService = new UpsEntityReturnService;
$returnService->setCode(UpsEntityReturnService::PRINT_RETURN_LABEL_PRL);
$shipment->setReturnService($returnService);
}
- If I also use the below code then it gives as mention error
Failure: Shipment/ReferenceNumber is not allowed for this shipment (120541)
Code what we used.
if (isset($return_order) && $return_order==1) {
$referenceNumber->setCode(UpsEntityReferenceNumber::CODE_RETURN_AUTHORIZATION_NUMBER);
$referenceNumber->setValue($shipping_reference_number);
} else {
$referenceNumber->setCode(UpsEntityReferenceNumber::CODE_INVOICE_NUMBER);
$referenceNumber->setValue($shipping_reference_number);
}
$shipment->setReferenceNumber($referenceNumber);
- If I also use the below code then it gives as mention error
Failure: Invalid merchandise description of package (120623)
Code what we used.
if (isset($return_order) && $return_order==1) {
$referenceNumber->setCode(UpsEntityReferenceNumber::CODE_RETURN_AUTHORIZATION_NUMBER);
$referenceNumber->setValue($shipping_reference_number);
} else {
$referenceNumber->setCode(UpsEntityReferenceNumber::CODE_INVOICE_NUMBER);
$referenceNumber->setValue($shipping_reference_number);
}
$shipment->getPackages()[0]->setReferenceNumber($referenceNumber);
I’m using the following package, https://github.com/gabrielbull/php-ups-api
2
Answers
I am passing the description on the package below. I just removed "box type" and it works like boom.
$package->setDescription("box type : ".$box_type)
The initial and last issue:
Can be fixed by ensuring package properties are all correctly set, for example, if
$referenceNumber
is bar-code, try:The second issue:
Means "
$shipment->setReferenceNumber(...);
" is not allowed for your request’s type, hence don’t do that (unless you are sure you need it).