Create Subscription
curl --request POST \
--url https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/subscriptions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"clientId": "64abc123def456789012345a",
"agentIds": [
"64abc123def456789012345b"
],
"selectedProduct": {
"productId": "prod_ABC123XYZ",
"startDate": 1700000000,
"pricing": {
"metrics": "minutes"
}
},
"couponId": "",
"taxSettings": {
"enabled": false
}
}
}
'import requests
url = "https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/subscriptions"
payload = { "data": {
"clientId": "64abc123def456789012345a",
"agentIds": ["64abc123def456789012345b"],
"selectedProduct": {
"productId": "prod_ABC123XYZ",
"startDate": 1700000000,
"pricing": { "metrics": "minutes" }
},
"couponId": "",
"taxSettings": { "enabled": False }
} }
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: {
clientId: '64abc123def456789012345a',
agentIds: ['64abc123def456789012345b'],
selectedProduct: {
productId: 'prod_ABC123XYZ',
startDate: 1700000000,
pricing: {metrics: 'minutes'}
},
couponId: '',
taxSettings: {enabled: false}
}
})
};
fetch('https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/subscriptions', 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}/subscriptions",
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' => [
'clientId' => '64abc123def456789012345a',
'agentIds' => [
'64abc123def456789012345b'
],
'selectedProduct' => [
'productId' => 'prod_ABC123XYZ',
'startDate' => 1700000000,
'pricing' => [
'metrics' => 'minutes'
]
],
'couponId' => '',
'taxSettings' => [
'enabled' => false
]
]
]),
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}/subscriptions"
payload := strings.NewReader("{\n \"data\": {\n \"clientId\": \"64abc123def456789012345a\",\n \"agentIds\": [\n \"64abc123def456789012345b\"\n ],\n \"selectedProduct\": {\n \"productId\": \"prod_ABC123XYZ\",\n \"startDate\": 1700000000,\n \"pricing\": {\n \"metrics\": \"minutes\"\n }\n },\n \"couponId\": \"\",\n \"taxSettings\": {\n \"enabled\": false\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}/subscriptions")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"clientId\": \"64abc123def456789012345a\",\n \"agentIds\": [\n \"64abc123def456789012345b\"\n ],\n \"selectedProduct\": {\n \"productId\": \"prod_ABC123XYZ\",\n \"startDate\": 1700000000,\n \"pricing\": {\n \"metrics\": \"minutes\"\n }\n },\n \"couponId\": \"\",\n \"taxSettings\": {\n \"enabled\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/subscriptions")
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 \"clientId\": \"64abc123def456789012345a\",\n \"agentIds\": [\n \"64abc123def456789012345b\"\n ],\n \"selectedProduct\": {\n \"productId\": \"prod_ABC123XYZ\",\n \"startDate\": 1700000000,\n \"pricing\": {\n \"metrics\": \"minutes\"\n }\n },\n \"couponId\": \"\",\n \"taxSettings\": {\n \"enabled\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "sub_sched_1ABC123DEF456GHI",
"type": "schedule",
"status": "not_started",
"customer": {
"id": "cus_ABC123XYZ",
"email": "customer@example.com"
},
"current_period_start": 1700000000,
"current_period_end": 1702600000,
"startDate": 1700000000,
"created": 1700000000,
"collection_method": "charge_automatically",
"cancel_at_period_end": false,
"canceled_at": null,
"product": {
"id": "prod_ABC123XYZ",
"name": "Pro Plan"
},
"automatic_tax": false,
"coupon": "",
"priceIds": [
"price_ABC123",
"price_DEF456"
],
"agents": "Agent 1",
"cancelAtPeriodEndDisplay": null
}{
"error": "An unexpected error occurred"
}Subscriptions
Create Subscription
Create a subscription for a connected account.
POST
/
stripe
/
connect
/
accounts
/
{accountId}
/
subscriptions
Create Subscription
curl --request POST \
--url https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/subscriptions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"clientId": "64abc123def456789012345a",
"agentIds": [
"64abc123def456789012345b"
],
"selectedProduct": {
"productId": "prod_ABC123XYZ",
"startDate": 1700000000,
"pricing": {
"metrics": "minutes"
}
},
"couponId": "",
"taxSettings": {
"enabled": false
}
}
}
'import requests
url = "https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/subscriptions"
payload = { "data": {
"clientId": "64abc123def456789012345a",
"agentIds": ["64abc123def456789012345b"],
"selectedProduct": {
"productId": "prod_ABC123XYZ",
"startDate": 1700000000,
"pricing": { "metrics": "minutes" }
},
"couponId": "",
"taxSettings": { "enabled": False }
} }
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: {
clientId: '64abc123def456789012345a',
agentIds: ['64abc123def456789012345b'],
selectedProduct: {
productId: 'prod_ABC123XYZ',
startDate: 1700000000,
pricing: {metrics: 'minutes'}
},
couponId: '',
taxSettings: {enabled: false}
}
})
};
fetch('https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/subscriptions', 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}/subscriptions",
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' => [
'clientId' => '64abc123def456789012345a',
'agentIds' => [
'64abc123def456789012345b'
],
'selectedProduct' => [
'productId' => 'prod_ABC123XYZ',
'startDate' => 1700000000,
'pricing' => [
'metrics' => 'minutes'
]
],
'couponId' => '',
'taxSettings' => [
'enabled' => false
]
]
]),
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}/subscriptions"
payload := strings.NewReader("{\n \"data\": {\n \"clientId\": \"64abc123def456789012345a\",\n \"agentIds\": [\n \"64abc123def456789012345b\"\n ],\n \"selectedProduct\": {\n \"productId\": \"prod_ABC123XYZ\",\n \"startDate\": 1700000000,\n \"pricing\": {\n \"metrics\": \"minutes\"\n }\n },\n \"couponId\": \"\",\n \"taxSettings\": {\n \"enabled\": false\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}/subscriptions")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"clientId\": \"64abc123def456789012345a\",\n \"agentIds\": [\n \"64abc123def456789012345b\"\n ],\n \"selectedProduct\": {\n \"productId\": \"prod_ABC123XYZ\",\n \"startDate\": 1700000000,\n \"pricing\": {\n \"metrics\": \"minutes\"\n }\n },\n \"couponId\": \"\",\n \"taxSettings\": {\n \"enabled\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chat-dash.com/v1/public/stripe/connect/accounts/{accountId}/subscriptions")
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 \"clientId\": \"64abc123def456789012345a\",\n \"agentIds\": [\n \"64abc123def456789012345b\"\n ],\n \"selectedProduct\": {\n \"productId\": \"prod_ABC123XYZ\",\n \"startDate\": 1700000000,\n \"pricing\": {\n \"metrics\": \"minutes\"\n }\n },\n \"couponId\": \"\",\n \"taxSettings\": {\n \"enabled\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "sub_sched_1ABC123DEF456GHI",
"type": "schedule",
"status": "not_started",
"customer": {
"id": "cus_ABC123XYZ",
"email": "customer@example.com"
},
"current_period_start": 1700000000,
"current_period_end": 1702600000,
"startDate": 1700000000,
"created": 1700000000,
"collection_method": "charge_automatically",
"cancel_at_period_end": false,
"canceled_at": null,
"product": {
"id": "prod_ABC123XYZ",
"name": "Pro Plan"
},
"automatic_tax": false,
"coupon": "",
"priceIds": [
"price_ABC123",
"price_DEF456"
],
"agents": "Agent 1",
"cancelAtPeriodEndDisplay": null
}{
"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
OK
The subscription schedule ID
Example:
"sub_sched_1ABC123DEF456GHI"
Example:
"schedule"
Example:
"not_started"
Show child attributes
Show child attributes
Example:
1700000000
Example:
1702600000
Example:
1700000000
Example:
1700000000
Example:
"charge_automatically"
Example:
false
Example:
null
Show child attributes
Show child attributes
Example:
false
Example:
""
Example:
["price_ABC123", "price_DEF456"]
Example:
"Agent 1"
Example:
null
⌘I
