customer_id goes to that affiliate. Renewals need no click and no cookie.
Before you start
Check three settings in your program.- Enable lifetime/recurring commissions is on, in the program’s commission settings. Without it,
customer_idalone doesn’t attribute a payment. - Recurring frequency cap and Recurring time cap are set the way you want, or left empty for no limit. See Limit how long an affiliate earns.
- Recurring commissions on the commission type is set to Smart connected. This means renewals come from your integration. The other option, Time based, makes Tapfiliate create renewals itself, see Let Tapfiliate generate renewals.
recurring, recurring_cap and recurring_period_days.
Steps
1
Create the customer at sign-up
When a visitor who came through an affiliate signs up, create a customer from your server. Capture the affiliate’s click in the browser first, as in step 1 of Track sales from a custom checkout.The cookie time is checked here, at sign-up. Payments that come later are not limited by it.If the visitor came without an affiliate, don’t create a customer. You will skip their payments in the next step.
No commission is created yet. The response is the customer. Save its
id (cu_…) next to your user: you need it to cancel the customer later.2
Report every successful payment
Each time your billing system confirms a payment of a referred customer, create a conversion with the same
customer_id. Send the payment’s ID as external_id and the amount actually charged.Tapfiliate finds the customer by
customer_id and gives the commission to the customer’s affiliate. Other identifiers in the request are ignored. The response is the conversion with its commissions and a customer object.The first conversion moves the customer from trial to paying (from new to active, from lead to won).3
Cancel the customer when the subscription ends
Use the The response is the customer with status
cu_… ID you saved in step 1. If you don’t have it, find it with GET /customers/?customer_id=USER789.canceled (lost for leads, stopped otherwise). After that, a conversion with this customer_id fails with 400 Customer is capped. No new conversions will be generated for this customer. Existing commissions are not changed.If the person subscribes again, uncancel the customer with PUT on the same URL. The original affiliate keeps earning:A different rate for the first payment
Tapfiliate doesn’t decide which payment is the first. The commission type you send does. To pay, for example, a fixed amount for the first payment and a percentage of each renewal:- In the program, create two commission types. Give them identifiers, for example
first-payment(fixed) andrenewal(percentage). Identifiers use lowercase letters, digits and dashes. - Send
"commission_type": "first-payment"with the first payment and"commission_type": "renewal"with every later one. Your billing system knows which payment is which.
referral_code, still creates a commission.
Limit how long an affiliate earns
Two program settings stop commissions for a customer. Leave them empty for no limit.- Recurring frequency cap — the number of conversions per customer. The first payment counts too. Conversions whose commission type has Count recurring commissions towards cap turned off are not counted. Disapproved commissions still count.
- Recurring time cap — the number of days from the moment the customer was created. With a free trial, the trial is included.
paying_capped. Later conversions fail with 400 Customer is capped. No new conversions will be generated for this customer.
Once the time cap has passed, the next conversion fails with 400 Recurring cap or recurring period exceeded for this customer, and the customer becomes capped too.
Raising the cap later doesn’t reopen customers who are already capped. To reopen one, uncancel it with PUT /customers/{id}/status/.
Let Tapfiliate generate renewals
If you can’t report each payment, set Recurring commissions on the commission type to Time based and pick a Recurrence interval: weekly, monthly or yearly. You still create the customer and send the first payment with this commission type, as in steps 1 and 2. From then on, Tapfiliate creates a conversion for the customer every interval by itself, until you cancel the customer or a cap is reached. Each generated conversion repeats the amount and the commission type of the first payment. Itsexternal_id starts with autorecur-. Upgrades, downgrades, failed payments and refunds are not reflected, so report payments yourself whenever your billing system can.
Refunds and corrections
- Refund of one payment. Disapprove the commission of that payment with Disapprove a commission. Its ID is in
commissions[].idof the conversion. - Partial refund. Change the conversion’s
amountwith Update a conversion and?recalculate_commissions=true. - Subscription ended. Cancel the customer, step 3.
409 commission_approved, see Errors.
Customer statuses
The status you choose at creation sets the kind of customer. Statuses then change like this:
Uncanceling returns the customer to its active status, to its capped status if the frequency cap is reached, or to its initial status if it has no conversions yet.
PUT /customers/{id}/status/ on a customer that is still trial, lead or new fails with 400. Such a customer becomes active only through a conversion.
Common pitfalls
Missing tracking parameter value and no customer found for customer id: …. The customer doesn’t exist. It was never created, or the payment uses a differentcustomer_idthan the sign-up, for example the billing system’s own customer ID instead of yours. Send the same value in both places.Missing tracking parameter value and no lifetime/recurring commissions enabled in program: …. The customer exists, but Enable lifetime/recurring commissions is off in its program.- The same
external_idfor every payment. The second payment fails withDuplicate conversion. Use the payment or invoice ID, not the subscription ID. - A returning customer. A canceled customer stays canceled, even if the person comes back through a new affiliate link. Uncancel it to keep paying the original affiliate.
- Renewals without
customer_id. A renewal sent with only a click, tracking ID or referral code is attributed like any new sale. A click or tracking ID must be within the cookie time, and the commission may go to another affiliate. - Turning recurring commissions off. Customers with a Time based schedule are canceled, and
customer_idalone stops attributing payments.