Create Coupon
curl --request POST \
--url https://api.sellauth.com/v1/shops/{shopId}/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "consequatur",
"global": true,
"discount": 15,
"type": "percentage",
"max_uses": 25,
"max_uses_per_customer": 19,
"min_invoice_price": 14,
"start_date": "2012-05-28",
"expiration_date": "2012-05-28",
"allowed_emails": [
"oerdman@example.org"
],
"payment_method_ids": null,
"uses_count_mode": "paid",
"applies_to_renewals": true,
"items": null,
"disable_if_volume_discount": false,
"disable_if_quantity_deal": true,
"disable_if_bundle_offer": true,
"disable_if_gateway_discount": false,
"disable_if_affiliate_discount": false,
"disable_if_reseller_discount": false
}
'import requests
url = "https://api.sellauth.com/v1/shops/{shopId}/coupons"
payload = {
"code": "consequatur",
"global": True,
"discount": 15,
"type": "percentage",
"max_uses": 25,
"max_uses_per_customer": 19,
"min_invoice_price": 14,
"start_date": "2012-05-28",
"expiration_date": "2012-05-28",
"allowed_emails": ["oerdman@example.org"],
"payment_method_ids": None,
"uses_count_mode": "paid",
"applies_to_renewals": True,
"items": None,
"disable_if_volume_discount": False,
"disable_if_quantity_deal": True,
"disable_if_bundle_offer": True,
"disable_if_gateway_discount": False,
"disable_if_affiliate_discount": False,
"disable_if_reseller_discount": 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: 'consequatur',
global: true,
discount: 15,
type: 'percentage',
max_uses: 25,
max_uses_per_customer: 19,
min_invoice_price: 14,
start_date: '2012-05-28',
expiration_date: '2012-05-28',
allowed_emails: ['oerdman@example.org'],
payment_method_ids: null,
uses_count_mode: 'paid',
applies_to_renewals: true,
items: null,
disable_if_volume_discount: false,
disable_if_quantity_deal: true,
disable_if_bundle_offer: true,
disable_if_gateway_discount: false,
disable_if_affiliate_discount: false,
disable_if_reseller_discount: false
})
};
fetch('https://api.sellauth.com/v1/shops/{shopId}/coupons', 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.sellauth.com/v1/shops/{shopId}/coupons",
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' => 'consequatur',
'global' => true,
'discount' => 15,
'type' => 'percentage',
'max_uses' => 25,
'max_uses_per_customer' => 19,
'min_invoice_price' => 14,
'start_date' => '2012-05-28',
'expiration_date' => '2012-05-28',
'allowed_emails' => [
'oerdman@example.org'
],
'payment_method_ids' => null,
'uses_count_mode' => 'paid',
'applies_to_renewals' => true,
'items' => null,
'disable_if_volume_discount' => false,
'disable_if_quantity_deal' => true,
'disable_if_bundle_offer' => true,
'disable_if_gateway_discount' => false,
'disable_if_affiliate_discount' => false,
'disable_if_reseller_discount' => 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.sellauth.com/v1/shops/{shopId}/coupons"
payload := strings.NewReader("{\n \"code\": \"consequatur\",\n \"global\": true,\n \"discount\": 15,\n \"type\": \"percentage\",\n \"max_uses\": 25,\n \"max_uses_per_customer\": 19,\n \"min_invoice_price\": 14,\n \"start_date\": \"2012-05-28\",\n \"expiration_date\": \"2012-05-28\",\n \"allowed_emails\": [\n \"oerdman@example.org\"\n ],\n \"payment_method_ids\": null,\n \"uses_count_mode\": \"paid\",\n \"applies_to_renewals\": true,\n \"items\": null,\n \"disable_if_volume_discount\": false,\n \"disable_if_quantity_deal\": true,\n \"disable_if_bundle_offer\": true,\n \"disable_if_gateway_discount\": false,\n \"disable_if_affiliate_discount\": false,\n \"disable_if_reseller_discount\": 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.sellauth.com/v1/shops/{shopId}/coupons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"consequatur\",\n \"global\": true,\n \"discount\": 15,\n \"type\": \"percentage\",\n \"max_uses\": 25,\n \"max_uses_per_customer\": 19,\n \"min_invoice_price\": 14,\n \"start_date\": \"2012-05-28\",\n \"expiration_date\": \"2012-05-28\",\n \"allowed_emails\": [\n \"oerdman@example.org\"\n ],\n \"payment_method_ids\": null,\n \"uses_count_mode\": \"paid\",\n \"applies_to_renewals\": true,\n \"items\": null,\n \"disable_if_volume_discount\": false,\n \"disable_if_quantity_deal\": true,\n \"disable_if_bundle_offer\": true,\n \"disable_if_gateway_discount\": false,\n \"disable_if_affiliate_discount\": false,\n \"disable_if_reseller_discount\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sellauth.com/v1/shops/{shopId}/coupons")
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\": \"consequatur\",\n \"global\": true,\n \"discount\": 15,\n \"type\": \"percentage\",\n \"max_uses\": 25,\n \"max_uses_per_customer\": 19,\n \"min_invoice_price\": 14,\n \"start_date\": \"2012-05-28\",\n \"expiration_date\": \"2012-05-28\",\n \"allowed_emails\": [\n \"oerdman@example.org\"\n ],\n \"payment_method_ids\": null,\n \"uses_count_mode\": \"paid\",\n \"applies_to_renewals\": true,\n \"items\": null,\n \"disable_if_volume_discount\": false,\n \"disable_if_quantity_deal\": true,\n \"disable_if_bundle_offer\": true,\n \"disable_if_gateway_discount\": false,\n \"disable_if_affiliate_discount\": false,\n \"disable_if_reseller_discount\": false\n}"
response = http.request(request)
puts response.read_bodyCoupons
Create Coupon
Creates a new coupon.
POST
/
v1
/
shops
/
{shopId}
/
coupons
Create Coupon
curl --request POST \
--url https://api.sellauth.com/v1/shops/{shopId}/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "consequatur",
"global": true,
"discount": 15,
"type": "percentage",
"max_uses": 25,
"max_uses_per_customer": 19,
"min_invoice_price": 14,
"start_date": "2012-05-28",
"expiration_date": "2012-05-28",
"allowed_emails": [
"oerdman@example.org"
],
"payment_method_ids": null,
"uses_count_mode": "paid",
"applies_to_renewals": true,
"items": null,
"disable_if_volume_discount": false,
"disable_if_quantity_deal": true,
"disable_if_bundle_offer": true,
"disable_if_gateway_discount": false,
"disable_if_affiliate_discount": false,
"disable_if_reseller_discount": false
}
'import requests
url = "https://api.sellauth.com/v1/shops/{shopId}/coupons"
payload = {
"code": "consequatur",
"global": True,
"discount": 15,
"type": "percentage",
"max_uses": 25,
"max_uses_per_customer": 19,
"min_invoice_price": 14,
"start_date": "2012-05-28",
"expiration_date": "2012-05-28",
"allowed_emails": ["oerdman@example.org"],
"payment_method_ids": None,
"uses_count_mode": "paid",
"applies_to_renewals": True,
"items": None,
"disable_if_volume_discount": False,
"disable_if_quantity_deal": True,
"disable_if_bundle_offer": True,
"disable_if_gateway_discount": False,
"disable_if_affiliate_discount": False,
"disable_if_reseller_discount": 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: 'consequatur',
global: true,
discount: 15,
type: 'percentage',
max_uses: 25,
max_uses_per_customer: 19,
min_invoice_price: 14,
start_date: '2012-05-28',
expiration_date: '2012-05-28',
allowed_emails: ['oerdman@example.org'],
payment_method_ids: null,
uses_count_mode: 'paid',
applies_to_renewals: true,
items: null,
disable_if_volume_discount: false,
disable_if_quantity_deal: true,
disable_if_bundle_offer: true,
disable_if_gateway_discount: false,
disable_if_affiliate_discount: false,
disable_if_reseller_discount: false
})
};
fetch('https://api.sellauth.com/v1/shops/{shopId}/coupons', 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.sellauth.com/v1/shops/{shopId}/coupons",
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' => 'consequatur',
'global' => true,
'discount' => 15,
'type' => 'percentage',
'max_uses' => 25,
'max_uses_per_customer' => 19,
'min_invoice_price' => 14,
'start_date' => '2012-05-28',
'expiration_date' => '2012-05-28',
'allowed_emails' => [
'oerdman@example.org'
],
'payment_method_ids' => null,
'uses_count_mode' => 'paid',
'applies_to_renewals' => true,
'items' => null,
'disable_if_volume_discount' => false,
'disable_if_quantity_deal' => true,
'disable_if_bundle_offer' => true,
'disable_if_gateway_discount' => false,
'disable_if_affiliate_discount' => false,
'disable_if_reseller_discount' => 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.sellauth.com/v1/shops/{shopId}/coupons"
payload := strings.NewReader("{\n \"code\": \"consequatur\",\n \"global\": true,\n \"discount\": 15,\n \"type\": \"percentage\",\n \"max_uses\": 25,\n \"max_uses_per_customer\": 19,\n \"min_invoice_price\": 14,\n \"start_date\": \"2012-05-28\",\n \"expiration_date\": \"2012-05-28\",\n \"allowed_emails\": [\n \"oerdman@example.org\"\n ],\n \"payment_method_ids\": null,\n \"uses_count_mode\": \"paid\",\n \"applies_to_renewals\": true,\n \"items\": null,\n \"disable_if_volume_discount\": false,\n \"disable_if_quantity_deal\": true,\n \"disable_if_bundle_offer\": true,\n \"disable_if_gateway_discount\": false,\n \"disable_if_affiliate_discount\": false,\n \"disable_if_reseller_discount\": 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.sellauth.com/v1/shops/{shopId}/coupons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"consequatur\",\n \"global\": true,\n \"discount\": 15,\n \"type\": \"percentage\",\n \"max_uses\": 25,\n \"max_uses_per_customer\": 19,\n \"min_invoice_price\": 14,\n \"start_date\": \"2012-05-28\",\n \"expiration_date\": \"2012-05-28\",\n \"allowed_emails\": [\n \"oerdman@example.org\"\n ],\n \"payment_method_ids\": null,\n \"uses_count_mode\": \"paid\",\n \"applies_to_renewals\": true,\n \"items\": null,\n \"disable_if_volume_discount\": false,\n \"disable_if_quantity_deal\": true,\n \"disable_if_bundle_offer\": true,\n \"disable_if_gateway_discount\": false,\n \"disable_if_affiliate_discount\": false,\n \"disable_if_reseller_discount\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sellauth.com/v1/shops/{shopId}/coupons")
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\": \"consequatur\",\n \"global\": true,\n \"discount\": 15,\n \"type\": \"percentage\",\n \"max_uses\": 25,\n \"max_uses_per_customer\": 19,\n \"min_invoice_price\": 14,\n \"start_date\": \"2012-05-28\",\n \"expiration_date\": \"2012-05-28\",\n \"allowed_emails\": [\n \"oerdman@example.org\"\n ],\n \"payment_method_ids\": null,\n \"uses_count_mode\": \"paid\",\n \"applies_to_renewals\": true,\n \"items\": null,\n \"disable_if_volume_discount\": false,\n \"disable_if_quantity_deal\": true,\n \"disable_if_bundle_offer\": true,\n \"disable_if_gateway_discount\": false,\n \"disable_if_affiliate_discount\": false,\n \"disable_if_reseller_discount\": false\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
You can retrieve your API key from your dashboard under Account > Developers.
Body
application/json
Response
200