skip to Main Content
  1. 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);
}
  1. 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);
  1. 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


  1. Chosen as BEST ANSWER

    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)


  2. The initial and last issue:

    "Failure: Invalid merchandise description of package (120623)"

    Can be fixed by ensuring package properties are all correctly set, for example, if $referenceNumber is bar-code, try:

    use UpsEntityReferenceNumber as RefNum;
    
    // ...
    
    foreach ($shipment->getPackages() as $package) {
        $refNum = new RefNum();
        $refNum->setBarCodeIndicator(true);
        $refNum->setValue("MY_PACKAGE_BAR_CODE");
    
        $refNum->setCode(RefNum::CODE_SERIAL_NUMBER);
    
        // Alias (to match OP's naming).
        $referenceNumber = $refNum;
    
        $package->setReferenceNumber($referenceNumber);
    } // foreach $package
    

    WARNING: I am not sure if CODE_SERIAL_NUMBER means bar-code, hence if that does not work, try other codes visible in ReferenceNumber.php file.

    The second issue:

    "Failure: Shipment/ReferenceNumber is not allowed for this shipment (120541)"

    Means "$shipment->setReferenceNumber(...);" is not allowed for your request’s type, hence don’t do that (unless you are sure you need it).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search