POST /api/track/sale
Record a successful sale. Creates a pending commission for the attributed partner.
Endpoint
POST https://partli.app/api/track/saleHeaders
Authorization: Bearer pk_live_...
Content-Type: application/jsonBody
{
"externalId": "inv_abc123", // required, dedupe key (your invoice/order id)
"customerExternalId": "cus_xyz", // required, your customer id
"amountCents": 4900, // required, sale amount in cents
"currency": "USD", // optional, default "USD"
"clickId": "c_aB3xY9ZqLp", // optional, required for attribution
"eventName": "subscription_paid", // optional, default "sale"
"metadata": { "plan": "starter" } // optional, free-form jsonb
}Response
{
"eventId": "uuid-of-event", // null if not attributed
"attributed": true
}Reward resolution
- If partner is in a group with a sale reward → use the group reward
- Otherwise → fall back to the program's default reward
- For one-time interval: skip if a prior commission exists for this customer
- For recurring: skip if past
rewardDurationMonths
cURL example
curl https://partli.app/api/track/sale \
-X POST \
-H "Authorization: Bearer pk_live_..." \
-H "Content-Type: application/json" \
-d '{
"externalId": "inv_abc123",
"customerExternalId": "cus_xyz",
"amountCents": 4900,
"clickId": "c_aB3xY9ZqLp"
}'Errors
401 Unauthorized— bad API key400 Bad Request— invalid body or amountCents < 1
Re-posting the same externalId is a silent no-op (returns the original event id) — safe to retry.