I'm using eBay PHP SDK
When i try to add fixedprice item to sandbox - everything is OK, then I just change the credentials to Production mode and get an error:
You need to create a seller's account. Before you can list this item we need some additional information to create a seller's account.
How to fix this error? I have seller account with linked PayPal account (and money inside), but i'm not sure that i'm using the same account, becouse i made account for Developer program. How to use my seller account in developer program?
Please help.
The code that I have is below:
use \DTS\eBaySDK\Constants;
//Trading API
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;
//Fiding API
//use \DTS\eBaySDK\Finding\Services;
//use \DTS\eBaySDK\Finding\Types;
class EbayController extends BaseController {
protected $TOKEN = 'Token here';
protected $service;
function __construct()
{
$this->service = new Services\TradingService(array(
'apiVersion' => '911',
'siteId' => 0,
'appId' => 'My app id here',
'sandbox' => false,
'certId' => 'My cert id here',
'devId' => 'My dev id here',
//'debug' => true
));
}
function test()
{
$this->addProductFixedPrice();
echo '<br />//-------------------------------------------------<br />';
$request = new Types\GeteBayOfficialTimeRequestType();
$request->RequesterCredentials = new Types\CustomSecurityHeaderType();
$request->RequesterCredentials->eBayAuthToken = $this->TOKEN;
$response = $this->service->geteBayOfficialTime($request);
if ( $response->Ack !== 'Success' )
{
if ( isset($response->Errors) )
{
foreach ( $response->Errors as $error )
{
printf("ShortMessage Error: %s\n", $error->ShortMessage . '<br />');
printf("LongMessage Error: %s\n", $error->LongMessage . '<br />');
printf("ErrorClassification Error: %s\n", $error->ErrorClassification . '<br />');
printf("ErrorCode Error: %s\n", $error->ErrorCode . '<br />');
//printf("ErrorParameters Error: %s\n", $error->ErrorParameters . '<br />');
printf("SeverityCode Error: %s\n", $error->SeverityCode . '<br />');
printf("UserDisplayHint Error: %s\n", $error->UserDisplayHint . '<br />');
}
}
}
else
{
printf($response->Ack . " -- The official eBay time is: %s\n", $response->Timestamp->format('H:i (\G\M\T) \o\n l jS F Y'));
}
}
function addProductFixedPrice()
{
$request = new Types\AddFixedPriceItemRequestType();
/**
* An user token is required when using the Trading service.
*
* For more information about getting your user tokens, see:
* http://devbay.net/sdk/guides/application-keys/
*/
$request->RequesterCredentials = new Types\CustomSecurityHeaderType();
$request->RequesterCredentials->eBayAuthToken = $this->TOKEN;
/**
* Begin creating the fixed price item.
*/
$item = new Types\ItemType();
/**
* We want a multiple quantity fixed price listing.
*/
$item->ListingType = Enums\ListingTypeCodeType::C_FIXED_PRICE_ITEM;
$item->Quantity = 99;
/**
* Let the listing be automatically renewed every 30 days until cancelled.
*/
$item->ListingDuration = Enums\ListingDurationCodeType::C_GTC;
/**
* The cost of the item is $19.99.
* Note that we don't have to specify a currency as eBay will use the site id
* that we provided earlier to determine that it will be United States Dollars (USD).
*/
$item->StartPrice = new Types\AmountType(array('value' => 19.99));
/**
* Allow buyers to submit a best offer.
*/
$item->BestOfferDetails = new Types\BestOfferDetailsType();
$item->BestOfferDetails->BestOfferEnabled = true;
/**
* Automatically accept best offers of $17.99 and decline offers lower than $15.99.
*/
$item->ListingDetails = new Types\ListingDetailsType();
$item->ListingDetails->BestOfferAutoAcceptPrice = new Types\AmountType(array('value' => 17.99));
$item->ListingDetails->MinimumBestOfferPrice = new Types\AmountType(array('value' => 15.99));
/**
* Provide a title and description and other information such as the item's location.
* Note that any HTML in the title or description must be converted to HTML entities.
*/
$item->Title = 'H2 Bits & Bobs 4';
$item->Description = '<H1>H2 Bits & Bobs</H1><p>Just some stuff I found.</p>';
$item->SKU = 'ABC-001';
$item->Country = 'US';
$item->Location = 'Beverly Hills';
$item->PostalCode = '90210';
/**
* This is a required field.
*/
$item->Currency = 'USD';
/**
* Display a picture with the item.
*/
$item->PictureDetails = new Types\PictureDetailsType();
$item->PictureDetails->GalleryType = Enums\GalleryTypeCodeType::C_GALLERY;
$item->PictureDetails->PictureURL = array('https://pixabay.com/get/1d9c26b3a1355d638606/1434976441/rosa-817121_1280.jpg?direct');
/**
* List item in the Books > Audiobooks (29792) category.
*/
$item->PrimaryCategory = new Types\CategoryType();
$item->PrimaryCategory->CategoryID = '29792';
/**
* Tell buyers what condition the item is in.
* For the category that we are listing in the value of 1000 is for Brand New.
*/
$item->ConditionID = 1000;
/**
* Buyers can use one of two payment methods when purchasing the item.
* Visa / Master Card
* PayPal
* The item will be dispatched within 1 business days once payment has cleared.
* Note that you have to provide the PayPal account that the seller will use.
* This is because a seller may have more than one PayPal account.
*/
$item->PaymentMethods = array(
'VisaMC',
'PayPal'
);
$item->PayPalEmailAddress = '[email protected]';
$item->DispatchTimeMax = 1;
/**
* Setting up the shipping details.
* We will use a Flat shipping rate for both domestic and international.
*/
$item->ShippingDetails = new Types\ShippingDetailsType();
$item->ShippingDetails->ShippingType = Enums\ShippingTypeCodeType::C_FLAT;
/**
* Create our first domestic shipping option.
* Offer the Economy Shipping (1-10 business days) service at $2.00 for the first item.
* Additional items will be shipped at $1.00.
*/
$shippingService = new Types\ShippingServiceOptionsType();
$shippingService->ShippingServicePriority = 1;
$shippingService->ShippingService = 'Other';
$shippingService->ShippingServiceCost = new Types\AmountType(array('value' => 2.00));
$shippingService->ShippingServiceAdditionalCost = new Types\AmountType(array('value' => 1.00));
$item->ShippingDetails->ShippingServiceOptions[] = $shippingService;
/**
* Create our second domestic shipping option.
* Offer the USPS Parcel Select (2-9 business days) at $3.00 for the first item.
* Additional items will be shipped at $2.00.
*/
$shippingService = new Types\ShippingServiceOptionsType();
$shippingService->ShippingServicePriority = 2;
$shippingService->ShippingService = 'USPSParcel';
$shippingService->ShippingServiceCost = new Types\AmountType(array('value' => 3.00));
$shippingService->ShippingServiceAdditionalCost = new Types\AmountType(array('value' => 2.00));
$item->ShippingDetails->ShippingServiceOptions[] = $shippingService;
/**
* Create our first international shipping option.
* Offer the USPS First Class Mail International service at $4.00 for the first item.
* Additional items will be shipped at $3.00.
* The item can be shipped Worldwide with this service.
*/
$shippingService = new Types\InternationalShippingServiceOptionsType();
$shippingService->ShippingServicePriority = 1;
$shippingService->ShippingService = 'USPSFirstClassMailInternational';
$shippingService->ShippingServiceCost = new Types\AmountType(array('value' => 4.00));
$shippingService->ShippingServiceAdditionalCost = new Types\AmountType(array('value' => 3.00));
$shippingService->ShipToLocation = array('WorldWide');
$item->ShippingDetails->InternationalShippingServiceOption[] = $shippingService;
/**
* Create our second international shipping option.
* Offer the USPS Priority Mail International (6-10 business days) service at $5.00 for the first item.
* Additional items will be shipped at $4.00.
* The item will only be shipped to the following locations with this service.
* N. and S. America
* Canada
* Australia
* Europe
* Japan
*/
$shippingService = new Types\InternationalShippingServiceOptionsType();
$shippingService->ShippingServicePriority = 2;
$shippingService->ShippingService = 'USPSPriorityMailInternational';
$shippingService->ShippingServiceCost = new Types\AmountType(array('value' => 5.00));
$shippingService->ShippingServiceAdditionalCost = new Types\AmountType(array('value' => 4.00));
$shippingService->ShipToLocation = array(
'Americas',
'CA',
'AU',
'Europe',
'JP'
);
$item->ShippingDetails->InternationalShippingServiceOption[] = $shippingService;
/**
* The return policy.
* Returns are accepted.
* A refund will be given as money back.
* The buyer will have 14 days in which to contact the seller after receiving the item.
* The buyer will pay the return shipping cost.
*/
$item->ReturnPolicy = new Types\ReturnPolicyType();
$item->ReturnPolicy->ReturnsAcceptedOption = 'ReturnsAccepted';
$item->ReturnPolicy->RefundOption = 'MoneyBack';
$item->ReturnPolicy->ReturnsWithinOption = 'Days_14';
$item->ReturnPolicy->ShippingCostPaidByOption = 'Buyer';
/**
* Finish the request object.
*/
$request->Item = $item;
/**
* Send the request to the AddFixedPriceItem service operation.
*
* For more information about calling a service operation, see:
* http://devbay.net/sdk/guides/getting-started/#service-operation
*/
$response = $this->service->addFixedPriceItem($request);
/**
* Output the result of calling the service operation.
*
* For more information about working with the service response object, see:
* http://devbay.net/sdk/guides/getting-started/#response-object
*/
if ( isset($response->Errors) )
{
foreach ( $response->Errors as $error )
{
printf("%s: %s\n%s\n\n", $error->SeverityCode === Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning', $error->ShortMessage, $error->LongMessage
);
}
}
if ( $response->Ack !== 'Failure' )
{
printf("The item was listed to the eBay Sandbox with the Item number %s\n", $response->ItemID
);
}
}}