Configuring Your Store’s Settings with the eBay Trading API

Wern Ancheta
Wern Ancheta

In part 1, we explained the different parts of eBay’s developer dashboard and configured our test application. We also created our database. Now we’re ready to create a project. In this part, we’ll focus on store settings. In part 3, we’ll add new products to our store.


Before we proceed, we first need to install the dependencies of the app. Create a composer.json file and add the following:

    "require" : {
        "slim/slim-skeleton": "dev-master",
        "slimcontroller/slimcontroller": "dev-master",
        "guzzlehttp/guzzle": "4.*",
        "vlucas/valitron": "~1.2",
        "codeguy/upload": "*"
    "autoload": {
      "classmap": [

We will be using the Slim framework for this app. Since Slim doesn’t really have the C in MVC baked into it, we also need to require the Slim controller. Then we also require Guzzle so that we can easily make API calls to eBay. Next is valitron for form validation. Lastly, there’s the upload library for validating and processing uploads.

Create an index.php file in the root of the project’s directory, then add the following code:

require 'vendor/autoload.php';

$app = New \SlimController\Slim(array(
    'templates.path' => 'templates'

$app->view(new \Slim\Views\Twig());
$app->view->parserOptions = array(
    'charset' => 'utf-8',
    'cache' => realpath('templates/cache'),
    'auto_reload' => true,
    'strict_variables' => false,
    'autoescape' => true

$app->hook('slim.before', function () use ($app) {
    $app->view()->appendData(array('baseUrl' => '/tester/ebay_trading_api'));


Breaking it down, first we require the autoload.php file so that we can use the libraries that we required in the composer.json file earlier.

require 'vendor/autoload.php';

Next, we initialize the Slim controller. This allows us to configure the options to be used by the controller such as the templates path which is the path to the templates directory.

$app = New \SlimController\Slim(array(
    'templates.path' => 'templates'

Next, we tell Slim to use Twig for handling our views:

$app->view(new \Slim\Views\Twig());
$app->view->parserOptions = array(
    'charset' => 'utf-8',
    'cache' => realpath('templates/cache'),
    'auto_reload' => true,
    'strict_variables' => true,
    'autoescape' => true

We also specified the following options:

  • charset – the character set to be used by Twig.
  • cache – Twig compiles the templates that we’re using so it doesn’t have to do it on every page load. Those compiled template files are stored in the directory specified here.
  • auto_reload – this tells Twig to recompile the template every time the source code changes.
  • strict_variables – this tells Twig to return errors when a variable used in the template has not been declared.
  • autoescape – this tells Twig to automatically escape html, CSS and JavaScript code if encountered in the template.

Next, we create a hook that would run before the Slim application is executed. What this hook does is attach the baseUrl to the view. This means that whatever value we assign to the baseUrl, it will always be accessible in every view. We use this value later on to link our front-end assets.

$app->hook('slim.before', function () use ($app) {
    $app->view()->appendData(array('baseUrl' => '/tester/ebay_trading_api'));

Finally, we run the Slim application:


Ebay Class

We need to create a class that we can use to make calls to the API easier. Create a classes folder in the root of the project directory, then create a file and name it Ebay.php. Inside the file, add the following:

class Ebay {

Next declare the variables that we will use throughout the class:

public $compatability_level = 885;

public $sandbox_url = '';
public $url = '';

public $run_name;
public $dev_id; 
public $app_id;
public $cert_id;
public $site_id;
public $user_token;

These are the same variables we had in the HTTP Headers in part 1. We need those variables on every request that we make to the API. The only thing that I haven’t introduced is the URL to which the requests are made. We declared two URLs in this class: one is for the live version of the API, and the other is for the sandbox version. You can just choose which one to use when making requests. But one thing you need to remember is that you can only use the sandbox URL for sandbox accounts, and the live URL for real eBay accounts. You cannot use these interchangeably.

Next, create the constructor method. All it does is assign the global application settings so that we can use them throughout the class:

public function __construct($settings){
  $this->run_name = $settings->run_name;
  $this->user_token = $settings->user_token;
  $this->dev_id = $settings->dev_id;
  $this->app_id = $settings->app_id;
  $this->cert_id = $settings->cert_id;
  $this->site_id = $settings->site_id;

Then, declare a request method. This would allow us to make the actual request to the API:

public function request($method, $request_body){

  $client = new GuzzleHttp\Client();

  $response = $client->post($this->url, array(
      'verify' => false,
      'headers' => array(
          'X-EBAY-API-COMPATIBILITY-LEVEL' => $this->compatability_level,
          'X-EBAY-API-DEV-NAME' => $this->dev_id,
          'X-EBAY-API-APP-NAME' => $this->app_id,
          'X-EBAY-API-CERT-NAME' => $this->cert_id,        
          'X-EBAY-API-SITEID' => $this->site_id,
          'X-EBAY-API-CALL-NAME' => $method     
      'body' => $request_body

  $body = $response->xml();

  return $body;


This method accepts two arguments: the $method and the $request_body. The $method is the name of the API method that you want to call. Here you can find a list of API methods that you can use in the eBay Trading API.
The other argument is the $request_body, which is an XML string that contains the data required by the API method. You can also find detailed information on the data that you need to pass for each API method in the link that I’ve provided so be sure to check that out.

Inside the method, we declare a new instance of the GuzzleHTTP client.

$client = new GuzzleHttp\Client();

Next, we make a POST request to the sandbox URL. We pass in an array which contains the request headers and body:

$response = $client->post($this->sandbox_url, array(
            'verify' => false,
            'headers' => array(
                'X-EBAY-API-COMPATIBILITY-LEVEL' => $this->compatability_level,
                'X-EBAY-API-DEV-NAME' => $this->dev_id,
                'X-EBAY-API-APP-NAME' => $this->app_id,
                'X-EBAY-API-CERT-NAME' => $this->cert_id,        
                'X-EBAY-API-SITEID' => $this->site_id,
                'X-EBAY-API-CALL-NAME' => $method   
            'body' => $request_body

We have set verify to false. This sets the SSL certificate verification to false. Note that this is insecure, so it is preferred to set this to true. But since we’re just in the testing phase, we can set it to false to avoid the SSL certificate check.

Next is headers – these are basically the same request headers that we saw earlier.

Lastly, there’s the body which contains the body of the request. We will see later the kind of data we need to pass to it.

Once the request returns a response it will be in XML format, so we tell Guzzle to parse it for us by calling the xml() method. This is pretty much like calling simplexml_load_string to convert XML into an object. Finally, we call json_encode and json_decode to convert the object into an array.

Next, create the method which will retrieve the session ID from the API. For this, we need to use the GetSessionID method from the API. This requires the run name of the app as its parameter:

public function getSessionID(){

    $request_body = '<?xml version="1.0" encoding="utf-8"?>
      <GetSessionIDRequest xmlns="urn:ebay:apis:eBLBaseComponents">
        <RuName>' . $this->run_name . '</RuName>

    $response = $this->request('GetSessionID', $request_body);
    return $response->SessionID;

Next is the getUserToken method which uses the FetchToken API method. This requires the session ID which we get from calling getSessionID. What this method does is return the user token which we can use to make requests to the API on behalf of the user.

public function getUserToken($session_id){

    $request_body = '<?xml version="1.0" encoding="utf-8"?>
        <FetchTokenRequest xmlns="urn:ebay:apis:eBLBaseComponents">
          <SessionID>' . $session_id . '</SessionID>

    $response = $this->request('FetchToken', $request_body);
    return $response->eBayAuthToken;      


The flow would be something like this:

  1. We call getSessionID which returns the session ID.
  2. We set the app to redirect to eBay passing the session ID into the redirect URL.
  3. User logs in and gives permission to the app.
  4. User is redirected to the app.
  5. We call the getUserToken to get the user token, passing in the session ID we got earlier.
  6. API returns the user token and we save it to the database for later use.

Later on, we’re going to implement it in our code.

That’s pretty much all we need for now from this class. Now we need to tell Composer to autoload the class for us. Open up composer.json and add classes in the classmap property of autoload:

"autoload": {
      "classmap": [

Next open up the index.php file in the root directory of the project and add the following code right before $app->run(). This would allow us to call methods from the Ebay class from anywhere using $this->app->ebay:

$app->container->singleton('ebay', function () use($app) {

    $id = 1;
    $settings_result = $app->db->query("SELECT user_token, run_name, dev_id, app_id, cert_id, site_id FROM settings WHERE id = $id");
    $settings = $settings_result->fetch_object();
    return new Ebay($settings);

While we’re here, let’s also assign a mysqli instance to the app container and name it db.

$app->container->singleton('db', function (){

    $server = 'localhost';
    $user = 'user';
    $pass = '';
    $database = 'ebaytrading';

    return new mysqli($server, $user, $pass, $database);

Home Page

Now we’re ready to start working on the front-end side of things. First, create a base.twig file under the templates directory, then add the following code:

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <title>{{ title }}</title>
  <link rel="stylesheet" href="{{ baseUrl }}/assets/lib/bootstrap/bootstrap.css">
  {% if is_productpage %}
  <link rel="stylesheet" href="{{ baseUrl }}/assets/lib/dropzone/dropzone.css">
  {% endif %}
    <div class="navbar navbar-default navbar-static-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          <a class="navbar-brand" href="#">{{ title }}</a>
        <div class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li class="active"><a href="{{ baseUrl }}">Home</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Products <span class="caret"></span></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="{{ baseUrl }}/products/new">New</a></li>
            <li><a href="{{ baseUrl }}/products">List</a></li>
      <ul class="nav navbar-nav">
        <li class="dropdown"><a href="{{ baseUrl }}/token">Get Token</a></li>
      <ul class="nav navbar-nav">
        <li><a href="{{ baseUrl }}/settings">Settings</a></li>

    <div class="container">
      {% block content %}{% endblock %}
  <script src="{{ baseUrl }}/assets/js/jquery.js"></script>
  <script src="{{ baseUrl }}/assets/lib/bootstrap/bootstrap.js"></script>
  {% if is_productpage %}
  <script src="{{ baseUrl }}/assets/js/handlebars.js"></script>
  <script src="{{ baseUrl }}/assets/lib/dropzone/dropzone.js"></script>
  <script src="{{ baseUrl }}/assets/js/dropzone-options.js"></script>
  <script src="{{ baseUrl }}/assets/js/new-product.js"></script>
  {% endif %}


If this template looks familiar, that is because were using Twitter Bootstrap for this project.

Going back to the template, we’re using three variables: baseUrl, content, and title. Earlier, we have already declared the baseUrl from the index.php file. Later on, we’re going to pass in the content and the title from the controller. For now, let’s focus on blocks in Twig. We use them in the template by calling block and then the name of the variable. In this case we’ve called the block content:

{% block content %}{% endblock %}

Blocks are a way to render content from another template based on what we pass from the controller. Later on, we’ll go through how to pass the actual content we’re rendering here.

As I’ve mentioned earlier, we’re using Twitter Bootstrap so we need to place it in the assets/lib/bootstrap directory. You can use the themes from if you don’t want to use the default theme. Personally, I’m using the yeti theme. We also need jQuery as Twitter Bootstrap’s JavaScript depends on it, and we need it for handling events. We also need Handlebars for templating, and dropzone for uploading product images.

Notice that we have the following conditionals:

{% if is_productpage %}
{% endif %}

We’re using it to only load the styles and scripts that are necessary for the current page.

Go ahead and download the necessary files if you haven’t done so.

Once you’re back, create the Home controller under the controllers directory. This will extend SlimController:

class Home extends \SlimController\SlimController {


Inside the controller, declare the indexAction method. It uses the render method to render the index template for us. The render method accepts two arguments: the name of the template and some optional data that you want to pass. In this case we’re simply passing in a name:

public function indexAction(){
    $this->render('index', array('title' => 'Home', 'name' => 'Dog'));

Next, create the index template, name it index.twig. When using templates, you need to remember to give the template file a name that is the same as the one you used in the controller. From the index template, we need to call the extends method and pass the file name of the base template that we used. Next, we wrap in the content that we want to render in block tags. Make sure that the name you pass along is the same as the one you passed in the base template:

{% extends "base.twig" %}
{% block content %}
{{ parent() }}
<h1>Hi {{ name }}</h1>
{% endblock %}

Since we’re already writing the code for the home controller, we might as well write the method for acquiring the session id and user token. First let’s do the session ID. This will call the getSessionID() method from the Ebay class and return a session ID which we then store into the session. Then, we redirect the user to the eBay sign in page. Here we’re redirecting to the sandbox sign in page. I’ve also included the URL for the live one for those who want to deploy an eBay app later on. Both live and the sandbox version require the RuName and SessID to be passed along as a query parameter.

public function sessionAction(){

    $session_id = $this->app->ebay->getSessionID();
    $_SESSION['session_id'] = $session_id;

    //live:" . $this->app->ebay->run_name . "&SessID=$session_id

    $redirect_url = "" . $this->app->ebay->run_name . "&SessID=" . $session_id;


Once the user has approved the app, the tokenAction() method will then be called. What this method does is retrieve the session id that we have saved earlier into the session. Then we use it as an argument for the getUserToken() method which returns the user token. We then save this user token into the database so we can use it later on when making requests to the API.

public function tokenAction(){
    $session_id = $_SESSION['session_id'];
    $token = $this->app->ebay->getUserToken($session_id);
    $id = 1;

    $settings_result = $this->app->db->query("SELECT user_token FROM settings WHERE id = $id");
    $settings = $settings_result->fetch_object();

        $this->app->db->query("UPDATE settings SET user_token = '$token' WHERE id = $id");
        $this->app->db->query("INSERT INTO settings SET user_token = '$token'"); 


Next, we need to add the routes that we will be using throughout the app. We can do that from the index.php file right before the $app->run() call:

    '/' => 'Home:index',
    '/settings' => 'Settings:view',
    '/settings/update' => 'Settings:update',
    '/products/new' => 'Product:new',
    '/products/create' => 'Product:create',
    '/upload' => 'Product:upload',
    '/session' => 'Home:session',
    '/token' => 'Home:token',
    '/categories' => 'Product:categories'

In the code above, we’re using the addRoutes method from the Slim Controller extension. This takes up an array of routes, with the key being the actual route and the value being the controller and method. The controller and the method are separated by a colon :. The convention used by Slim is that every method in the controller which responds to a route should have a suffix of Action.

Here’s an overview of what each route does:

  • / – home page.
  • /settings – for viewing the store settings page.
  • /setttings/update – for updating the store settings.
  • /products/new – for viewing the form for creating new products.
  • /products/create – for creating a new product.
  • /upload – for uploading product images.
  • /session – for acquiring a session ID.
  • /token – for acquiring a user token.
  • /categories – for suggesting product categories.

Store Settings

Next, create a new file under the controllers directory and name it Settings.php. This will handle the updating of store settings. To cut this short a little bit, we will just enter some default data for the store settings so we won’t need to write the code for the creation of store settings. Execute the following query to insert the default data:

INSERT INTO `store_settings` (`id`, `store_name`, `county`, `street`, `country_code_type`, `ebay_website`, `postal_code`, `category_mapping`, `category_prefill`, `currency_code`, `item_location`, `dispatch_time`, `listing_duration`, `listing_type`, `condition_type`, `optimal_picturesize`, `out_of_stock_control`, `get_it_fast`, `include_prefilled`, `shipping_profile`, `return_profile`, `payment_profile`, `shipping_service`, `shippingservice_priority`, `shippingservice_cost`, `shippingservice_additionalcost`) VALUES
(1, 'My Awesome Store', 'Driftveil', '275 Star Street', 'GB', 'UK', 'XYZ 123', 1, 1, 'GBP', 'Driftveil Unova', 1, 'GTC', 'FixedPriceItem', '', 1, 1, 1, 1, '', '', '', '', 3, 30, 15);

Note that for this tutorial, we’re mainly going to use the first row in the table, the one which has an ID of 1 so we’re going to use 1 as the ID for fetching or updating the store settings table.

Next, create a viewAction method and put in the following code:

public function viewAction(){   
    $user_preferences = $this->app->ebay->getUserPreferences();
    $shipping_services = $this->app->ebay->getEbayDetails('ShippingServiceDetails');
    $condition_types_result = $this->app->db->query('SELECT id, name FROM condition_types');
    $condition_types = array();
    while($row = $condition_types_result->fetch_assoc()){
      $condition_types[] = $row;

    $listing_durations_result = $this->app->db->query('SELECT name FROM listing_durations');
    $listing_durations = array();
    while($row = $listing_durations_result->fetch_assoc()){
      $listing_durations[] = $row['name'];

    $listing_types_result = $this->app->db->query('SELECT name FROM listing_types');
    $listing_types = array();
    while($row = $listing_types_result->fetch_assoc()){
      $listing_types[] = $row['name'];

    $shippingservice_priorities = range(1, 4);

    $store_id = 1;
    $store_result = $this->app->db->query("SELECT store_name, county, street, country_code_type,
   ebay_website, postal_code, category_mapping, category_prefill, currency_code, item_location,
   dispatch_time, listing_duration, listing_type, condition_type, optimal_picturesize, out_of_stock_control,
   get_it_fast, include_prefilled, shipping_profile, return_profile, payment_profile, shipping_service,
   shippingservice_priority, shippingservice_cost, shippingservice_additionalcost
     FROM store_settings WHERE id = '$store_id'");
    $store = $store_result->fetch_object();

    $settings = array(
      'user_preferences' => $user_preferences,
      'shipping_services' => $shipping_services,
      'condition_types' => $condition_types,
      'listing_durations' => $listing_durations,
      'listing_types' => $listing_types,
      'store' => $store,
      'shippingservice_priorities' => $shippingservice_priorities
    $this->render('settings/view', $settings);    

The viewAction method calls the getUserPreferences method from the Ebay class. We will go through that method later, but for now know that what it does is to return the seller profiles of the authenticated user. We’re also calling the getEbayDetails method which returns the shipping services available for the specific eBay website. Next, we fetch the condition types, listing durations and listing types from the database and assign those to an array.
We then generate an array containing numbers 1 to 4. This will serve as the selection for shipping service priorities. Lastly, we fetch the store settings and render the page.

Earlier, we’ve used 2 methods from the Ebay class but we haven’t really defined them yet. Open up Ebay.php in your classes directory and add the following methods.

First is the getUserPreferences method, which uses the GetUserPreferences method from the API. This allows you to fetch the user settings from the authenticated eBay account. This API method mostly needs boolean values. It returns a bunch of data so we’re filtering others out by specifying only the fields that we need. Here’s a breakdown of the fields we’re using:

  • ShowGlobalShippingProgramListingPreference – if specified, it returns the data on whether the global shipping program is enabled or not.
  • ShowSellerExcludeShipToLocationPreference – if specified, it returns the excluded shipping locations.
  • ShowSellerPaymentPreferences – if specified, it returns the payment preferences of the seller.
  • ShowSellerProfilePreferences – if specified, it returns the business policy information.
  • ShowSellerReturnPreferences – if specified, it returns the return preferences.

For the seller profiles, we’re only getting the default ones, and then store them in an array with only the ID, type and name of the profile.

public function getUserPreferences(){

  $request_body = '<?xml version="1.0" encoding="utf-8"?>
    <GetUserPreferencesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
        <eBayAuthToken>' . $this->user_token . '</eBayAuthToken>

  $response = $this->request('GetUserPreferences', $request_body);

  $seller_profiles = array();
  foreach($response->SellerProfilePreferences->SupportedSellerProfiles->SupportedSellerProfile as $profile){
    $is_default = $profile->CategoryGroup->IsDefault;

    if($is_default == 'true'){      
      $seller_profiles[] = array(
        'id' => json_decode(json_encode($profile->ProfileID), true)[0],
        'type' => json_decode(json_encode($profile->ProfileType), true)[0],
        'name' => json_decode(json_encode($profile->ProfileName), true)[0]


  $user_preferences = array(  
    'seller_profiles' => $seller_profiles,
    'paypal_emailaddress' => json_decode(json_encode($response->SellerPaymentPreferences->DefaultPayPalEmailAddress), true)[0]

  return $user_preferences;

The other method that we used is getEbayDetails. It uses the GeteBayDetails method from the API. We only need to specify a value for DetailName for this to work. Earlier, we supplied ShippingServiceDetails as the value. This allows us to get a list of shipping services supported by the eBay website where the product will be listed. For a list of other applicable values for the DetailName, you can check out this page.

public function getEbayDetails($detail_name){

  $request_body = '<?xml version="1.0" encoding="utf-8"?>
  <GeteBayDetailsRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <eBayAuthToken>' . $this->user_token . '</eBayAuthToken>
  <DetailName>' . $detail_name . '</DetailName>

  $response = $this->request('GeteBayDetails', $request_body);

  $services = array();
  foreach($response->ShippingServiceDetails as $service){
    $services[] = json_decode(json_encode($service->ShippingService), true)[0];

  return $services; 


Going back to the settings controller, add the updateAction method. What this does is update the store settings. Here we’re using valitron to do the validation. If the validation passes, we extract the values one by one. For the checkboxes, we check if the corresponding field is not empty. If it’s not then we set the value to 1, otherwise 0. After that we use a prepared statement to update the store settings, pass in a message to be returned to the user, then redirect to the settings page. If the validation fails, we simply pass in the errors and redirect to the settings page.

public function updateAction(){

    $v = new Valitron\Validator($_POST);
    $v->rule('required', array('store_name', 'county', 'street', 'country_code_type', 'ebay_website', 'postal_code',
      'currency_code', 'item_location', 'dispatch_time', 'listing_duration', 'listing_type', 'condition_type',
      'PAYMENT', 'RETURN_POLICY', 'SHIPPING', 'shipping_service', 'shippingservice_priority', 'shippingservice_cost', 'shippingservice_additionalcost'));
      $id = 1; //store settings id
      $store_name = $_POST['store_name'];
      $street = $_POST['street'];
      $county = $_POST['county'];
      $country_code_type = $_POST['country_code_type'];
      $ebay_website = $_POST['ebay_website'];
      $postal_code = $_POST['postal_code'];

      $category_mapping = (!empty($_POST['category_mapping'])) ? 1 : 0;
      $category_prefill = (!empty($_POST['category_prefill'])) ? 1 : 0;
      $optimal_picturesize = (!empty($_POST['optimal_picturesize'])) ? 1 : 0;
      $out_of_stock_control = (!empty($_POST['out_of_stock_control'])) ? 1 : 0;
      $get_it_fast = (!empty($_POST['get_it_fast'])) ? 1 : 0;
      $include_prefilled = (!empty($_POST['include_prefilled'])) ? 1 : 0;

      $currency_code = $_POST['currency_code'];
      $item_location = $_POST['item_location'];
      $dispatch_time = $_POST['dispatch_time'];
      $listing_duration = $_POST['listing_duration'];
      $listing_type = $_POST['listing_type'];
      $condition_type = $_POST['condition_type'];
      $payment_policy = $_POST['PAYMENT'];
      $return_policy = $_POST['RETURN_POLICY'];
      $shipping_policy = $_POST['SHIPPING'];
      $shipping_service = $_POST['shipping_service'];

      $shippingservice_priority = $_POST['shippingservice_priority'];
      $shippingservice_cost = $_POST['shippingservice_cost']; 
      $shippingservice_additionalcost = $_POST['shippingservice_additionalcost'];

      if($query = $this->app->db->prepare("UPDATE store_settings SET store_name = ?, county = ?, street = ?, 
          country_code_type = ?, ebay_website = ?, postal_code = ?, category_mapping = ?, category_prefill = ?, 
          currency_code = ?, item_location = ?, dispatch_time = ?, listing_duration = ?, listing_type = ?, 
          condition_type = ?, optimal_picturesize = ?, out_of_stock_control = ?, get_it_fast = ?, include_prefilled = ?, 
          shipping_profile = ?, return_profile = ?, payment_profile = ?, shipping_service = ?,
          shippingservice_priority = ?, shippingservice_cost = ?, shippingservice_additionalcost = ? 
          WHERE id = ?")){

      $query->bind_param("ssssssiississsiiiissssiddi", $store_name, $county, $street, $country_code_type, $ebay_website, $postal_code, $category_mapping, $category_prefill, $currency_code, $item_location, $dispatch_time, $listing_duration, $listing_type, $condition_type, $optimal_picturesize, $out_of_stock_control, $get_it_fast, $include_prefilled, $shipping_policy, $return_policy, $payment_policy, $shipping_service, $shippingservice_priority, $shippingservice_cost, $shippingservice_additionalcost, $id);


        $this->app->flash('message', array('type' => 'success', 'text' => 'Settings was updated!'));
        $this->app->flash('form', $_POST);
        $this->app->flash('message', array(
            'type' => 'danger', 
            'text' => 'Please fix the following errors', 
            'data' => $v->errors())




In this part, we implemented a basic updating mechanism for our store’s settings. In the next and final part of this series, we’ll be adding the Product functionality – the ability to add new products to our eBay store. Stay tuned!

Frequently Asked Questions (FAQs) about Configuring Store Settings in eBay Trading API

How can I get started with eBay Trading API?

To get started with eBay Trading API, you first need to create an eBay developer account. Once you have an account, you can generate your AppID, DevID, and CertID from the developer dashboard. These keys are essential for making API calls. After obtaining these keys, you can use them in your application to interact with eBay’s services.

What are the necessary configurations for eBay Trading API?

The necessary configurations for eBay Trading API include setting up your API credentials (AppID, DevID, CertID), specifying the API version, and setting the endpoint URL. You also need to set the request format (XML or SOAP), and the site ID for the eBay site you want to interact with.

How can I change my account settings in eBay Trading API?

You can change your account settings in eBay Trading API by navigating to the account settings page on your eBay developer account. Here, you can update your API credentials, change the API version, modify the endpoint URL, and adjust other settings as needed.

What is the purpose of GeteBayDetails call in eBay Trading API?

The GeteBayDetails call in eBay Trading API is used to retrieve various details about eBay’s systems. This includes details about shipping services, payment options, regions, and more. This information can be useful for configuring your application to work with eBay’s services.

How can I handle errors in eBay Trading API?

eBay Trading API provides detailed error messages in the response when an API call fails. You can use these error messages to understand what went wrong and how to fix it. It’s also a good practice to implement error handling in your application to manage these errors effectively.

Can I test my API calls before using them in my application?

Yes, eBay provides a sandbox environment where you can test your API calls. This environment mimics the live eBay environment, allowing you to test your API calls without affecting live data.

How can I improve the performance of my eBay Trading API calls?

You can improve the performance of your eBay Trading API calls by optimizing your requests. This includes only requesting the data you need, using filters to limit the data returned, and using pagination to retrieve large amounts of data in smaller chunks.

What are the rate limits for eBay Trading API?

eBay imposes rate limits on their Trading API to ensure fair usage. The rate limits depend on your account type and the specific API call. You can view your current rate limits in your eBay developer account.

How can I monitor my usage of eBay Trading API?

You can monitor your usage of eBay Trading API through the usage reports provided in your eBay developer account. These reports provide detailed information about your API usage, including the number of calls made, the data returned, and any errors encountered.

Can I use eBay Trading API to manage multiple eBay stores?

Yes, you can use eBay Trading API to manage multiple eBay stores. You can do this by using the StoreID parameter in your API calls to specify which store you want to interact with.