Skip to main content
Published: March 17 2011, 3:58:00 PMUpdated: November 28 2020, 9:18:00 PM


Here is a Java  SDK AddFixedPriceItem sample for listing an item with a product identifier (UPC).

© 2011-2013 eBay Inc., All Rights Reserved
Licensed under CDDL 1.0 -

import com.ebay.sdk.*;
import com.ebay.soap.eBLBaseComponents.*;

public class AddFixedPriceItemWithProductIdentifier {

    private static String USER_TOKEN=" YOUR TOKEN";
    public static ApiContext createApiContext() {
        ApiContext apiContext = new ApiContext();
        ApiLogging apiLogging = new ApiLogging();

        CallRetry cr = new CallRetry();
        cr.setDelayTime(1000); // Wait for one second between each retry-call.

        String[] apiErrorCodes = new String[]{"502"};
        // Set trigger exceptions for CallRetry.

        // Build a dummy SdkSoapException so that we can get its Class.
        Class[] tcs = new Class[]{com.ebay.sdk.SdkSoapException.class};

        // set the server url and credentials for Sandbox
        ApiCredential cred = apiContext.getApiCredential();

        // Set site to US

        return apiContext;

    private static FeesType addWithUPC() throws ApiException, SdkException,  Exception {

        FeesType fee = null;
        AddFixedPriceItemCall request = new AddFixedPriceItemCall(createApiContext());

        ItemType item = new ItemType();

        item.setTitle("*** TEST ITEM DO NOT BID ***");
        item.setDescription("Item created for testing. Please DO NOT BID");

        // set the item condition depending on the value from GetCategoryFeatures


        // Track inventory by SKU

        // Specify unique SKU

        // Set Payment Method to PayPal
        BuyerPaymentMethodCodeType[] arrPaymentMethods = new BuyerPaymentMethodCodeType[]{BuyerPaymentMethodCodeType.PAY_PAL};

         // Set shipping services
        ShippingDetailsType sd = new ShippingDetailsType();

        ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();

        AmountType shipAmt1 = new AmountType();


        AmountType shipAmt1Addnl = new AmountType();


        ShippingServiceOptionsType st2 = new ShippingServiceOptionsType();

        AmountType shipAmt2 = new AmountType();


        AmountType shipAmt2Addnl = new AmountType();

        sd.setShippingServiceOptions(new ShippingServiceOptionsType[]{st1,st2});

        item.setShippingDetails(sd); // Add shipping details

        // Specify return policy
        ReturnPolicyType rp = new ReturnPolicyType();
        rp.setDescription("Return accepted (Conditions apply)");
        item.setReturnPolicy(rp); // Add return policy to the item

        // Specify Quantity, Start Price
        AmountType amt = new AmountType();

        // Adding product details (UPC)
        String UPC = "753759091033";   // (Electronics > GPS Navigation > GPS Systems)
        ProductListingDetailsType product = new ProductListingDetailsType();

        // include catalog product information in the item description and catalog picture


        PictureDetailsType pics = new PictureDetailsType();


        item.setDispatchTimeMax(1); // Set handling time

        fee = request.addFixedPriceItem();

        return fee;

    public static void main(String[] args) {

        try {
            FeesType fee = addWithUPC();
        } catch (ApiException e) {
        } catch (SdkException e) {
        } catch (Exception e) {


The generated AddFixedPriceItem SOAP request is attached to this article.

How well did this answer your question?
Answers others found helpful