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

Java SDK AddFixedPriceItem sample for listing an item with an product identifier (ePID).

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

public class AppAddItemWithePID {

    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 addFixedItem() throws ApiException, SdkException, Exception {

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

        ItemType item = new ItemType();
        item.setTitle("Testing item. Dont bid");
        item.setDescription("Testing item. Dont 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};

        // Specify Quantity, Start Price         
        item.setQuantity(new Integer(10));



        // set item pid
        String ePID = "72068366"; // (Electronics > GPS Navigation > GPS Systems)  
        ProductListingDetailsType pld = new ProductListingDetailsType();
        // include catalog product information in the description and catalog picture

        // Add item level pictures
        PictureDetailsType pdt = new PictureDetailsType();
        pdt.setPictureURL(new String[]{""});

        fee = request.addFixedPriceItem();

        return fee;

    private static ReturnPolicyType getReturnPolicy() {
        ReturnPolicyType rp = new ReturnPolicyType();
        rp.setDescription("No accepted");
        return rp;

    private static ShippingDetailsType getShippingDetails() {
        ShippingDetailsType sd = new ShippingDetailsType();

        ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();

        ShippingServiceOptionsType st2 = new ShippingServiceOptionsType();

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

        return sd;

    private static AmountType getAmount(double amount) {
        AmountType a = new AmountType();
        return a;

    public static void main(String[] args) {

        try {
            FeesType fee = addFixedItem();
        } catch (ApiException e) {
            // TODO Auto-generated catch block
        } catch (SdkException e) {
            // TODO Auto-generated catch block
        } catch (Exception e) {
            // TODO Auto-generated catch block


The generated AddFixedPriceItem SOAP request is attached to this article.

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