function test_AddFixedPriceItem() { $session = \Services\Ebay::getSession($this->devId, $this->appId, $this->certId); $session->setToken($this->token); $ebay = new \Services\Ebay($session); $item = \Services\Ebay::loadModel('Item', null, $session); $item->PrimaryCategory = array('CategoryID' => 57882); $item->ConditionID = 1000; $item->Title = 'Supergirls\'s cape'; $item->Description = 'Another test item'; $item->Location = 'At my home'; $item->StartPrice = '10'; $item->PaymentMethods = 'PayPal'; $item->PayPalEmailAddress = '*****@*****.**'; $item->Quantity = 1; $item->ListingDuration = 'Days_7'; $item->ListingType = 'FixedPriceItem'; $item->DispatchTimeMax = 3; $item->Currency = 'USD'; $item->Country = 'US'; $item->Site = 'US'; $item->PictureDetails = array('PictureURL' => array('http://i12.ebayimg.com/03/i/04/8a/5f/a1_1_sbl.JPG', 'http://i22.ebayimg.com/01/i/04/8e/53/69_1_sbl.JPG', 'http://i4.ebayimg.ebay.com/01/i/000/77/3c/d88f_1_sbl.JPG')); $item->ReturnPolicy = array('ReturnsAcceptedOption' => 'ReturnsAccepted', 'RefundOption' => 'MoneyBack', 'ReturnsWithinOption' => 'Days_30', 'Description' => 'If you are not satisfied, return the book for refund.', 'ShippingCostPaidByOption' => 'Buyer'); $item->ShippingDetails = array('ShippingType' => 'Flat', 'ShippingServiceOptions' => array(array('ShippingServicePriority' => 1, 'ShippingService' => 'UPSGround', 'FreeShipping' => 'true', 'ShippingServiceAdditionalCost' => 0.0))); $result = $ebay->AddFixedPriceItem($item); print_r($result); $this->assertNotEmpty($result['ItemID']); }
* in three sizes. * * This call returns an array with the URL, width and height * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); echo "GetLogoURL('Small');<br />"; $logo = $ebay->GetLogoURL('Small'); echo sprintf('<img src="%s" width="%d" height="%d" title="This has been fetched from eBay" />', $logo['URL'], $logo['Width'], $logo['Height']); echo "<br /><br />"; echo "GetLogoURL('Medium');<br />"; $logo = $ebay->GetLogoURL('Medium'); echo sprintf('<img src="%s" width="%d" height="%d" title="This has been fetched from eBay" />', $logo['URL'], $logo['Width'], $logo['Height']); echo "<br /><br />"; echo "GetLogoURL('Large');<br />"; $logo = $ebay->GetLogoURL('Large'); echo sprintf('<img src="%s" width="%d" height="%d" title="This has been fetched from eBay" />', $logo['URL'], $logo['Width'], $logo['Height']); echo "<br /><br />"; echo "GetLogoURL();<br />"; $logo = $ebay->GetLogoURL(); echo sprintf('<img src="%s" width="%d" height="%d" title="This has been fetched from eBay" />', $logo['URL'], $logo['Width'], $logo['Height']);
/** * example that fetches all transactions for an item * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $transactions = $ebay->GetSellerTransactions('2004-08-24 00:00:00', '2004-08-30 00:00:00'); if ($transactions) { echo 'Transactions overview:<br />'; echo '<pre>'; print_r($transactions->toArray()); echo '</pre>'; echo '<br />Iterate all transactions:<br />'; foreach ($transactions as $transaction) { echo '<pre>'; print_r($transaction->toArray()); echo '</pre>'; } } $session->setDetailLevel(\Services\Ebay::RESPONSE_VERBOSE); $transactions = $ebay->GetSellerTransactions('2004-08-24 00:00:00', '2004-08-30 00:00:00');
<?php /** * example that fetches all transactions for an item * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $disputeId = $dispute = $ebay->AddDispute('110001152130', '0', 'BuyerHasNotPaid', 'BuyerHasNotResponded'); echo 'DistputeId: ' . $disputeId;
<?php /** * example that adds information to the item description * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $item = $ebay->GetItem(4501336808); $result = $item->End('LostOrBroken'); echo '<pre>'; print_r($result); echo '</pre>';
<?php /** * example that adds information to the item description * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $item = $ebay->GetItem(6280834492); $result = $item->AddToDescription('He rarely ever used it.'); if ($result === true) { echo 'Sucessfully added to item description'; } else { echo 'Could not add to item description'; }
<?php /** * example that searches for items * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $account = $ebay->GetAccount(\Services\Ebay::ACCOUNT_TYPE_PERIOD, '2006-02-01', '2006-02-02'); echo '<pre>'; print_r($account->toArray()); echo '</pre>'; foreach ($account as $entry) { echo '<pre>'; print_r($entry); echo '</pre>'; }
<?php /** * example that fetches a user object * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); /** * get the user information */ $user = $ebay->GetUser('loislane-74'); $result = $user->LeaveFeedback('4501333179', 'positive', 'Fast payment, thank you!'); echo "<pre>"; print_r($result); echo "</pre>";
<?php /** * example that fetches an item * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $item = $ebay->GetItem(110002463992); echo 'User-Id of the seller: ' . $item->Seller->UserID . '<br />'; echo '<pre>'; print_r($item->toArray()); echo '</pre>'; $item_2 = \Services\Ebay::loadModel('Item', null, $session); $item_2->Id = 110002463987; $res2 = $item_2->Get();
<?php /** * example that gets your access rules for the API * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $rules = $ebay->GetAPIAccessRules(); echo "<pre>"; print_r($rules); echo "</pre>";
/** * example that fetches a user object * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); /** * get the bidder list */ echo 'Getting Bidder List directly:<br />'; $list = $ebay->GetBidderList('pgoodman123'); foreach ($list as $item) { echo $item; echo '<br />'; } echo '<br /><br />'; /** * get the user */ $user = $ebay->GetUser('loislane-74'); echo 'Getting Bidder List on User object:<br />';
<?php /** * example that fetches all disputes the current user is involved in * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $disputes = $ebay->GetUserDisputes(\Services\Ebay::USER_DISPUTES_ALL, \Services\Ebay::USER_DISPUTES_SORT_TIME_ASC); echo '<pre>'; print_r($disputes->toArray()); echo '</pre>'; foreach ($disputes as $dispute) { echo '<pre>'; print_r($dispute); echo '</pre>'; }
<?php /** * example that fetches an item * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $bidders = $ebay->GetAllBidders(4501306898, 'ViewAll'); echo '<pre>'; print_r($bidders); echo '</pre>';
<?php /** * example that fetches a unique RuName * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setAuthenticationData($username, $password); $ebay = new \Services\Ebay($session); echo 'Getting RuName...'; $RuName = $ebay->GetRuName('MyUseCase'); echo $RuName . '<br />'; $result = $ebay->SetReturnURL($RuName, 'add', 'https://foo.de/accept/', 'https://foo.de/reject'); echo 'Setting Return URL...'; $result = $ebay->GetReturnURL(); echo '<pre>'; print_r($result); echo '</pre>';
<?php /** * example that fetches an item * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $result = $ebay->AddMemberMessage('superman-74', 3, 1, 'Just testing', 'This is only a test'); if ($result === true) { echo 'Messsage has been sent.<br />'; } else { echo 'An error occured while sending the message.'; }
<?php /** * example that fetches categories * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $cats = $ebay->GetCategory2CS(57882);
<?php /** * example that validates a test user * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); /** * validate the test user */ $result = $ebay->ValidateTestUserRegistration();
<?php /** * example that fetches the URL of the eBay logo * in three sizes. * * This call returns an array with the URL, width and height * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); // get errors in German $session->setErrorLanguage(\Services\Ebay::SITEID_DE); try { $logo = $ebay->GetLogoURL('Foo'); } catch (Exception $e) { echo $e->getMessage(); }
<?php /** * example that fetches categories * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $cats = $ebay->GetCategories(57882); echo '<pre>'; print_r($cats); echo '</pre>'; /** * change the overall Detail-Level */ $session->setDetailLevel('ReturnAll'); $cats = $ebay->GetCategories(12576); echo '<pre>'; print_r($cats); echo '</pre>';
<?php /** * Example that lists all API calls the are supported by Services_Ebay * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt <*****@*****.**> */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $calls = $ebay->getAvailableApiCalls(); echo '<pre>'; print_r($calls); echo '</pre>';
/** * example that fatches feedback of a user * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); /** * get the summary */ echo 'Get only the summary<br />'; $feedback = $ebay->GetFeedback('loislane-74'); echo "<pre>"; print_r($feedback->toArray()); echo "</pre>"; /** * get the detailed feedback */ echo 'Get verbose feedback<br />'; $feedback = $ebay->GetFeedback('loislane-74', \Services\Ebay::FEEDBACK_VERBOSE); echo "<pre>"; print_r($feedback->toArray());
<?php /** * example that fetches shipping rates * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $templates = $ebay->GetDescriptionTemplates(); echo '<pre>'; print_r($templates); echo '</pre>';
/** * example that adds a shipment * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $shipment = \Services\Ebay::loadModel('Shipment'); $shipment->InsuredValue = 400; $shipment->PayPalShipmentId = '12345678'; $shipment->PostageTotal = 3; $shipment->PrintedTime = date('Y-m-d H:i:s'); $shipment->ShippingServiceUsed = 3; $shipment->ShippingPackage = 0; $shipment->setPackageDimensions(10, 5, 8); $shipment->ShipmentTrackNumber = uniqid('shipment'); $shipment->SetFromAddress('Foobar', 'Clark Kent', 'Any Street 123', null, 'San Francisco', '94101', 'CA', 'USA'); $shipment->SetAddress(2, 'Foobar', 'Clark Kent', 'Any Street 456', null, 'San Francisco', '94101', 'CA', 'USA'); $shipment->AddTransaction(4501333179, 0); $shipment->InsuredValue = '450.00'; $shipment->ShippingCarrierUsed = 1; $shipment->WeightMajor = 2;
<?php /** * example that fetches shipping rates * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $prefs = \Services\Ebay::loadModel('Preferences', 'CrossPromotion'); $prefs->AddPreference('Enabled', 1, 'Boolean'); $sorting = \Services\Ebay::loadModel('Preferences', 'Sorting'); $prefs->AddPreference($sorting); $crosssell_sortfiltering = \Services\Ebay::loadModel('Preferences', 'Crosssell_SortFiltering'); $crosssell_sortfiltering->AddPreference('BuyItNowSortFiltering', 1, 'Integer'); $crosssell_sortfiltering->AddPreference('FinalSortFiltering', 1, 'Integer'); $sorting->AddPreference($crosssell_sortfiltering); $result = $ebay->SetPreferences($prefs); if ($result === true) { echo 'Preferences set.'; }
/** * example that fetches all transactions for an item * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $transactions = $ebay->GetItemTransactions('4501333179', '2004-08-24 00:00:00', '2004-08-30 00:00:00', 1, 2); echo 'Transactions overview:<br />'; echo '<pre>'; print_r($transactions->toArray()); echo '</pre>'; echo '<br />Iterate all transactions:<br />'; foreach ($transactions as $transaction) { echo '<pre>'; print_r($transaction->toArray()); echo '</pre>'; } echo '<b>Use new detail level</b><br />'; $session->setDetailLevel(\Services\Ebay::TRANSACTION_DETAIL_BUYER + \Services\Ebay::TRANSACTION_DETAIL_SELLER); $transactions = $ebay->GetItemTransactions('4501333179', '2004-08-24 00:00:00', '2004-08-30 00:00:00'); echo 'Transactions overview:<br />';
<?php /** * example that adds a response to a dispute * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $result = $ebay->SellerReverseDispute('997', \Services\Ebay::DISPUTE_REVERSE_OTHER); if ($result === true) { echo 'Dispute has been reversed.'; } else { echo 'An error occured'; }
<?php /** * example that searches for items * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $result = $ebay->GetSearchResults('NoteBook'); echo 'General information about the search result:<br />'; echo '<pre>'; print_r($result->toArray()); echo '</pre>'; echo 'Iterate through the found items<br />'; foreach ($result as $item) { echo $item; echo '<br />'; }
<?php /** * example that shows how to use various models * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); /** * get the user information */ $user = $ebay->GetUser('agebook'); /** * access single properties */ echo $user->UserId . "<br>"; /** * get all properties */ echo '<pre>'; print_r($user->toArray()); echo '</pre>'; /**
<?php /** * example that fetches categories * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $items = $ebay->GetCategoryListings(57882); echo '<pre>'; print_r($items); echo '</pre>';
<?php /** * example that fetches an item * * $Id$ * * @package Services_Ebay * @subpackage Examples * @author Stephan Schmidt */ error_reporting(E_ALL); require_once '../vendor/autoload.php'; require_once 'config.php'; $session = \Services\Ebay::getSession($devId, $appId, $certId); $session->setToken($token); $ebay = new \Services\Ebay($session); $rules = $ebay->GetPromotionRules('UpSell', 110002463992); echo '<pre>'; print_r($rules); echo '</pre>';