Conversions
Create Conversion
Create a server-side conversion and let Affonso calculate the commission automatically
POST
Use this endpoint for automatic server-side conversion tracking. Affonso will
resolve the referral, match the incentive, calculate the commission, and
create the earning when eligible.
Body Parameters
Referral ID to credit directly. Optional if you provide
customer_id,
external_user_id, or click_id.Your internal customer identifier. Optional if you provide
referral_id,
external_user_id, or click_id.Your external application user ID. Optional if you provide
referral_id,
customer_id, or click_id.Click ID returned by
POST /clicks. Optional if you provide referral_id,
customer_id, or external_user_id.Total sale amount for the purchase. Must be a positive number.
Three-letter currency code for the sale amount, such as
USD or EUR. If
the sale currency differs from your team currency, Affonso converts the sale
amount and preserves the original values internally.Optional product identifiers to help match product-specific incentives.
Optional price identifiers to help match price-based incentives.
Subscription interval for the conversion. Valid values:
monthly,
yearly.Whether the conversion comes from a subscription purchase.
Provider-side idempotency key for the conversion event. Use a stable unique
identifier from your system, such as an order ID, invoice ID, checkout
session ID, or payment event ID.
Optional commission status override. Valid values:
pending,
pending_manual_approval, ready_for_payment, processing_payout, paid,
declined, refunded, dispute. If omitted, Affonso derives the status
from the matched incentive’s approval settings.Purchase status. Valid values:
open, complete, trialing, failed,
refunded, partial_refunded.Optional ISO 8601 timestamp for the conversion.
Optional metadata object stored on the created affiliate earning when a
commission is created.
Validation Rules
- At least one of
referral_id,customer_id,external_user_id, orclick_idis required. intervalshould only be sent for subscription conversions.- Reusing the same
external_event_idreturns the existing conversion instead of creating a duplicate.
Response
The response includes the created conversion object. On a duplicateexternal_event_id, the API returns the existing conversion with HTTP 200.
Always
true for successful responses.The conversion object.
