curl --request POST \
--url https://go.affixo.dev/v1/track/sale \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"visitor_id": "<string>",
"fingerprint": "<string>",
"ref": "<string>",
"manual_code": "<string>",
"external_id": "<string>",
"subscription_id": "<string>",
"customer_id": "<string>",
"currency": "usd",
"is_test": false,
"url": "<string>",
"referrer": "<string>",
"email": "jsmith@example.com",
"name": "<string>",
"amount": 99,
"amount_cents": 9900,
"product_id": "<string>",
"product_name": "<string>"
}
'import requests
url = "https://go.affixo.dev/v1/track/sale"
payload = {
"visitor_id": "<string>",
"fingerprint": "<string>",
"ref": "<string>",
"manual_code": "<string>",
"external_id": "<string>",
"subscription_id": "<string>",
"customer_id": "<string>",
"currency": "usd",
"is_test": False,
"url": "<string>",
"referrer": "<string>",
"email": "jsmith@example.com",
"name": "<string>",
"amount": 99,
"amount_cents": 9900,
"product_id": "<string>",
"product_name": "<string>"
}
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({
visitor_id: '<string>',
fingerprint: '<string>',
ref: '<string>',
manual_code: '<string>',
external_id: '<string>',
subscription_id: '<string>',
customer_id: '<string>',
currency: 'usd',
is_test: false,
url: '<string>',
referrer: '<string>',
email: 'jsmith@example.com',
name: '<string>',
amount: 99,
amount_cents: 9900,
product_id: '<string>',
product_name: '<string>'
})
};
fetch('https://go.affixo.dev/v1/track/sale', 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/track/sale",
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([
'visitor_id' => '<string>',
'fingerprint' => '<string>',
'ref' => '<string>',
'manual_code' => '<string>',
'external_id' => '<string>',
'subscription_id' => '<string>',
'customer_id' => '<string>',
'currency' => 'usd',
'is_test' => false,
'url' => '<string>',
'referrer' => '<string>',
'email' => 'jsmith@example.com',
'name' => '<string>',
'amount' => 99,
'amount_cents' => 9900,
'product_id' => '<string>',
'product_name' => '<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/track/sale"
payload := strings.NewReader("{\n \"visitor_id\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"ref\": \"<string>\",\n \"manual_code\": \"<string>\",\n \"external_id\": \"<string>\",\n \"subscription_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"currency\": \"usd\",\n \"is_test\": false,\n \"url\": \"<string>\",\n \"referrer\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"amount\": 99,\n \"amount_cents\": 9900,\n \"product_id\": \"<string>\",\n \"product_name\": \"<string>\"\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/track/sale")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"visitor_id\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"ref\": \"<string>\",\n \"manual_code\": \"<string>\",\n \"external_id\": \"<string>\",\n \"subscription_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"currency\": \"usd\",\n \"is_test\": false,\n \"url\": \"<string>\",\n \"referrer\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"amount\": 99,\n \"amount_cents\": 9900,\n \"product_id\": \"<string>\",\n \"product_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.affixo.dev/v1/track/sale")
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 \"visitor_id\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"ref\": \"<string>\",\n \"manual_code\": \"<string>\",\n \"external_id\": \"<string>\",\n \"subscription_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"currency\": \"usd\",\n \"is_test\": false,\n \"url\": \"<string>\",\n \"referrer\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"amount\": 99,\n \"amount_cents\": 9900,\n \"product_id\": \"<string>\",\n \"product_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"attributed": true,
"conversion_id": "<string>",
"visitor_id": "<string>",
"warning": "external_id_missing"
}{
"error": "external_id_required"
}{
"error": "unauthorized"
}{
"error": "conversion_failed"
}Track a sale
Server-to-server sale conversion, for merchants who take payment
outside Stripe. Requires track (or *) scope. MCP connector tokens
get 403 insufficient_scope.
Send external_id (your order or payment id) with every sale. It
makes the call safe to retry, and it is required whenever you also
send product_id, subscription_id, customer_id,
billing_interval or amount_cents (400 external_id_required). A
sale without it still works but the response carries warning: "external_id_missing". That form is deprecated, because a retry can
book the sale twice.
Send the amount as amount_cents (whole minor units, such as cents).
It is converted using the currency’s own decimals, so 0 for JPY and 3
for KWD. amount in major units still works. Sending both gives
400 amount_conflict, and a negative or non-numeric value gives 400 invalid_amount.
Renewals that carry the same subscription_id, and repeat purchases
with the same customer_id, go to the affiliate who referred the
first payment. The order follows your workspace’s attribution
settings, with email as a fallback for 365 days, the same as Stripe.
Test (is_test) and live ids never match each other.
A product_id Affixo hasn’t seen earns the campaign’s default rate,
or nothing if the products policy is off, until you register the
product with POST /v1/products. Registering doesn’t change what it
earns, or what its past sales earned: it starts with the same setting
as your other uncatalogued products. Turn it on or off, or give it its
own rate, to change that.
One processor per account: a workspace uses Stripe or this API for sales, never both. Stripe merchants should use the native integration.
curl --request POST \
--url https://go.affixo.dev/v1/track/sale \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"visitor_id": "<string>",
"fingerprint": "<string>",
"ref": "<string>",
"manual_code": "<string>",
"external_id": "<string>",
"subscription_id": "<string>",
"customer_id": "<string>",
"currency": "usd",
"is_test": false,
"url": "<string>",
"referrer": "<string>",
"email": "jsmith@example.com",
"name": "<string>",
"amount": 99,
"amount_cents": 9900,
"product_id": "<string>",
"product_name": "<string>"
}
'import requests
url = "https://go.affixo.dev/v1/track/sale"
payload = {
"visitor_id": "<string>",
"fingerprint": "<string>",
"ref": "<string>",
"manual_code": "<string>",
"external_id": "<string>",
"subscription_id": "<string>",
"customer_id": "<string>",
"currency": "usd",
"is_test": False,
"url": "<string>",
"referrer": "<string>",
"email": "jsmith@example.com",
"name": "<string>",
"amount": 99,
"amount_cents": 9900,
"product_id": "<string>",
"product_name": "<string>"
}
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({
visitor_id: '<string>',
fingerprint: '<string>',
ref: '<string>',
manual_code: '<string>',
external_id: '<string>',
subscription_id: '<string>',
customer_id: '<string>',
currency: 'usd',
is_test: false,
url: '<string>',
referrer: '<string>',
email: 'jsmith@example.com',
name: '<string>',
amount: 99,
amount_cents: 9900,
product_id: '<string>',
product_name: '<string>'
})
};
fetch('https://go.affixo.dev/v1/track/sale', 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/track/sale",
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([
'visitor_id' => '<string>',
'fingerprint' => '<string>',
'ref' => '<string>',
'manual_code' => '<string>',
'external_id' => '<string>',
'subscription_id' => '<string>',
'customer_id' => '<string>',
'currency' => 'usd',
'is_test' => false,
'url' => '<string>',
'referrer' => '<string>',
'email' => 'jsmith@example.com',
'name' => '<string>',
'amount' => 99,
'amount_cents' => 9900,
'product_id' => '<string>',
'product_name' => '<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/track/sale"
payload := strings.NewReader("{\n \"visitor_id\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"ref\": \"<string>\",\n \"manual_code\": \"<string>\",\n \"external_id\": \"<string>\",\n \"subscription_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"currency\": \"usd\",\n \"is_test\": false,\n \"url\": \"<string>\",\n \"referrer\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"amount\": 99,\n \"amount_cents\": 9900,\n \"product_id\": \"<string>\",\n \"product_name\": \"<string>\"\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/track/sale")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"visitor_id\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"ref\": \"<string>\",\n \"manual_code\": \"<string>\",\n \"external_id\": \"<string>\",\n \"subscription_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"currency\": \"usd\",\n \"is_test\": false,\n \"url\": \"<string>\",\n \"referrer\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"amount\": 99,\n \"amount_cents\": 9900,\n \"product_id\": \"<string>\",\n \"product_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.affixo.dev/v1/track/sale")
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 \"visitor_id\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"ref\": \"<string>\",\n \"manual_code\": \"<string>\",\n \"external_id\": \"<string>\",\n \"subscription_id\": \"<string>\",\n \"customer_id\": \"<string>\",\n \"currency\": \"usd\",\n \"is_test\": false,\n \"url\": \"<string>\",\n \"referrer\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"name\": \"<string>\",\n \"amount\": 99,\n \"amount_cents\": 9900,\n \"product_id\": \"<string>\",\n \"product_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"attributed": true,
"conversion_id": "<string>",
"visitor_id": "<string>",
"warning": "external_id_missing"
}{
"error": "external_id_required"
}{
"error": "unauthorized"
}{
"error": "conversion_failed"
}Authorizations
Body
Visitor identity plus optional attribution hints. Provide at least one of
visitor_id, fingerprint, ref, or manual_code so the event can be
attributed.