Language

2Checkout Documentation

Create

The Twocheckout_Coupon class provides methods to create, retrieve, update and delete coupons and will return an Array or JSON response depending on your format specification.

Method

create

Use to create a coupon.

Arguments

  • Array containing create_coupon parameters in key => value pairs. Parameters -> API Create Coupon

Returns

Returns a JSON object or array depending on your specification.

Example Usage:

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

$args = array(
    'coupon_code' => '123TEST',
    'date_expire' => '2020-07-31',
    'value_off' => 1.00,
    'type' => sale,
    'minimum_purchase' => 2.00
);

$result = Twocheckout_Coupon::create($args);

Example Response:

Array
(
    [coupon_code] => 123TEST
    [response_code] => OK
    [response_message] => Coupon successfully created
)