Skip to content

Coupon_Create

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

###create

Use to create a coupon.

####Arguments

  • hash Parameters
  • Hash containing create_coupon parameters. Parameters -> API Create Coupon

####Returns

Returns a Coupon object.

####Example Usage:

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

new_coupon = Twocheckout::Coupon.create({:date_expire => "2020-01-01", :type => "shipping", :minimum_purchase => 1.00})

####Example Response:

#<Twocheckout: : Coupon: 7G2NCGX>{
    "coupon_code"=>"7G2NCGX",
    "date_expire"=>"2020-01-01",
    "minimum_purchase"=>"1.00",
    "percentage_off"=>nil,
    "product"=>[
        {
            "product_id"=>"0",
            "product_url"=>"https://www.2checkout.com/api/products/detail_product?product_id=0"
        }
    ],
    "type"=>"shipping",
    "value_off"=>nil
}
Clone this wiki locally