PEAR Manual
Prev |  | Next

# Getting started

Getting started -- Getting started with the eBay webservice

## Developing eBay applications

The eBay webservice is of course not free to use by the public. To develop and test your applications, you will have to register as an eBay developer (which is free of charge). Furthermore, you will not be able to test and develop on the eBay site, before your application has been certified.

## The eBay sandbox

The eBay Developers Program Sandbox is a test environment that represents a "mini" eBay site. The Sandbox provides the most important features of the eBay site, allowing you to build and test your application in a non-production environment. The eBay Sandbox supports both API testing as well as site testing via the GUI interface.

While developing your application, you will always be using the eBay sandbox, which can be accessed via web at http://sandbox.ebay.com/. This site looks and behaves like any eBay website you are being used to.

## Using the sandbox

To develop applications in the sandbox you will have to register at the eBay developers program. To do this, follow these steps:

1. Register as an eBay user:

   In order to register as an eBay developer, you'll have to be an eBay user. As eBay users are valid on all international sites, it is sufficient if you have an eBay user id for your local eBay site, like ebay.com or ebay.de.

2. Register as an eBay developer:

   Next, you will have to register as an eBay developer at the eBay developer program. This procedure can take some time, as they require you to enter a lot of information, so you should do this carefully. If you are developing an open source application using Services_Ebay, you should apply for an Individual license.

   After the registration has been finisehd, you will recieve three keys that you will need to authenticate your eBay application: DevID, AppID and CertID. You will need these keys later so you should save them somewhere.

3. Create one or more test users:

   As the sandbox does not share any data with the eBay sites, you will have to create new users that you can use to add items, make transactions and give feedback. You can create as many users as you need for testing purposes, just use the registration form in the sandbox.

   You will need a valid email address for each of your users, as well as a valid US address and telephone number, you can easily get on by using YellowPages. A credit card is not required, your test users will receive money from eBay they can spend in the sandbox. Of course, this is no real money, which has not use outside of the sandbox.

4. Validate your test users:

   If you want your test users to sell items on eBay, you will need to validate them. This can be done using the ValidateTestUserRegistration() API call, which is already supported by Services_Ebay.

## Authentication and Authorization

eBay's Auth&Auth process is quite complex and can be the biggest hurdle for getting started with the webservice. To make an API call the following information is required:

- DevID (received after registration, unique per developer)

- AppID (received after registration, unique per application)

- CertID (received after registration, unique per application)

- Authentication Token, unique for each user of your application

While you already are in possession of the first three tokens, you still need the last one to make an API call. If your application is used by more than one user (which is the case for web applications), eBay does not want your application to receive the usernames and passwords of your users. If a user authenticates, your application is supposed to redirect him to the eBay login page and pass an additional parameter (a so called RuName). The user will then enter his login information as he is used to on the eBay website and then authorize your application to make API calls on his behalf.

After that, eBay will redirect the user back to your application and pass a unique token, which can be used to identify this user when your application is making API calls. This technique has several advantages:

- Single sign-on system for eBay applications

- When your application is hacked, no passwords are revealed

- The user only sees the login screen he is used to.

As this authentication procedure is quite complex and requires various API calls to function there is an easier way, which can be used for testing. eBay provides the so called Single-User-Tool, an HTML-based tool, which creates tokens that you can use to authenticate a user. All you need to do is submit your DevID, AppID and CertID and select whether the token will be used in the sandbox or production environment.

## Getting started with Services_Ebay

Services_Ebay provides a lot of examples, which demonstrate how the API calls have to be used. After installing Services_Ebay, they will be located in the docs/ directory of your PEAR installation. In order to run the examples, you will have to supply the authentication credentials you received from eBay. The easiest way to do this, is to modify the `config.php` file, which is located in the `examples` folder.

Example 60-1. The configuration file
    // DevID, AppID and CertID
    $devId  = 'HFGHSK7JKKJ82JKJFJHF84LKH86Z3JFF71KJKH';

    $appId  = 'IUENVCLJEGBN62JLKKLJHD34KKJL-GDJHDGJHD';

    $certId = 'GHKL67JKDJLKJGFBNMBCHGDLÖWJH241KKHJKKJ';

    // Username and password, only required by some calls
    // that set up the Auth&Auth mechanism
    $username = 'YourTestUser';

    $password = 'Secret Pass';

    // Token as returned from the Single-User-Tool
    $token = 'AgAAAA.......3jfiEQ**';

Prev | Home | Next
Introduction | Up | XML encoding