Skip to content

Coupon_Update

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

###update

Use to update an existing coupon.

####Arguments

  • hash Parameters
  • Hash containing update_coupon parameters. Parameters -> API Update Coupon

####Returns

Returns updated Coupon object.

####Example Usage:

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

coupon = Twocheckout::Coupon.find(:coupon_code => '7EBHKS2')
coupon = coupon.update(:date_expire => '2020-01-01')

####Example Response:

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