Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Contact support
Create a new promotion code.
cURL
curl --request POST \ --url https://api.hyperline.co/v1/promotion-codes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "code": "PROMO123", "coupon_id": "cou_DKL4Xcb5VSa8CQ", "customer_id": "cus_DKL4Xcb5VSa8CQ", "plan_id": "plan_DKL4Xcb5VSa8CQ", "product_id": "itm_DKL4Xcb5VSa8CQ", "expires_at": "2021-01-01T00:00:00.000Z", "max_redemptions": 10, "current_redemptions": 0, "duration_count": 1, "duration_period": "months", "only_for_first_time_order": false } '
import requests url = "https://api.hyperline.co/v1/promotion-codes" payload = { "code": "PROMO123", "coupon_id": "cou_DKL4Xcb5VSa8CQ", "customer_id": "cus_DKL4Xcb5VSa8CQ", "plan_id": "plan_DKL4Xcb5VSa8CQ", "product_id": "itm_DKL4Xcb5VSa8CQ", "expires_at": "2021-01-01T00:00:00.000Z", "max_redemptions": 10, "current_redemptions": 0, "duration_count": 1, "duration_period": "months", "only_for_first_time_order": False } headers = { "Authorization": "Bearer <token>", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text)
const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: JSON.stringify({ code: 'PROMO123', coupon_id: 'cou_DKL4Xcb5VSa8CQ', customer_id: 'cus_DKL4Xcb5VSa8CQ', plan_id: 'plan_DKL4Xcb5VSa8CQ', product_id: 'itm_DKL4Xcb5VSa8CQ', expires_at: '2021-01-01T00:00:00.000Z', max_redemptions: 10, current_redemptions: 0, duration_count: 1, duration_period: 'months', only_for_first_time_order: false }) }; fetch('https://api.hyperline.co/v1/promotion-codes', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err));
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.hyperline.co/v1/promotion-codes", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => json_encode([ 'code' => 'PROMO123', 'coupon_id' => 'cou_DKL4Xcb5VSa8CQ', 'customer_id' => 'cus_DKL4Xcb5VSa8CQ', 'plan_id' => 'plan_DKL4Xcb5VSa8CQ', 'product_id' => 'itm_DKL4Xcb5VSa8CQ', 'expires_at' => '2021-01-01T00:00:00.000Z', 'max_redemptions' => 10, 'current_redemptions' => 0, 'duration_count' => 1, 'duration_period' => 'months', 'only_for_first_time_order' => false ]), CURLOPT_HTTPHEADER => [ "Authorization: Bearer <token>", "Content-Type: application/json" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.hyperline.co/v1/promotion-codes" payload := strings.NewReader("{\n \"code\": \"PROMO123\",\n \"coupon_id\": \"cou_DKL4Xcb5VSa8CQ\",\n \"customer_id\": \"cus_DKL4Xcb5VSa8CQ\",\n \"plan_id\": \"plan_DKL4Xcb5VSa8CQ\",\n \"product_id\": \"itm_DKL4Xcb5VSa8CQ\",\n \"expires_at\": \"2021-01-01T00:00:00.000Z\",\n \"max_redemptions\": 10,\n \"current_redemptions\": 0,\n \"duration_count\": 1,\n \"duration_period\": \"months\",\n \"only_for_first_time_order\": false\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) }
HttpResponse<String> response = Unirest.post("https://api.hyperline.co/v1/promotion-codes") .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .body("{\n \"code\": \"PROMO123\",\n \"coupon_id\": \"cou_DKL4Xcb5VSa8CQ\",\n \"customer_id\": \"cus_DKL4Xcb5VSa8CQ\",\n \"plan_id\": \"plan_DKL4Xcb5VSa8CQ\",\n \"product_id\": \"itm_DKL4Xcb5VSa8CQ\",\n \"expires_at\": \"2021-01-01T00:00:00.000Z\",\n \"max_redemptions\": 10,\n \"current_redemptions\": 0,\n \"duration_count\": 1,\n \"duration_period\": \"months\",\n \"only_for_first_time_order\": false\n}") .asString();
require 'uri' require 'net/http' url = URI("https://api.hyperline.co/v1/promotion-codes") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer <token>' request["Content-Type"] = 'application/json' request.body = "{\n \"code\": \"PROMO123\",\n \"coupon_id\": \"cou_DKL4Xcb5VSa8CQ\",\n \"customer_id\": \"cus_DKL4Xcb5VSa8CQ\",\n \"plan_id\": \"plan_DKL4Xcb5VSa8CQ\",\n \"product_id\": \"itm_DKL4Xcb5VSa8CQ\",\n \"expires_at\": \"2021-01-01T00:00:00.000Z\",\n \"max_redemptions\": 10,\n \"current_redemptions\": 0,\n \"duration_count\": 1,\n \"duration_period\": \"months\",\n \"only_for_first_time_order\": false\n}" response = http.request(request) puts response.read_body
{ "id": "promo_DKL4Xcb5VSa8CQ", "code": "PROMO123", "coupon_id": "cou_DKL4Xcb5VSa8CQ", "client_id": "cli_DKL4Xcb5VSa8CQ", "customer_id": "cus_DKL4Xcb5VSa8CQ", "plan_id": "plan_DKL4Xcb5VSa8CQ", "product_id": "itm_DKL4Xcb5VSa8CQ", "created_at": "2021-01-01T00:00:00.000Z", "updated_at": "2021-01-01T00:00:00.000Z", "expires_at": "2021-01-01T00:00:00.000Z", "max_redemptions": 10, "current_redemptions": 0, "duration_count": 1, "duration_period": "months", "only_for_first_time_order": false }
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bearer <token>
<token>
Create promotion code payload
Promotion code.
"PROMO123"
ID of the coupon the promotion code applies.
"cou_DKL4Xcb5VSa8CQ"
ID of the customer the promotion code is restricted to. If set, only this customer can use it.
"cus_DKL4Xcb5VSa8CQ"
ID of the plan the promotion code is restricted to. If set, only subscriptions with this plan can use it.
"plan_DKL4Xcb5VSa8CQ"
ID of the product the promotion code is restricted to. If set, only subscriptions with this product can use it.
"itm_DKL4Xcb5VSa8CQ"
Date and time when the promotion code expires.
"2021-01-01T00:00:00.000Z"
Maximum number of redemptions for the promotion code. Independent from coupon's max redemptions.
10
Current number of redemptions for the promotion code.
0
Duration count applied to the subscription for the promotion code. 0 or null for once
once
x >= 1
1
Duration period applied to the subscription for the promotion code for the promotion code. Valid values are once, days, weeks, months, years
days
weeks
months
years
"months"
Whether the promotion code is only for first time orders. Defaults to false
false
The newly created promotion code
Promotion code ID.
"promo_DKL4Xcb5VSa8CQ"
ID of the Hyperline company the promotion code belongs to.
"cli_DKL4Xcb5VSa8CQ"
Promotion code creation date. UTC date time string in the ISO 8601 format.
Promotion code last edition date. UTC date time string in the ISO 8601 format.
Was this page helpful?