Language

2Checkout Documentation

Stop Lineitem Recurring

The stop_lineitem_recurring call is used to attempt to stop a recurring line item for a specified sale. This call will send the RECURRING_STOPPED INS message.

URL: https://www.2checkout.com/api/sales/stop_lineitem_recurring

HTTP Method: POST


Input Parameters

Parameter Description
lineitem_id Line Item ID to stop recurring on. Required.

Data Returned

Parameter Description
response_code Tells the user whether or not the operation was successful
response_message Tells the user why the operation was or was not successful

Example API Call

Twocheckout::username('testlibraryapi901248204');
Twocheckout::password('testlibraryapi901248204PASS');
// Twocheckout::sandbox(true);  #Uncomment to use Sandbox

$args = array(
    'sale_id' => 4834917619
);
try {
    $result = Twocheckout_Sale::stop($args);
} catch (Twocheckout_Error $e) {
    $e->getMessage();
}
Twocheckout::API.credentials = {
  :username => 'APIuser1817037',
  :password => 'APIpass1817037',
# :sandbox => 1   #Uncomment to use Sandbox
}

begin
  sale = Twocheckout::Sale.find(:sale_id => 4786293822)
  last_invoice = sale.invoices.last
  last_lineitem = last_invoice.lineitems.last
  last_lineitem.stop_recurring!
rescue Exception => e
  puts e.message
end
var tco = new Twocheckout({
    apiUser: "APIuser1817037",
    apiPass: "APIpass1817037",
    sandbox: false 
});

args = {
    lineitem_id: "4774380224"
};

tco.sales.stop(args, function (error, data) {
    if (error) {
        console.log(error);
    } else {
        console.log(data.response_code);
    }
});
twocheckout.Api.auth_credentials({
    'username': APIuser1817037',
    'password': 'APIpass1817037',
#   'mode': 'sandbox'  #Uncomment to use Sandbox
})

try:
    sale = twocheckout.Sale.find(params)
    result = sale.stop()
except TwocheckoutError as error:
    print error.message
TwoCheckoutConfig.ApiUsername = "APIuser1817037";
TwoCheckoutConfig.ApiPassword = "APIpass1817037";
// TwoCheckoutConfig.Sandbox = true;    #Uncomment to use Sandbox

try
{
    var ServiceObject = new SaleService();
    var ArgsObject = new SaleStopServiceOptions();
    ArgsObject.sale_id = "4831145902";

    var result = ServiceObject.Stop(ArgsObject);
    Console.Write(result);
}
catch (TwoCheckoutException e)
{
    Console.Write(e);
}
TwoCheckoutConfig.ApiUsername = "APIuser1817037";
TwoCheckoutConfig.ApiPassword = "APIpass1817037";
// Twocheckout.mode = "sandbox";    #Uncomment to use Sandbox

try {
    Sale sale = TwocheckoutSale.retrieve("4832772521");
    TwocheckoutResponse result = sale.stop();
} catch (TwocheckoutException e) {
    String message = e.toString();
}
curl -X POST https://www.2checkout.com/api/sales/stop_lineitem_recurring -u \
    'username:password' -d 'vendor_id=123456' -d 'lineitem_id=1234567890' \
    -H 'Accept: application/json'

Example Successful Response

    {
       "response_code" : "OK",
       "response_message" : "Recurring billing stopped for lineitem"
    }

Common Error Codes

Code Description
PARAMETER_MISSING Required parameter missing:
PARAMETER_INVALID Invalid value for parameter:
RECORD_NOT_FOUND Unable to find record.
FORBIDDEN Access denied to sale.