Language

2Checkout Documentation

Create

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

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:

#{
    "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
}