Got questions? Leave your message here or Schedule a quick call with our manager now

How to connect eBay to API2Cart?

To add eBay to Api2Cart, the following parameters are required:

  • ebay_client_id: eBay Client ID
  • ebay_client_secret: eBay Client Secret
  • ebay_refresh_token: eBay Refresh Token
  • ebay_environment: eBay Environment (Sandbox or Production)
  • ebay_site_id: eBay Site ID (optional, default is 0)

To obtain these parameters, you need to have a developer account on eBay.
To sign in or register, please visit the following page: https://developer.ebay.com/signin

Application Keys are available on the following page: https://developer.ebay.com/my/keys
Depending on the environment (Sandbox or Production), you will need the App ID (ebay_client_id) and Cert ID (ebay_client_secret).

To obtain the ebay_refresh_token, select User Tokens on the page that opens.

In the Get a Token from eBay via Your Application section, add the eBay Redirect URL.

Fill in the fields for the added eBay Redirect URL and click Save. Enable the OAuth Enabled checkbox for this eBay Redirect URL.

Then select OAuth and click Test Sign-In.

This will open a login page where you need to log in with your eBay seller account (for sandbox environment, you can register a test user at https://developer.ebay.com/sandbox/register).

After successful login with the seller account and confirmation of the application access request, you will be redirected to the URL specified in the Your auth accepted URL field. The redirect URL will include a code parameter in the following format:
code:v^1.1#i^1#r^1#p^3#f^0#I^3#t^Ul41Xzg6MDM5RENGM0E3NEIxNTJDQkU5QTRfMV8xI0VeMTI4NA==

This code is required to obtain the refresh token. To get the refresh token, send a POST request to https://api.ebay.com/identity/v1/oauth2/token (for production) or https://api.sandbox.ebay.com/identity/v1/oauth2/token (for sandbox) with the following parameters:

  • grant_type: authorization_code
  • redirect_uri: the URL specified in the "Your auth accepted URL" field
  • code: the code obtained (make sure it's not URL encoded)
Include basic authorization in the request as well.

Upon successful execution of the request, you will receive the refresh token, which is used as the ebay_refresh_token parameter when adding the eBay store to Api2Cart.

The ebay_environment parameter can be either Sandbox or Production, depending on the use case.

The ebay_site_id parameter (default is 0) is used to identify the eBay Site ID. More information can be found at https://developer.ebay.com/devzone/merchandising/docs/concepts/siteidtoglobalid.html.

eBay Marketplace Account Deletion/Closure Notifications Workflow

You should also pay attention to eBay Marketplace account deletion/closure. You need to subscribe to a webhook that will receive notifications about eBay Marketplace account deletions.

On the Alerts and Notifications page for the Production environment, select the Marketplace Account Deletion checkbox. You can choose to opt-out of receiving deletion notifications or subscribe to them.

To receive notifications, you need to prepare a callback that will respond with a specific response. Fill in the fields accordingly:

  • Callback URL: Fill in the URL of your callback endpoint.
  • Callback Method: Select the appropriate method (e.g., POST).
  • Request Headers: Define any required headers for the callback.
  • Request Body: Configure the request body format (e.g., JSON).

After clicking Save, eBay will send data that needs to be processed in a specific way and return a generated hash as a response.

Your callback endpoint should respond with the following JSON response:

{ "challengeResponse": "52161ff4651cb71888801b47bae62f44d7f6d0aab17e70d00f64fc84368ca38f" }

For an example, you can use a workflow on a service like https://pipedream.com/ with the appropriate code.

More details on how to do this can be found https://developer.ebay.com/marketplace-account-deletion.

After successful validation of the callback, the Send Test Notification button will become active.

Once everything is set up, eBay will start sending deletion account notifications to the specified URL.

Posted in: Getting Started