Payment Flow
End-to-end flow from affiliate click to attributed revenue and payout operations, covering server-side tracking and Stripe integration paths
Understand how attribution moves from click → signup → sale in the current public Affitor model.
End-to-End Flow
1. Partner shares a referral link
A partner promotes your product with a referral URL such as:
https://yoursite.com?aff=PARTNER1232. Customer lands on your site
The tracker detects ?aff= and creates the click/customer relationship.
What happens:
- Click is recorded
affitor_click_idis stored in a first-party cookie- Visit is linked to the correct partner/program
3. Customer signs up
After account creation succeeds, you send your internal customer ID to Affitor.
Browser helper example:
if (window.affitor) {
await window.affitor.signup('user_123', 'customer@example.com');
}What matters here:
- Your internal identifier is stored for future matching
- Reuse that same identifier as:
customer_keyin Server-side tracking — your backend calls POST /api/v1/track/saleaffitor_customer_keyin Stripe metadata
4. Customer pays
You then choose one supported sale-tracking path: server-side tracking vs Stripe integration.
Path A — Server-side tracking
Your backend calls POST /api/v1/track/sale when payment succeeds.
{
"transaction_id": "txn_123",
"customer_key": "user_123",
"amount_cents": 10000,
"currency": "USD"
}Path B — Stripe integration
You keep charging in your own Stripe account and attach Affitor metadata.
metadata: {
program_id: 'YOUR_PROGRAM_ID',
affitor_click_id: clickId,
affitor_customer_key: currentUser.id,
}For subscriptions, also include the same fields in subscription_data.metadata.
5. Affitor attributes the sale
Affitor resolves the customer/partner relationship using any combination of:
- click ID
- customer email matching
- Stripe customer ID
- customer key
6. Commission and platform records are created
When attribution succeeds, Affitor records the sale and creates the commission flow. Commissions then move through review / hold / payout operations according to your program configuration.
Invoice billing in Plain Language
In the current public invoice billing model:
- You collect payment from the customer in your own Stripe account
- Affitor attributes the conversion using Stripe metadata + webhook events
- Affitor bills through its invoice workflow for validated partner commission + platform fee obligations
- Affitor continues partner payouts through its payout operations
Affitor is not the merchant of record in this invoice billing model.
One-Time vs Subscription Revenue
One-time payments
For one-time Stripe Checkout payments, attribution starts from checkout session metadata and the associated webhook flow.
Subscriptions
For subscriptions, the initial and recurring commission flow depends on invoice processing.
Recurring setups must therefore include:
metadatasubscription_data.metadata
If only the initial checkout metadata is present, renewals may not attribute correctly.
Common Validation Points
| Check | Why it matters |
|---|---|
customerKey used at signup | links later payments back to the same internal user |
transaction_id unique (server-side tracking) | prevents duplicate sale records |
program_id in Stripe metadata | routes the event to the correct program |
subscription_data.metadata set | keeps renewals attributable |
| click tracked first | gives Affitor the strongest attribution signal |
Example Timeline
| Day | Event |
|---|---|
| 0 | customer clicks affiliate link |
| 0 | tracker stores affitor_click_id |
| 2 | customer signs up and you send customerKey |
| 7 | customer pays |
| 7 | sale is attributed via server-side tracking or Stripe integration |
| 7+ | commission enters review / hold / payout operations |