Search code examples
phpebay-api

Ebay Trading API ReturnPolicyType


I'm trying to create a script to add items to my test ebay account. But I've hit a problem I'm not sure if I have the wrong file set? but it doesn't seem to match up to the documentation (or I'm reading it wrong).

The file set I have is PHP Toolkit with 527 Support. There is also PHP Toolkit with 515 Support. Both from https://www.x.com/developers/ebay/php-accelerator-toolkit-ebay-trading-api-edition

I've found this great script through another question on stack overflow https://github.com/iloveitaly/ebay-php/blob/master/eBayCommon.php

And I've been looking at the online help files here: http://developer.ebay.com/devzone/xml/docs/WebHelp/wwhelp/wwhimpl/js/html/wwhelp.htm

Here is the error I'm getting: PHP Fatal error: Class 'ReturnPolicyType' not found

The way I understand it is that there should be a file for each "Type" there is one for CategoryType and AmountType but no file for ReturnPolicyType. And no reference to it any any of the files I have.. am I looking at this totally wrongly?

require_once '../EbatNs/EbatNs_ServiceProxy.php';
require_once '../EbatNs/EbatNs_Logger.php';
require_once '../EbatNs/VerifyAddItemRequestType.php';
require_once '../EbatNs/AddItemRequestType.php';
require_once '../EbatNs/ItemType.php';
    require_once '../EbatNs/ItemConditionCodeType.php';
    require_once '../EbatNs/GetMyeBaySellingRequestType.php';
    require_once '../EbatNs/GetMyeBaySellingResponseType.php';
    require_once '../EbatNs/GetItemRequestType.php';

$session = new EbatNs_Session('config/ebay.config.php');

$cs = new EbatNs_ServiceProxy($session);
$cs->_logger = new EbatNs_Logger();

$req = new VerifyAddItemRequestType();

$item = new ItemType();
$item->BuyItNowPrice;
$item->Description = 'test ��� � <b>Some bold text</b>';
$item->ListingDuration = 'Days_7';
$item->Title = '��� test-titel';
$item->Currency = 'EUR';
$item->ListingType = 'Chinese';
$item->Quantity = 1;
$item->StartPrice = new AmountType();
$item->StartPrice->setTypeValue('1.0');
$item->StartPrice->setTypeAttribute('currencyID', 'EUR');
$item->Country = 'GB';
$item->Location = '-- not given --';
$item->ConditionID = '1';
$item->PrimaryCategory = new CategoryType();
$item->PrimaryCategory->CategoryID = 11450;
    $returnPolicy = new ReturnPolicyType();
    $returnPolicy->setRefundOption($sellerConfig['refund']['option']);
    $returnPolicy->setRefund($sellerConfig['refund']['option']);
    $returnPolicy->setReturnsWithinOption($sellerConfig['refund']['within']);
    $returnPolicy->setReturnsWithin($sellerConfig['refund']['within']);
    $returnPolicy->setReturnsAcceptedOption($sellerConfig['refund']['returns']);
    $returnPolicy->setReturnsAccepted($sellerConfig['refund']['returns']);
    $returnPolicy->setDescription($sellerConfig['refund']['description']);
    $returnPolicy->setShippingCostPaidByOption($sellerConfig['refund']['paidby']);
    $returnPolicy->setShippingCostPaidBy($sellerConfig['refund']['paidby']);
    $item->ReturnPolicy = $returnPolicy;

$item->Site = 'UK';
    $item->ShipToLocations[]="Europe";
$item->PaymentMethods[] = 'PayPal';
$item->PayPalEmailAddress = 'paypal@intradesys.com';

$req->Item = $item;
$res = $cs->VerifyAddItem($req);

?>


Solution

  • You're going to have to get a newer toolkit. ReturnPolicy was added 3 1/2 years ago in 581.

    Also, the lowest supported schema is now 629. I would recommend using as new of a toolkit as you can find. It looks like eBay hasn't updated their PHP page in a while, so you should go directly to the toolkit developer website to see what they have there.

    Hope this helps!