Language

2Checkout Documentation

Detail Coupon

The detail_coupon call is used to retrieve the details for a single coupon.

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

HTTP Method: GET


Input Parameters

Parameter Description
coupon_code The string value of coupon code. Required

Data Returned

Parameter Description
coupon_code String value of coupon code.
date_expire Expiration Date. (YYYY-MM-DD)
percentage_off Percentage Discount
type Coupon type
value_off Fixed Discount
minimum_purchase Minimum purchase amount.
product_id ID of product selected for coupon.

Example API Call

Twocheckout::username('APIuser1817037');
Twocheckout::password('APIpass1817037');

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

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

coupon = Twocheckout::Coupon.find(:coupon_code => '7EBHKS2')
args = {
    coupon_code: 4631234571
};

tco.coupons.retrieve(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)
var ServiceObject = new CouponService();
var ArgsObject = new CouponRetrieveServiceOptions();
ArgsObject.coupon_code = "DOTNETSHIPPING";
var result = ServiceObject.Retrieve(ArgsObject);
HashMap params = new HashMap();
CouponList result = TwocheckoutCoupon.retrieve(params);
curl -G https://www.2checkout.com/api/products/detail_coupon \
    -H 'Accept: application/json' -u 'username:password' \
    -d 'coupon_code=APITEST002'

Example Successful Response

    {
       "coupon" : {
          "coupon_code" : "APITEST002",
          "date_expire" : "2012-12-31",
          "minimum_purchase" : "5.00",
          "percentage_off" : "5",
          "product" : [
             {
                "product_id" : "0",
                "product_url" : "https://www.2checkout.com/api/products/detail_product?product_id=0"
             }
          ],
          "type" : "sale",
          "value_off" : null
       },
       "response_code" : "OK",
       "response_message" : "Coupon detail retrieved successfully."
    }

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.