Language

2Checkout Documentation

Delete Coupon

The delete_coupon call is used to delete a coupon.

URL: https://www.2checkout.com/api/products/delete_coupon

HTTP Method: POST


Input Parameters

Parameter Description
coupon_code String value of coupon code for deleting coupon. 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('APIuser1817037');
Twocheckout::password('APIpass1817037');

$args = array(
    'coupon_code' => '123test'
);

$response = Twocheckout_Coupon::delete($args);
Twocheckout::API.credentials = { :username => 'APIuser1817037', :password => 'APIpass1817037' }

new_coupon = Twocheckout::Coupon.create({:date_expire => "2020-01-01", :type => "shipping", :minimum_purchase => 1.00})
puts new_coupon.delete!
args = {
    coupon_code: "TEST123"
};

tco.coupons.delete(args, function (error, data) {
    if (error) {
        console.log(error);
    } else {
        console.log(data.response_code);
    }
});
twocheckout.Api.credentials({'username':'APIuser1817037', 'password':'APIpass1817037'})

params = {
    'coupon_code': 'PYTEST12'
    }
    
coupon = twocheckout.Coupon.find(params)

result = coupon.delete()
var ServiceObject = new CouponService();
var ArgsObject = new CouponDeleteServiceOptions();
ArgsObject.coupon_code = coupon_code;

var result = ServiceObject.Delete(ArgsObject);
Coupon coupon = TwocheckoutCoupon.retrieve(coupon_code);
TwocheckoutResponse result = coupon.delete();
curl -G https://www.2checkout.com/api/products/detail_coupon \
    -H 'Accept: application/json' -u 'username:password' \
    -d 'coupon_code=APITEST002'

Example Successful Response

    {
       "response_code" : "OK",
       "response_message" : "Coupon successfully deleted."
    }

 


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 coupon.