curl --request POST \
--url https://go.affixo.dev/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_id": "plan_pro",
"name": "Pro plan"
}
'import requests
url = "https://go.affixo.dev/v1/products"
payload = {
"product_id": "plan_pro",
"name": "Pro plan"
}
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({product_id: 'plan_pro', name: 'Pro plan'})
};
fetch('https://go.affixo.dev/v1/products', 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://go.affixo.dev/v1/products",
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([
'product_id' => 'plan_pro',
'name' => 'Pro plan'
]),
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://go.affixo.dev/v1/products"
payload := strings.NewReader("{\n \"product_id\": \"plan_pro\",\n \"name\": \"Pro plan\"\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://go.affixo.dev/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_id\": \"plan_pro\",\n \"name\": \"Pro plan\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.affixo.dev/v1/products")
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 \"product_id\": \"plan_pro\",\n \"name\": \"Pro plan\"\n}"
response = http.request(request)
puts response.read_body{
"object": "product",
"data": {}
}{
"error": "invalid_product_id"
}{
"error": "unauthorized"
}{
"error": "plan_restricted"
}{
"error": "insufficient_scope",
"need": "write"
}{
"error": "product_exists"
}{
"error": "policy_unavailable"
}Register a product by your own id
For workspaces that don’t use Stripe. Registers a product under the id your own system uses, so you can give it its own commission rate or switch commissions off for it. Requires write scope. A workspace whose plan is restricted gets 402 plan_restricted. Registering a product doesn’t change what it earns, or what its past sales earned: it starts with the same setting as your other uncatalogued products (on when the products policy is on, off when it’s off). Turn it on or off, or give it its own rate, to change that. Registering never happens automatically: a sale with an unknown product_id earns the campaign’s default rate, or nothing if the products policy is off, until you register it. Stripe workspaces get 409 stripe_connected because their products sync from Stripe.
curl --request POST \
--url https://go.affixo.dev/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_id": "plan_pro",
"name": "Pro plan"
}
'import requests
url = "https://go.affixo.dev/v1/products"
payload = {
"product_id": "plan_pro",
"name": "Pro plan"
}
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({product_id: 'plan_pro', name: 'Pro plan'})
};
fetch('https://go.affixo.dev/v1/products', 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://go.affixo.dev/v1/products",
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([
'product_id' => 'plan_pro',
'name' => 'Pro plan'
]),
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://go.affixo.dev/v1/products"
payload := strings.NewReader("{\n \"product_id\": \"plan_pro\",\n \"name\": \"Pro plan\"\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://go.affixo.dev/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_id\": \"plan_pro\",\n \"name\": \"Pro plan\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.affixo.dev/v1/products")
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 \"product_id\": \"plan_pro\",\n \"name\": \"Pro plan\"\n}"
response = http.request(request)
puts response.read_body{
"object": "product",
"data": {}
}{
"error": "invalid_product_id"
}{
"error": "unauthorized"
}{
"error": "plan_restricted"
}{
"error": "insufficient_scope",
"need": "write"
}{
"error": "product_exists"
}{
"error": "policy_unavailable"
}Authorizations
Workspace API key, e.g. sa_live_…. Scopes: read / write / track / *.