Fimuro Partners docs

How to track affiliate clicks, signups, payments and refunds from any website and any payment gateway.

Quick start

  1. Create your company and a program. Set the commission rate, cookie length, hold period and payout minimum.
  2. Paste the tracking script on every page of your website.
  3. Report signups, from the browser or from your server, so each customer is linked to the affiliate.
  4. Report payments. Connect your gateway with a webhook, or call the API after each successful payment.
  5. Share your program page. Affiliates join, get their link and see their earnings.

The Install tab in your company shows the same steps with your own keys already filled in.

Programs

A program is one product with its own commission rules, affiliates and reports. One company can run several programs, one per product.

With more than one program, every request must say which program it is for: add data-program="program-slug" to the tracking script, send "program" in API calls, and choose the program when you connect a gateway. A referral in one program never earns in another.

Tracking script

Add this to every page of your website. Your public key is in Company > Settings.

<script async src="https://partners.fimuro.com/t.js" data-key="pk_..."></script>

When a visitor arrives with ?ref=CODE (or ?via=, ?aff=), the script records the click and saves two cookies on your domain: pp_ref (referral code) and pp_vid (visitor id). Form fields named pp_ref or pp_vid are filled automatically.

Options: data-domain=".example.com" shares the cookie across subdomains, data-param="partner" adds your own URL parameter. For a company with more than one program, add data-program="program-slug".

Browser functionWhat it does
FimuroPartners.signup(email, userId)Reports a signup from the browser. It is confirmed when your server or your gateway later sends the same visitor id (pp_vid) or referral code. Without that, the commission waits for your review, because a browser call alone can be faked.
FimuroPartners.referral()The referral code, to pass into your checkout
FimuroPartners.visitor()The visitor id, to pass into your checkout

Each affiliate gets a referral code and two kinds of link. Both work the same way.

LinkExample
Direct link to your sitehttps://yoursite.com/?ref=maya7f2a
Short linkhttps://partners.fimuro.com/r/maya7f2a
Short link to one pagehttps://partners.fimuro.com/r/maya7f2a?to=/pricing
With a campaign labelhttps://yoursite.com/?ref=maya7f2a&sub=youtube

The short link only sends visitors to pages on the program's own website. The sub label shows in reports, so an affiliate can see which campaign brought each sale. A coupon code can be tied to an affiliate too, and then the sale is credited even without a link.

Server API

Send JSON with your secret key: Authorization: Bearer sk_.... Never use the secret key in the browser. Limit: 600 requests per minute. Amounts are what the customer paid, tax included, unless you send a smaller amount yourself.

POST /api/v1/leads

Call when a user signs up. Every later payment from this user is credited to the affiliate (renewals included).

{
  "customer_id": "42",          // your user id (or send "email")
  "email": "[email protected]",
  "ref_code": "maya7f2a",      // from the pp_ref cookie
  "visitor_id": "a1b2c3...",    // from the pp_vid cookie
  "coupon": "MAYA20",          // optional
  "program": "program-slug"     // required when your company has more than one program
}

POST /api/v1/sales

Call after every successful payment (first payment and renewals). Repeating the same order_id is safe.

{
  "order_id": "TRX-10023",      // unique payment id
  "amount": 1500,
  "currency": "BDT",
  "customer_id": "42",
  "email": "[email protected]",
  "ref_code": "maya7f2a",      // optional
  "visitor_id": "a1b2c3...",    // optional
  "coupon": "MAYA20",          // optional
  "gateway": "eps"              // shown in reports
}

Response: { "ok": true, "status": "created", "commission": 300, "currency": "BDT" }. Other statuses: exists (already counted), ignored (not a referred customer), rejected (self referral).

POST /api/v1/refunds

{ "order_id": "TRX-10023" }                                         // full refund
{ "order_id": "TRX-10023", "amount": 500, "refund_id": "R-1" }      // partial refund, refund_id is required

Before payout the commission is cancelled (or reduced). After payout the amount is taken from the affiliate's next payout.

Errors

Errors come back as { "ok": false, "error": "..." } with one of these HTTP codes.

CodeMeaning
400Something in the request is missing or wrong. The message says what.
401The secret key is missing or not valid
403The company is disabled
429Too many requests. Wait a minute and try again.

Payment gateway webhooks

In Company > Gateways, add the gateway and paste its signing secret. Then put the webhook URL in your gateway. Pass the referral as checkout metadata: pp_ref, pp_vid and optional pp_coupon.

GatewayEventsMetadata field
Stripecheckout.session.completed, invoice.paid, charge.refunded, charge.dispute.createdmetadata / subscription_data.metadata / client_reference_id
Dodo Paymentspayment.succeeded, refund.succeeded, subscription.active, dispute.openedmetadata
Paddle Billingtransaction.completed, adjustment.created, adjustment.updatedcustom_data
Lemon Squeezyorder_created, order_refunded, subscription_payment_success, subscription_payment_refundedcheckout[custom]
Polarorder.paid, order.refundedmetadata
Razorpaypayment.captured, refund.processednotes

Custom webhook (any system)

Send a POST to the webhook URL with header X-Signature = hex HMAC-SHA256 of the raw body, using the secret shown in the Gateways tab.

{ "type": "sale", "order_id": "TRX-1", "amount": 29, "currency": "USD", "customer_id": "42", "ref_code": "maya7f2a" }
{ "type": "refund", "order_id": "TRX-1" }
{ "type": "lead", "customer_id": "42", "email": "[email protected]", "visitor_id": "a1b2c3..." }

SDKs

PHP (no Composer needed): FimuroPartners.php. Node.js 18+: fimuro-partners.js.

require 'FimuroPartners.php';
$pp = new FimuroPartners('sk_...', 'https://partners.fimuro.com');
$pp->lead(['customer_id' => $userId, 'email' => $email]);          // reads pp_ref / pp_vid cookies
$pp->sale(['order_id' => $trx, 'amount' => 1500, 'currency' => 'BDT', 'customer_id' => $userId]);
$pp->refund(['order_id' => $trx]);

How commissions work

  • Attribution, always inside one program: an existing referred customer keeps their affiliate. Otherwise: coupon code, then referral code, then the last click inside the cookie window.
  • Every sale needs a customer_id or an email, so renewals and refunds can be matched.
  • Safari and some other browsers keep script cookies for 7 days at most. For a longer window, call /api/v1/leads from your server at signup.
  • Rate: a custom rate for the affiliate, otherwise the highest performance tier reached, otherwise the program rate.
  • Recurring: first payment only, a number of months from the first payment, or lifetime.
  • Hold period: commissions wait this many days, then become available for payout. Flagged ones wait for your review.
  • Checks: self referrals are rejected. A click from the affiliate's own IP address, a customer email that looks almost the same as the affiliate's and browser-only signups are held for your review. Link previews and known bots are not counted as clicks.

Test your setup

  1. Join your own program with a second account and copy the affiliate link.
  2. Open the link in a private window, sign up and make a test payment.
  3. Open the Event log tab in your company. Every API call and webhook is listed there with its result, so you can see what arrived and why it was counted or ignored.
  4. Check the Commissions tab for the commission.

A purchase by the affiliate through their own link is rejected as a self referral, so use a different email for the buyer.