Developers Program

Enabling BestOffer in JAVA SDK

Published: September 24 2006, 9:23:00 PMยทUpdated: July 27 2022, 1:05:36 PM

Products

Question

Enabling BestOffer in JAVA SDK

Answer

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);

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

item.setShippingDetails(getShippingDetails());

return item;
}

Additional Resource

How well did this answer your question?