Overview
Use server-side conversions when your billing system or backend already knows that a purchase happened and you want Affonso to:- resolve the correct referral
- match the correct incentive rule
- calculate the commission automatically
- enforce idempotency on retries
- emit the standard
transaction.createdwebhook event
When to Use /conversions vs /commissions
Use POST /conversions when:
- you want Affonso to calculate the commission for you
- you have a billing event, order, invoice, or checkout completion on your server
- you want retry-safe idempotency with
external_event_id
POST /commissions when:
- you already know the exact commission amount
- you are importing historical payouts or backfilling data
- you need a manual override rather than incentive-based calculation
What You Need to Send
Every conversion needs:sale_amountexternal_event_id- at least one identifier:
referral_id,customer_id,external_user_id, orclick_id
product_idsprice_idsintervalis_subscriptionmetadata
Idempotency and Retries
external_event_id is the provider-side idempotency key for the conversion.
Use a stable unique identifier from your system, such as:
- order ID
- invoice ID
- checkout session ID
- payment event ID
external_event_id
again. Affonso will return the existing conversion instead of creating a new
one.
Choosing the Identifier
Use the identifier you can trust most in your integration:customer_id: best when the referral is already linked to your internal customer recordexternal_user_id: useful when you sync your application user ID into Affonsoclick_id: best when converting a specific tracked click into a purchasereferral_id: best when you already know the exact referral record to credit
What Affonso Creates
On a successful conversion, Affonso always records the underlying transaction. If the matched incentive is eligible, Affonso also creates the affiliate earning automatically. If no incentive matches, or if the commission is fully capped, the conversion can still succeed withcommission_amount: 0.
Example
Next Steps
Conversions API Reference
Full request and response field reference for POST /conversions
Manual Commissions
Use the manual endpoint when you need to set the commission amount yourself
