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.apiusername & Twocheckout.apipassword class variables before calling a method in this class.

##Method

###create

Use to create a coupon.

####Arguments

  • HashMap<String, String> Parameters
  • Hash containing create_coupon parameters. Parameters -> API Create Coupon

####Returns

Returns a TwocheckoutResponse object.

####Example Usage:

HashMap<String, String> params = new HashMap<String, String>();
params.put("coupon_code", "JAVATEST1");
params.put("date_expire", "2020-12-12");
params.put("type", "shipping");
params.put("minimum_purchase", "1.00");

TwocheckoutResponse result = TwocheckoutCoupon.create(params);

####Example Response (toJson):

{
   "coupon_code" : "JAVATEST1",
   "response_code" : "OK",
   "response_message" : "Coupon successfully created"
}

Clone this wiki locally