Skip to content

Coupon_List

Jacob McConnell edited this page Jun 10, 2014 · 2 revisions

You must specify your API username and password using the Twocheckout::API.credentials method before calling a method in this class.

##Method

###list

Use to retrieve a list of all active coupons or only those matching a variety of coupon attributes.

####Arguments

  • hash Parameters
  • Hash containing list_coupons parameters. Parameters -> API List Coupons

####Returns

Returns a Coupon list.

####Example Usage:

Twocheckout::API.credentials = { :username => 'APIuser1817037', :password => 'APIpass1817037' }

coupons = Twocheckout::Coupon.list()

####Example Response:

{
   "coupon" : [
      {
         "coupon_code" : "COUPON",
         "date_expire" : "3000-02-25",
         "minimum_purchase" : "1.00",
         "percentage_off" : "0.10",
         "type" : "product",
         "value_off" : null
      },
      {
         "coupon_code" : "FREESHIPPING",
         "date_expire" : "2013-04-13",
         "minimum_purchase" : "0.00",
         "percentage_off" : null,
         "type" : "shipping",
         "value_off" : null
      },
      {
         "coupon_code" : "SAVEJUNE",
         "date_expire" : "2013-03-31",
         "minimum_purchase" : "2999.99",
         "percentage_off" : null,
         "type" : "product",
         "value_off" : "100.00"
      }
   ],
   "response_code" : "OK",
   "response_message" : "Coupon information retrieved successfully."
}
Clone this wiki locally