2

I have faced the following error when I integrate FedEx shipment API with Laravel. I use this package for it - https://github.com/JeremyDunn/php-fedex-api-wrapper

If anyone knows how to create shipment request with FedEx API, so please help me to resolve this issues, I have sow this type error message "Action type TRANSFER is not allowed for this request." with error code 3630.

I have also added my response output code so you all are understood very well

my Laravel Code

$userCredential = new \FedEx\ShipService\ComplexType\WebAuthenticationCredential();
    $userCredential
        ->setKey('NCimB3Bq5GtxAQx7')
        ->setPassword('Zr1Bb3P1pjYtz0miXdIjut2OW');

    $webAuthenticationDetail = new \FedEx\ShipService\ComplexType\WebAuthenticationDetail();
    $webAuthenticationDetail->setUserCredential($userCredential);

    $clientDetail = new \FedEx\ShipService\ComplexType\ClientDetail();
    $clientDetail
        ->setAccountNumber('510087160')
        ->setMeterNumber('118814986');

    $version = new \FedEx\ShipService\ComplexType\VersionId();
    $version
        ->setMajor(12)
        ->setIntermediate(1)
        ->setMinor(0)
        ->setServiceId('ship');

    $shipperAddress = new \FedEx\ShipService\ComplexType\Address();
    $shipperAddress
        ->setStreetLines(array(
            '1202 Chalet Ln',
            'Do Not Delete - Test Account'
        ))
        ->setCity('Harrison')
        ->setStateOrProvinceCode('AR')
        ->setPostalCode('72601')
        ->setCountryCode('US');

    $shipperContact = new \FedEx\ShipService\ComplexType\Contact();
    $shipperContact
        ->setCompanyName('Company Name')
        ->setEMailAddress('test@example.com')
        ->setPersonName('Person Name')
        ->setPhoneNumber(('123-123-1234'));

    $shipper = new \FedEx\ShipService\ComplexType\Party();
    $shipper
        ->setAccountNumber('510087020')
        ->setAddress($shipperAddress)
        ->setContact($shipperContact);

    $recipientAddress = new \FedEx\ShipService\ComplexType\Address();
    $recipientAddress
        ->setStreetLines(array('54312 1st Ave'))
        ->setCity('Anytown')
        ->setStateOrProvinceCode('NY')
        ->setPostalCode('12345')
        ->setCountryCode('US');

    $recipientContact = new \FedEx\ShipService\ComplexType\Contact();
    $recipientContact
        ->setPersonName('Contact Name');

    $recipient = new \FedEx\ShipService\ComplexType\Party();
    $recipient
        ->setAddress($recipientAddress)
        ->setContact($recipientContact);

    $labelSpecification = new \FedEx\ShipService\ComplexType\LabelSpecification();
    $labelSpecification
        ->setLabelStockType(new \FedEx\ShipService\SimpleType\LabelStockType(\FedEx\ShipService\SimpleType\LabelStockType::_PAPER_7X4point75))
        ->setImageType(new \FedEx\ShipService\SimpleType\ShippingDocumentImageType(\FedEx\ShipService\SimpleType\ShippingDocumentImageType::_PDF))
        ->setLabelFormatType(new \FedEx\ShipService\SimpleType\LabelFormatType(\FedEx\ShipService\SimpleType\LabelFormatType::_COMMON2D));


    $requestedShipment = new \FedEx\ShipService\ComplexType\RequestedShipment();
    $requestedShipment->setShipTimestamp(date('c'));
    $requestedShipment->setDropoffType(new \FedEx\ShipService\SimpleType\DropoffType(\FedEx\ShipService\SimpleType\DropoffType::_REGULAR_PICKUP));
    $requestedShipment->setServiceType(new \FedEx\ShipService\SimpleType\ServiceType(\FedEx\ShipService\SimpleType\ServiceType::_FEDEX_GROUND));
    $requestedShipment->setPackagingType(new \FedEx\ShipService\SimpleType\PackagingType(\FedEx\ShipService\SimpleType\PackagingType::_FEDEX_BOX));
    $requestedShipment->setShipper($shipper);
    $requestedShipment->setRecipient($recipient);
    $requestedShipment->setLabelSpecification($labelSpecification);
    $requestedShipment->setRateRequestTypes(array(new \FedEx\ShipService\SimpleType\RateRequestType(\FedEx\ShipService\SimpleType\RateRequestType::_ACCOUNT)));
    $requestedShipment->setPackageCount(2);




    $createPendingShipmentRequest = new \FedEx\ShipService\ComplexType\CreatePendingShipmentRequest();
    // dd($webAuthenticationDetail::_NAME);
    $createPendingShipmentRequest->setWebAuthenticationDetail($webAuthenticationDetail);
    $createPendingShipmentRequest->setClientDetail($clientDetail);
    $createPendingShipmentRequest->setVersion($version);
    $createPendingShipmentRequest->setRequestedShipment($requestedShipment);
    // dd($createPendingShipmentRequest);




    $shipService = new \FedEx\ShipService\Request();
    $shipService->getSoapClient()->__setLocation('https://wsbeta.fedex.com/web-services/ship');
    $result = $shipService->getCreatePendingShipmentReply($createPendingShipmentRequest);
    dd($result);

My Responce output

{#389 ▼
  +"HighestSeverity": "ERROR"
  +"Notifications": array:2 [▼
    0 => {#390 ▼
      +"Severity": "ERROR"
      +"Source": "ship"
      +"Code": "3630"
      +"Message": "Action type TRANSFER is not allowed for this request."
      +"LocalizedMessage": "Action type TRANSFER is not allowed for this request."
      +"MessageParameters": {#391 ▼
        +"Id": "ACTION"
        +"Value": "TRANSFER"
      }
    }
    1 => {#392 ▼
      +"Severity": "ERROR"
      +"Source": "ship"
      +"Code": "2021"
      +"Message": "Invalid package count or invalid package sequence number."
      +"LocalizedMessage": "Invalid package count or invalid package sequence number."
    }
  ]
  +"Version": {#393 ▼
    +"ServiceId": "ship"
    +"Major": 12
    +"Intermediate": 1
    +"Minor": 0
  }
}
cosmoonot
  • 2,161
  • 3
  • 32
  • 38
Harsukh Makwana
  • 4,296
  • 3
  • 27
  • 34

1 Answers1

-1

add this code:

$pendingShipmentDetail = new ComplexType\PendingShipmentDetail();
    $pendingShipmentDetail
        ->setType(SimpleType\PendingShipmentType::_EMAIL)
        ->setExpirationDate('06/12/2017')
        ->setEmailLabelDetail(new ShipComplexType\EMailLabelDetail(array(
            'NotificationEMailAddress' => 'test@gmail.com',
            'NotificationMessage' => 'pending shipment notification message'
        )));
    $specialServicesRequested = new ComplexType\ShipmentSpecialServicesRequested();
    $specialServicesRequested
        ->setSpecialServiceTypes(array(SimpleType\ShipmentSpecialServiceType::_PENDING_SHIPMENT))
        ->setPendingShipmentDetail($pendingShipmentDetail);


$requestedShipment->setSpecialServicesRequested($specialServicesRequested);
  • No explanation, no indication where this should even go. Even understanding where it should go, this does not resolve the issue. – Adam Jul 26 '23 at 01:04