Create Promotion Code
curl --request POST \
--url https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"coupon": "rgJkxQB4",
"code": "SUMMER20",
"customer": "cus_TppcYxuTJKLNnG",
"max_redemptions": 10,
"expires_at": 1770137940,
"restrictions": {
"first_time_transaction": true,
"minimum_amount": 1000,
"minimum_amount_currency": "usd"
}
}
}
'import requests
url = "https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes"
payload = { "data": {
"coupon": "rgJkxQB4",
"code": "SUMMER20",
"customer": "cus_TppcYxuTJKLNnG",
"max_redemptions": 10,
"expires_at": 1770137940,
"restrictions": {
"first_time_transaction": True,
"minimum_amount": 1000,
"minimum_amount_currency": "usd"
}
} }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
coupon: 'rgJkxQB4',
code: 'SUMMER20',
customer: 'cus_TppcYxuTJKLNnG',
max_redemptions: 10,
expires_at: 1770137940,
restrictions: {
first_time_transaction: true,
minimum_amount: 1000,
minimum_amount_currency: 'usd'
}
}
})
};
fetch('https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/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.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/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([
'data' => [
'coupon' => 'rgJkxQB4',
'code' => 'SUMMER20',
'customer' => 'cus_TppcYxuTJKLNnG',
'max_redemptions' => 10,
'expires_at' => 1770137940,
'restrictions' => [
'first_time_transaction' => true,
'minimum_amount' => 1000,
'minimum_amount_currency' => 'usd'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes"
payload := strings.NewReader("{\n \"data\": {\n \"coupon\": \"rgJkxQB4\",\n \"code\": \"SUMMER20\",\n \"customer\": \"cus_TppcYxuTJKLNnG\",\n \"max_redemptions\": 10,\n \"expires_at\": 1770137940,\n \"restrictions\": {\n \"first_time_transaction\": true,\n \"minimum_amount\": 1000,\n \"minimum_amount_currency\": \"usd\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"coupon\": \"rgJkxQB4\",\n \"code\": \"SUMMER20\",\n \"customer\": \"cus_TppcYxuTJKLNnG\",\n \"max_redemptions\": 10,\n \"expires_at\": 1770137940,\n \"restrictions\": {\n \"first_time_transaction\": true,\n \"minimum_amount\": 1000,\n \"minimum_amount_currency\": \"usd\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"coupon\": \"rgJkxQB4\",\n \"code\": \"SUMMER20\",\n \"customer\": \"cus_TppcYxuTJKLNnG\",\n \"max_redemptions\": 10,\n \"expires_at\": 1770137940,\n \"restrictions\": {\n \"first_time_transaction\": true,\n \"minimum_amount\": 1000,\n \"minimum_amount_currency\": \"usd\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "promo_1SucFwRjNw7C4HMK01fsfjOh",
"object": "promotion_code",
"active": true,
"code": "SUMMER20",
"coupon": {
"id": "rgJkxQB4",
"object": "coupon",
"amount_off": null,
"created": 1751915454,
"currency": "usd",
"duration": "repeating",
"duration_in_months": 3,
"livemode": true,
"max_redemptions": null,
"metadata": {},
"name": "3Months Off",
"percent_off": 10,
"redeem_by": null,
"times_redeemed": 6,
"valid": true
},
"created": 1769620216,
"customer": "cus_TppcYxuTJKLNnG",
"customer_account": null,
"expires_at": 1770137940,
"livemode": true,
"max_redemptions": 10,
"metadata": {},
"restrictions": {
"first_time_transaction": true,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": 0
}{
"error": "Missing required field: coupon"
}{
"error": "An unexpected error occurred"
}Promotion Codes
Create Promotion Code
Create a promotion code for a connected account.
POST
/
stripe
/
connect
/
accounts
/
{accountId}
/
promotion-codes
Create Promotion Code
curl --request POST \
--url https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"coupon": "rgJkxQB4",
"code": "SUMMER20",
"customer": "cus_TppcYxuTJKLNnG",
"max_redemptions": 10,
"expires_at": 1770137940,
"restrictions": {
"first_time_transaction": true,
"minimum_amount": 1000,
"minimum_amount_currency": "usd"
}
}
}
'import requests
url = "https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes"
payload = { "data": {
"coupon": "rgJkxQB4",
"code": "SUMMER20",
"customer": "cus_TppcYxuTJKLNnG",
"max_redemptions": 10,
"expires_at": 1770137940,
"restrictions": {
"first_time_transaction": True,
"minimum_amount": 1000,
"minimum_amount_currency": "usd"
}
} }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
coupon: 'rgJkxQB4',
code: 'SUMMER20',
customer: 'cus_TppcYxuTJKLNnG',
max_redemptions: 10,
expires_at: 1770137940,
restrictions: {
first_time_transaction: true,
minimum_amount: 1000,
minimum_amount_currency: 'usd'
}
}
})
};
fetch('https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/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.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/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([
'data' => [
'coupon' => 'rgJkxQB4',
'code' => 'SUMMER20',
'customer' => 'cus_TppcYxuTJKLNnG',
'max_redemptions' => 10,
'expires_at' => 1770137940,
'restrictions' => [
'first_time_transaction' => true,
'minimum_amount' => 1000,
'minimum_amount_currency' => 'usd'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes"
payload := strings.NewReader("{\n \"data\": {\n \"coupon\": \"rgJkxQB4\",\n \"code\": \"SUMMER20\",\n \"customer\": \"cus_TppcYxuTJKLNnG\",\n \"max_redemptions\": 10,\n \"expires_at\": 1770137940,\n \"restrictions\": {\n \"first_time_transaction\": true,\n \"minimum_amount\": 1000,\n \"minimum_amount_currency\": \"usd\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"coupon\": \"rgJkxQB4\",\n \"code\": \"SUMMER20\",\n \"customer\": \"cus_TppcYxuTJKLNnG\",\n \"max_redemptions\": 10,\n \"expires_at\": 1770137940,\n \"restrictions\": {\n \"first_time_transaction\": true,\n \"minimum_amount\": 1000,\n \"minimum_amount_currency\": \"usd\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/promotion-codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"coupon\": \"rgJkxQB4\",\n \"code\": \"SUMMER20\",\n \"customer\": \"cus_TppcYxuTJKLNnG\",\n \"max_redemptions\": 10,\n \"expires_at\": 1770137940,\n \"restrictions\": {\n \"first_time_transaction\": true,\n \"minimum_amount\": 1000,\n \"minimum_amount_currency\": \"usd\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "promo_1SucFwRjNw7C4HMK01fsfjOh",
"object": "promotion_code",
"active": true,
"code": "SUMMER20",
"coupon": {
"id": "rgJkxQB4",
"object": "coupon",
"amount_off": null,
"created": 1751915454,
"currency": "usd",
"duration": "repeating",
"duration_in_months": 3,
"livemode": true,
"max_redemptions": null,
"metadata": {},
"name": "3Months Off",
"percent_off": 10,
"redeem_by": null,
"times_redeemed": 6,
"valid": true
},
"created": 1769620216,
"customer": "cus_TppcYxuTJKLNnG",
"customer_account": null,
"expires_at": 1770137940,
"livemode": true,
"max_redemptions": 10,
"metadata": {},
"restrictions": {
"first_time_transaction": true,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": 0
}{
"error": "Missing required field: coupon"
}{
"error": "An unexpected error occurred"
}Headers
All requests to the ChatDash API must be validated with the agency API Key found on your agency profile
Path Parameters
The Stripe connected account ID
Body
application/json
Show child attributes
Show child attributes
Response
Created
Unique identifier for the promotion code
Example:
"promo_1SucFwRjNw7C4HMK01fsfjOh"
Object type
Example:
"promotion_code"
Whether the promotion code is active
Example:
true
The customer-facing code
Example:
"SUMMER20"
The coupon associated with this promotion code
Show child attributes
Show child attributes
Unix timestamp of when the promotion code was created
Example:
1769620216
The customer that this promotion code can be used by
Example:
"cus_TppcYxuTJKLNnG"
Example:
null
Unix timestamp of when the promotion code expires
Example:
1770137940
Example:
true
Example:
10
Example:
{}
Show child attributes
Show child attributes
Example:
0
⌘I
