src/NCShipment.php
public function createNCShipment(
        array $sender,
        array $destination,
        array $parcel,
        array $options = []
    ) {
        $content = $this->buildShipmentArray($sender, $destination, $parcel, $options);

        $xml = Array2XML::createXML('non-contract-shipment', $content);
        $envelope = $xml->documentElement;
        $envelope->setAttribute(
            'xmlns',
            'http://www.canadapost.ca/ws/ncshipment-v4'
        );
        $payload = $xml->saveXML();

        $response = $this->post(
            "rs/{$this->customerNumber}/ncshipment",
            [
                'Accept' => 'application/vnd.cpc.ncshipment-v4+xml',
                'Content-Type' => 'application/vnd.cpc.ncshipment-v4+xml',
            ],
            $payload,
            $options
        );
        return $response;
    }
public function createNCShipment(
        array $sender,
        array $destination,
        array $parcel,
        array $options = []
    ) {
        $content = $this->buildShipmentArray($sender, $destination, $parcel, $options);

        $xml = Array2XML::createXML('non-contract-shipment', $content);
        $envelope = $xml->documentElement;
        $envelope->setAttribute(
            'xmlns',
            'http://www.canadapost.ca/ws/ncshipment-v4'
        );
        $payload = $xml->saveXML();

        $response = $this->post(
            "rs/{$this->customerNumber}/ncshipment",
            [
                'Accept' => 'application/vnd.cpc.ncshipment-v4+xml',
                'Content-Type' => 'application/vnd.cpc.ncshipment-v4+xml',
            ],
            $payload,
            $options
        );
        return $response;
    }
public function createNCShipment ( array $ sender , array $ destination , array $ parcel , array $ options = [ ] ) { $ content = $ this -> buildShipmentArray ( $ sender , $ destination , $ parcel , $ options ) ; $ xml = Array2XML :: createXML ( 'non-contract-shipment' , $ content ) ; $ envelope = $ xml -> documentElement ; $ envelope -> setAttribute ( 'xmlns' , 'http://www.canadapost.ca/ws/ncshipment-v4' ) ; $ payload = $ xml -> saveXML ( ) ; $ response = $ this -> post ( "rs/{$this->customerNumber}/ncshipment" , [ 'Accept' => 'application/vnd.cpc.ncshipment-v4+xml' , 'Content-Type' => 'application/vnd.cpc.ncshipment-v4+xml' , ] , $ payload , $ options ) ; return $ response ; }
Create the shipment.

@param array $sender
The sender info.
<code>
$sender = [
'company'         => 'Acro Media',
'contact-phone'   => '(250) 763-8884',
'address-details' => [
'address-line-1'  => '103-2303 Leckie Rd',
'city'            => 'Kelowna',
'prov-state'      => 'BC',
'postal-zip-code' => 'V1X 6Y5',
],
]
</code>
@param array $destination
The destination info.
<code>
$destination = [
'name'            => 'John Smith',
'address-details' => [
'address-line-1'  => '123 Main St',
'city'            => 'Kelowna',
'prov-state'      => 'BC',
'country-code'    => 'CA',
'postal-zip-code' => 'V1X 1M2',
],
]
</code>
@param array $parcel
The parcel characteristics.
<code>
$parcel = [
'weight'     => 0.500,   // in kg.
'dimensions' => [        // in cm.
'length' => 30,
'width'  => 10,
'height' => 20,
],
],
]
</code>
@param array $options
The options to pass along to the Guzzle Client.

@see https://www.canadapost.ca/cpo/mc/business/productsservices/developers/services/onestepshipping/createshipment.jsf
for all available options for the sender,destination and parcel params.
@return \DOMDocument
@throws \GuzzleHttp\Exception\GuzzleException
Create the shipment .