curl --request PUT \
--url https://go.affixo.dev/v1/campaigns/{id}/commission-rule \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"library_reward_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "percent",
"reward_type": "cash",
"unit": "credits",
"duration": "lifetime",
"length_months": 2,
"product_ids": [
"<string>"
]
}
'import requests
url = "https://go.affixo.dev/v1/campaigns/{id}/commission-rule"
payload = {
"amount": 123,
"library_reward_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "percent",
"reward_type": "cash",
"unit": "credits",
"duration": "lifetime",
"length_months": 2,
"product_ids": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
library_reward_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
type: 'percent',
reward_type: 'cash',
unit: 'credits',
duration: 'lifetime',
length_months: 2,
product_ids: ['<string>']
})
};
fetch('https://go.affixo.dev/v1/campaigns/{id}/commission-rule', 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/campaigns/{id}/commission-rule",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'library_reward_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'type' => 'percent',
'reward_type' => 'cash',
'unit' => 'credits',
'duration' => 'lifetime',
'length_months' => 2,
'product_ids' => [
'<string>'
]
]),
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/campaigns/{id}/commission-rule"
payload := strings.NewReader("{\n \"amount\": 123,\n \"library_reward_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"percent\",\n \"reward_type\": \"cash\",\n \"unit\": \"credits\",\n \"duration\": \"lifetime\",\n \"length_months\": 2,\n \"product_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://go.affixo.dev/v1/campaigns/{id}/commission-rule")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"library_reward_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"percent\",\n \"reward_type\": \"cash\",\n \"unit\": \"credits\",\n \"duration\": \"lifetime\",\n \"length_months\": 2,\n \"product_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.affixo.dev/v1/campaigns/{id}/commission-rule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"library_reward_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"percent\",\n \"reward_type\": \"cash\",\n \"unit\": \"credits\",\n \"duration\": \"lifetime\",\n \"length_months\": 2,\n \"product_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "commission_rule",
"campaign": "<string>",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Default commission",
"kind": "monetary",
"amount": 123,
"is_flat": true,
"length_type": "lifetime",
"length_months": 123,
"applies_to_interval": "one_time",
"product_ids": [
"<string>"
]
}
}{
"object": "commission_rule",
"campaign": "<string>",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Default commission",
"kind": "monetary",
"amount": 123,
"is_flat": true,
"length_type": "lifetime",
"length_months": 123,
"applies_to_interval": "one_time",
"product_ids": [
"<string>"
]
}
}{
"error": "invalid_json"
}{
"error": "unauthorized"
}{
"error": "insufficient_scope",
"need": "write"
}{
"error": "link_not_found"
}Set a campaign's commission rule
A campaign carries multiple rules. With no scope this creates/updates the
campaign’s catch-all rule; product_ids scopes the rule to those
Stripe products; billing_interval scopes it to a billing cadence (one
scope type per rule). Conversion-time precedence: product → interval →
catch-all → nothing.
amount is a percentage (0–100) unless type is flat. duration
controls recurrence: lifetime pays every renewal, first_order pays
only the first payment, capped pays for length_months periods.
Set reward_type to non_cash (with a unit, e.g. credits) to pay a
non-cash reward — credits / points / free months delivered via the
fulfilment webhook, never cash — at any scope; amount is then the
count of units and type is ignored. Requires write (or *) scope.
Configuration only — never moves money.
curl --request PUT \
--url https://go.affixo.dev/v1/campaigns/{id}/commission-rule \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"library_reward_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "percent",
"reward_type": "cash",
"unit": "credits",
"duration": "lifetime",
"length_months": 2,
"product_ids": [
"<string>"
]
}
'import requests
url = "https://go.affixo.dev/v1/campaigns/{id}/commission-rule"
payload = {
"amount": 123,
"library_reward_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "percent",
"reward_type": "cash",
"unit": "credits",
"duration": "lifetime",
"length_months": 2,
"product_ids": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
library_reward_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
type: 'percent',
reward_type: 'cash',
unit: 'credits',
duration: 'lifetime',
length_months: 2,
product_ids: ['<string>']
})
};
fetch('https://go.affixo.dev/v1/campaigns/{id}/commission-rule', 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/campaigns/{id}/commission-rule",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'library_reward_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'type' => 'percent',
'reward_type' => 'cash',
'unit' => 'credits',
'duration' => 'lifetime',
'length_months' => 2,
'product_ids' => [
'<string>'
]
]),
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/campaigns/{id}/commission-rule"
payload := strings.NewReader("{\n \"amount\": 123,\n \"library_reward_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"percent\",\n \"reward_type\": \"cash\",\n \"unit\": \"credits\",\n \"duration\": \"lifetime\",\n \"length_months\": 2,\n \"product_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://go.affixo.dev/v1/campaigns/{id}/commission-rule")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"library_reward_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"percent\",\n \"reward_type\": \"cash\",\n \"unit\": \"credits\",\n \"duration\": \"lifetime\",\n \"length_months\": 2,\n \"product_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.affixo.dev/v1/campaigns/{id}/commission-rule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"library_reward_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"percent\",\n \"reward_type\": \"cash\",\n \"unit\": \"credits\",\n \"duration\": \"lifetime\",\n \"length_months\": 2,\n \"product_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "commission_rule",
"campaign": "<string>",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Default commission",
"kind": "monetary",
"amount": 123,
"is_flat": true,
"length_type": "lifetime",
"length_months": 123,
"applies_to_interval": "one_time",
"product_ids": [
"<string>"
]
}
}{
"object": "commission_rule",
"campaign": "<string>",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Default commission",
"kind": "monetary",
"amount": 123,
"is_flat": true,
"length_type": "lifetime",
"length_months": 123,
"applies_to_interval": "one_time",
"product_ids": [
"<string>"
]
}
}{
"error": "invalid_json"
}{
"error": "unauthorized"
}{
"error": "insufficient_scope",
"need": "write"
}{
"error": "link_not_found"
}Authorizations
Workspace API key, e.g. sa_live_…. Scopes: read / write / track / *.
Path Parameters
Body
Percentage (0–100), a flat amount when type=flat, or the count of units when reward_type=non_cash. Required unless library_reward_id is passed.
Author the rate FROM a reusable library reward (GET /v1/rewards) instead of inline values — copies the template's terms onto the campaign (copy-on-assign).
Ignored for non-cash rewards.
percent, flat cash = a monetary commission; non_cash pays credits / points / free months via the fulfilment webhook.
cash, non_cash Non-cash unit label (e.g. credits, points, free months). Required when reward_type=non_cash.
"credits"
lifetime, first_order, capped Required when duration is capped.
x >= 1Stripe product ids (prod_…) or Affixo product uuids to scope this rule to. Mutually exclusive with billing_interval; omit for the catch-all.
Scope the rule to a billing cadence. Mutually exclusive with product_ids.
one_time, month, year