PHP code example of dhl / sdk-api-parcel-de-returns

1. Go to this page and download the library: Download dhl/sdk-api-parcel-de-returns library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dhl / sdk-api-parcel-de-returns example snippets


$authStorage = new \Dhl\Sdk\ParcelDe\Returns\Auth\AuthenticationStorage(
    'apiKey',
    'user',
    'password'
);
$logger = new \Psr\Log\NullLogger();

$serviceFactory = new \Dhl\Sdk\ParcelDe\Returns\Service\ServiceFactory();
$service = $serviceFactory->createReturnLabelService($authStorage, $logger, $sandbox = true);

$requestBuilder = new \Dhl\Sdk\ParcelDe\Returns\Model\ReturnLabelRequestBuilder();
$requestBuilder->setReceiverId($returnRecipient = 'deu');
$requestBuilder->setShipper(
    $name = 'Jane Doe',
    $countryCode = 'DEU',
    $postalCode = '53113',
    $city = 'Bonn',
    $streetName = 'Sträßchensweg',
    $streetNumber = '2'
);

$returnOrder = $requestBuilder->create();
$confirmation = $service->createReturnOrder($returnOrder);