src/Shipment.php
public function requestShipmentRefund($shipment_id, $email, $options)
    {
        $content = [
            'email' => $email,
        ];

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

        $endpoint = sprintf(
            'rs/%s/%s/shipment/%s/refund',
            $this->config['customer_number'],
            $this->config['customer_number'],
            $shipment_id
        );
        $response = $this->post(
            $endpoint,
            [
                'Content-Type' => 'application/vnd.cpc.shipment-v8+xml',
                'Accept' => 'application/vnd.cpc.shipment-v8+xml',
            ],
            $payload,
            $options
        );
        return $response;
    }
public function requestShipmentRefund($shipment_id, $email, $options)
    {
        $content = [
            'email' => $email,
        ];

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

        $endpoint = sprintf(
            'rs/%s/%s/shipment/%s/refund',
            $this->config['customer_number'],
            $this->config['customer_number'],
            $shipment_id
        );
        $response = $this->post(
            $endpoint,
            [
                'Content-Type' => 'application/vnd.cpc.shipment-v8+xml',
                'Accept' => 'application/vnd.cpc.shipment-v8+xml',
            ],
            $payload,
            $options
        );
        return $response;
    }
public function requestShipmentRefund ( $ shipment_id , $ email , $ options ) { $ content = [ 'email' => $ email , ] ; $ xml = Array2XML :: createXML ( 'non-contract-shipment-refund-request' , $ content ) ; $ envelope = $ xml -> documentElement ; $ envelope -> setAttribute ( 'xmlns' , 'http://www.canadapost.ca/ws/shipment-v8' ) ; $ payload = $ xml -> saveXML ( ) ; $ endpoint = sprintf ( 'rs/%s/%s/shipment/%s/refund' , $ this -> config [ 'customer_number' ] , $ this -> config [ 'customer_number' ] , $ shipment_id ) ; $ response = $ this -> post ( $ endpoint , [ 'Content-Type' => 'application/vnd.cpc.shipment-v8+xml' , 'Accept' => 'application/vnd.cpc.shipment-v8+xml' , ] , $ payload , $ options ) ; return $ response ; }
Request a refund for a shipment that has been transmitted.

@param string $shipment_id
The shipment id.
@param string $email
The email that will receive updates from Canada Post.
@param array $options
The options to pass along to the Guzzle Client.

@return \DOMDocument
@throws \GuzzleHttp\Exception\GuzzleException
@see https://www.canadapost.ca/cpo/mc/business/productsservices/developers/services/shippingmanifest/shipmentrefund.jsf
for all available options for the sender,destination and parcel params.
Request a refund for a shipment that has been transmitted .