Example Request
<?php //Set up API path and method $base_url = "https://app.paykickstart.com/api/"; $route = "coupons"; $url = $base_url . $route; $post = true; //Create request data string $data = http_build_query([ 'auth_token' => '3A0CKDSETE', 'coupon_name' => 'My Coupon Name', 'coupon_code' => 'discountcode', 'coupon_rate' => '25', 'coupon_type' => 'amount', 'coupon_apply_to' => [1,3], 'coupon_start_date' => '06/20/2017 11:00 PM', 'coupon_end_date' => '06/30/2017 11:00 AM', 'coupon_max_redemption' => null, 'plan_ids' => [ 2382, 2391 ], 'product_id' => 223 ]); //Execute cURL request $ch = curl_init(); if ($post) { curl_setopt($ch, CURLOPT_POSTFIELDS, $data); } else { $url = $url . "?" . $data; } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $output = curl_exec($ch); curl_close($ch); //Output Response echo json_decode($output);
Example Response
{ "success": true, "coupon_id": 27, "message": "Coupon was created successfully" }
Creates a new coupon.
ARGUMENTS
auth_token
The Paykickstart vendor’s API Key. This field is required.
coupon_name
coupon_code
The Unique coupon code for your coupon.
coupon_rate
The value of your coupon.
coupon_type
The type of value – accepted arguments are: “amount” and “percentage”
coupon_apply_to
Determines if the coupon should be applied to first charge (excludes split pay), first charge, rebills and/or split payments. This is an array parameter where one or more of the below arguments are accepted:
- 1: First Charge (excludes split pay)
- 2: First Charge
- 3: Rebills
- 4: Split Payments
coupon_start_date
The start date of when the coupon is active
coupon_end_date
The end date of when the coupon is active
coupon_max_redemption
The maximum number of times a coupon may be redeemed
plan_ids
An array of plan ids which the coupon should be applied to
product_id
The campaign id which the coupon should be applied to