Skip to main content
Published: September 24 2006, 9:23:00 PMUpdated: November 28 2020, 2:48:11 PM

Enabling BestOffer in JAVA SDK

Detailed Description

    A seller can enable BestOffer feature for a fixed price item in AddItem call. The buildItem() function below illuminates how to set the relevant properties in JAVA SDK.

    public static ItemType buildItem() {
          String t = "Test BestOffer listing. DO NOT BID!";;
          ItemType item = new ItemType();
          item.setSite(SiteCodeType.US);
          item.setCurrency(CurrencyCodeType.USD);
          item.setTitle(t);
          item.setDescription("Test BestOffer listing.");
          item.setStartPrice(new AmountType(599));     
          item.setQuantity(new Integer(1));
          item.setListingDuration(ListingDurationCodeType.Days_7.getValue());
          item.setLocation("San Jose, CA");
          item.setCountry(CountryCodeType.US);       
       
         // Use GetCategoryFeatures to determine which categories support BestOffer feature
         CategoryType cat = new CategoryType();
         cat.setCategoryID("14111");
         item.setPrimaryCategory(cat);
       
         // BestOffer can only be applied to a fixed price format item
         item.setListingType(ListingTypeCodeType.FixedPriceItem);
       
         // Auto decline the offer that is lower than the MinimumBestOfferPrice
         // NOTE. The item's StartPrice must be higher than the MinimumBestOfferPrice
         ListingDetailsType listingDetails = new ListingDetailsType();
         listingDetails.setMinimumBestOfferMessage("I can't accept the offer ...");
         listingDetails.setMinimumBestOfferPrice( new AmountType (500.00));
         item.setListingDetails(listingDetails);
       
         //Enable best offer with setBestOfferEnabled function
         BestOfferDetailsType bodt = new BestOfferDetailsType();
         bodt.setBestOfferEnabled(new Boolean(true));
         item.setBestOfferDetails(bodt);       

         // Payment
         BuyerPaymentMethodCodeType[] arrPaymentMethods =
            new BuyerPaymentMethodCodeType[] {BuyerPaymentMethodCodeType.PaymentSeeDescription};
         item.setPaymentMethods(arrPaymentMethods);

         // Shipping range
         item.setShippingOption(ShippingOptionCodeType.WorldWide);

         item.setShippingDetails(getShippingDetails());
       
         return item;
  }


Version Info

The code example above was based on the versions specified below:

API Schema Version479
Java SDK Versionjavasdk v477.0 Point release

Additional Resource

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