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


Use the EndFixedPriceItem call to end the specified fixed-price listing before the date and time at which it would normally end (per the listing duration). For e.g. you may need to use this call to end the listing on the site if you are out of stock.

The following code sample shows how to end a listing using the EndFixedPriceItem call.

/*
© 2011-2013 eBay Inc., All Rights Reserved
Licensed under CDDL 1.0 - http://opensource.org/licenses/cddl1.php
*/


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

/**
*
* The following steps need to be done to delete a field from an existing listing.
*
* 1. Create an ApiContext Object
* 2. Set the auth token and target api url (Webservice endpoint)
* 3. Create a EndFixedPriceItemCall object.
* 4. Set the SKU, ending reason to the object.
* 5. Execute EndFixedPriceItemCall#endFixedPriceItem() to end the listing.
*
*/
public class EndFPItemSample {

    public static void endFixedPriceItem() {
 
        ApiContext apiContext = new ApiContext();
        ApiCredential cred = apiContext.getApiCredential();
        ApiLogging apiLogging = new ApiLogging();
        apiContext.setApiLogging(apiLogging);
 
        // set the server url and credentials for Sandbox
        apiContext.setApiServerUrl("https://api.sandbox.ebay.com/wsapi");
        cred.seteBayToken("YourToken");

        // Set site to US
        apiContext.setSite(SiteCodeType.US); 

        EndFixedPriceItemCall endItem = new EndFixedPriceItemCall(apiContext);

        endItem.setSKU("CODE_SAMPLE_RELIST_VARIATION_SKU2");
        endItem.setEndingReason(EndReasonCodeType.NOT_AVAILABLE);

        try {
            endItem.endFixedPriceItem();
        } catch (ApiException e) {
            e.printStackTrace();
        } catch (SdkException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        endFixedPriceItem();
    }


}

 

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