PHP code example of dhl / sdk-api-bcs-returns

1. Go to this page and download the library: Download dhl/sdk-api-bcs-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-bcs-returns example snippets


$authStorage = new \Dhl\Sdk\Paket\Retoure\Auth\AuthenticationStorage(
    'applicationId',
    'applicationToken',
    'user',
    'signature'
);
$logger = new \Psr\Log\NullLogger();

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

$requestBuilder = new \Dhl\Sdk\Paket\Retoure\Model\ReturnLabelRequestBuilder();
$requestBuilder->setAccountDetails($receiverId = 'deu');
$requestBuilder->setShipperAddress(
    $name = 'Jane Doe',
    $countryCode = 'DEU',
    $postalCode = '53113',
    $city = 'Bonn',
    $streetName = 'Sträßchensweg',
    $streetNumber = '2'
);

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