Contact

Technology

Sep 23, 2014

Robust eBay Integration for Your Supply Chain

Jordan Powell

Jordan Powell

Default image background

eBay is an excellent marketplace that allows a person or company to get their products in front of many potential buyers. A casual seller can easily manage their customer interaction using eBay’s web interface. As both listings and sales increase, a more automated solution is necessary to both meet customer demand and respond quickly to orders. eBay’s Developer Program provides several APIs that allow a company to completely automate and integrate every facet of the listing and order management.

Today I am going to focus on fulfilling completed orders. We learned the following lessons while helping a client with eBay integration, and these tips will make your process that much easier.

CONFIGURE A DEVELOPER ACCOUNT

The first step is to create and configure an eBay Developer account. Correct configuration from the start will make the entire application lifecycle go much more smoothly than trying to correct it at the end. You will only need one developer account, but you will need one seller account for each environment you need. So create a single developer account and then use the links on the account page to create a Sandbox account for each stage of development (Dev, QA, and UAT). The eBay Sandbox is a single environment where all testing is done. The different seller accounts will allow you to connect and test properly. You can create the production account on the real eBay website and tie it in as well. The sandbox and production areas will each have a set of developer, application, and certificate keys that will allow you to programmatically interface with eBay. In addition, you will need to generate a user token for each seller account. The combination of keys and tokens is your unique signature. Be sure to record each token as it will not be retrievable after it is generated.

EBAY API SETUP

Several SDKs are available that come prepackaged with classes and connections to accomplish the integration. Instead, we recommend using Apache CXF in combination with the eBay WSDLs to connect and translate the information into useful Java code. This choice was made mainly because we wanted to incorporate logging at deeper layers and ensure that the integration was robust and reliable enough to be considered enterprise-class software. This also allowed us to easily drop in a new WSDL when the API was updated and have CXF update all of the underlying code.

TRADING API

In order to provide excellent customer service, we chose eBay’s Trading API as an excellent way to poll for new orders. It has an extremely large WSDL, which in some cases will generate more than 1,000 enumerations in a file. By default, CXF will only process the first 256 of them. Add the following to allow the automated CXF class explosion to fully process the WSDL: 

The Trading API has two main calls that we used to interact with eBay:

  1. GetOrders

  2. CompleteSale

There are several lessons we learned along the way that make the order management process nearly bulletproof:

  1. The Trading API requires a different URL to be used for each type of call. The WSDL only has the base URL as its connection string. Therefore you must inject the API address when creating the connection port. So the following code will help you dynamically connect to the correct URL:

if (service == null) { URL wsdlUrl = this.getClass().getResource(wsdlLocation); service = new EBayAPIInterfaceService(wsdlUrl, SERVICE_NAME);}   EBayAPIInterface port;   try { eBayServiceHandlerResolver = new EBayServiceHandlerResolver(); service.setHandlerResolver(eBayServiceHandlerResolver); port = service.getEBayAPI(); Client client = ClientProxy.getClient(port);   String newAddress = client.getEndpoint().getEndpointInfo().getAddress() + "?callname=" + requestType + "&siteid=0" + "&appid=" + appKey + "&version=" + version + "&Routing=new"; client.getEndpoint().getEndpointInfo().setAddress(newAddress);   Map<String, Object> reqContext = client.getRequestContext(); reqContext.put(Message.ENDPOINT_ADDRESS, newAddress);

  1. Log each and every interaction with eBay. We created a table in our database that logs each call’s request, response, and time, along with a processed flag. This allows us to replay orders that have issues by simply flipping a database flag. This is not the leanest method for sure, but it gave us lifecycle maintenance, quick debugging of the exact communications with eBay, and manual control of each step of the process.  All of this allowed us to be responsive during those unforeseen hiccups that are bound to occur.

  2. Use JAXB to split individual orders up and process them one by one. This allows you to receive 10 different orders in a single GetOrders call and keeps a single order from ruining the bunch. We recommend keeping a JAXB copy of every individual order in the database so they can be replayed and reprocessed if need be.

  3. Make sure there is a way to match up eBay taxes to your own accounting system. All of the numbers need to align when orders are reconciled at the end of the month.

So in the end, the lifecycle of an eBay order looks like this:

  1. The customer completes a purchase of a product or group of products on eBay.

  2. Within 10 minutes (because of the polling timer), the polling application runs GetOrders and pulls down the new orders. The XML response is saved in our database.

  3. Within 10 minutes (because of a second polling timer), the order management system finds all unprocessed GetOrders responses in the database, splits each order into its own XML using JAXB, and saves the order to a second database table.

  4. All unprocessed Order XMLs are picked up and translated from eBay objects into our client’s data structure.

  5. As each order is saved, a notification is sent to the warehouse that is located closest to the customer’s shipping ZIP code for the order to be fulfilled.

  6. When the warehouse scans the tracking number on the completed shipping box, a notification is sent back to the order management system with that tracking number.

  7. The order management system then calls the CompleteSale web service call and notifies the customer of the incoming shipment.

If all goes well and it is a slow day at the warehouse, the time from a customer completing the sale on eBay to actually shipping the order is less than an hour.

If there is a hiccup in the process, customer service has a dashboard to see stalled orders (using the processed flag in the XML tables) and can retry the orders or manually push them through. This workflow is essential as each environment is tested during the first few days of production. It provides a backup and ensures that orders are sent to customers quickly.

EBAY SELLER RATING

The seller rating drives customer confidence and therefore drives sales. Using the above approach we were able to help our client provide excellent service and quickly gain traction in eBay’s marketplace. During the initial production launch it is critical to keep a close watch on orders to ensure they do not get stuck in the process. Monitor the log tables on a periodic basis so nothing gets in the way of the launch. Rapid and accurate delivery is like a slowly building snowball that can quickly lead to a landslide of orders. Let us know if Credera can assist you as you expand your customer base and develop a robust supply chain strategy.

Conversation Icon

Contact Us

Ready to achieve your vision? We're here to help.

We'd love to start a conversation. Fill out the form and we'll connect you with the right person.

Searching for a new career?

View job openings