PHP code example of stephenmittag / php-afterbuyapi

1. Go to this page and download the library: Download stephenmittag/php-afterbuyapi 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/ */

    

stephenmittag / php-afterbuyapi example snippets


$client = new Client(
    $config['afterbuy']['userId'],
    $config['afterbuy']['userPw'],
    $config['afterbuy']['partnerId'],
    $config['afterbuy']['partnerPw'],
    'EN'
);
$soldItems = $client->getSoldItems($filters, $orderDirection, $maxSoldItems, $detailLevel);

$orders = $soldItems->getResult()->getOrders();

$dateFilter = (new DateFilter(DateFilter::FILTER_AUCTION_END_DATE))
                ->setDateFrom(new DateTime('2000-01-01 00:00:00'))
                ->setDateTo(new DateTime('2000-01-10 00:00:00'));
            
$defaultFilter = new DefaultFilter(DefaultFilter::FILTER_COMPLETED_AUCTIONS);

$order = new \Wk\AfterbuyApiBundle\Model\XmlApi\UpdateSoldItems\Order();
$order->setOrderId(1234567890)
      ->setUserDefinedFlag(12345)
      ->setInvoiceMemo("You didn't read the memo? You are fired!");
$client->updateSoldItems(array($orders));