$ShipmentTransmitSet = new ShipmentTransmitSetType(); $GroupIds = new GroupIdListType(); $GroupIds->setGroupId('4326432'); $ShipmentTransmitSet->addGroupId($GroupIds); $ShipmentTransmitSet->setRequestedShippingPoint('H2B1A0'); $ShipmentTransmitSet->setCpcPickupIndicator(true); $ShipmentTransmitSet->setDetailedManifests(true); $ShipmentTransmitSet->setMethodOfPayment('Account'); $ManifestAddress = new ManifestAddressType(); $ManifestAddress->setManifestCompany('MajorShop'); $ManifestAddress->setPhoneNumber('514 829 5879'); $AddressDetails = new AddressDetailsType(); $AddressDetails->setAddressLine1('1230 Tako RD.'); $AddressDetails->setCity('Ottawa'); $AddressDetails->setProvState('ON'); $AddressDetails->setCountryCode('CA'); $AddressDetails->setPostalZipCode('H2B1A0'); $ManifestAddress->setAddressDetails($AddressDetails); $ShipmentTransmitSet->setManifestAddress($ManifestAddress); // Initiate Canada Post's API $Shipping = new Shipping(['api_customer_number' => CANADA_POST_API_CUSTOMER_NUMBER, 'api_key' => CANADA_POST_API_KEY, 'env' => WebService::ENV_DEV, 'ssl' => true]); // Send request to transmit shipments $transmitShipmentsResponse = $Shipping->transmitShipments($ShipmentTransmitSet); // Output result for debug if ($transmitShipmentsResponse instanceof ManifestsType) { var_dump($transmitShipmentsResponse); } elseif ($transmitShipmentsResponse instanceof MessagesType) { var_dump($transmitShipmentsResponse); } else { throw new \Exception('Unexpected response.'); }