Skip to main content

React Affiliate Program Tracking with Stripe

Know what must work before you launch

Connect client-side referral state to the backend that creates Stripe Checkout

Best fit
Teams evaluating AffiliateBase for a React affiliate workflow.
Checkout handoff
The checkout path must receive the generated AffiliateBase referral ID.
Proof required
Complete one referred checkout and confirm the attributed sale and commission.

Follow the attribution evidence

Illustrative scenario · fictional values

  1. Referred visit

    ?via=partner

    AffiliateBase captures the visit and generates a referral record.

  2. Checkout handoff

    referral ID

    The checkout must carry the generated identifier into Stripe.

  3. Paid event

    $99 paid

    A supported Stripe event confirms the attributed payment.

  4. Commission

    $19.80 due

    An eligible attributed sale creates the commission record.

  5. Payout prep

    Payout ready

    Review the commission and prepare the next step with your payout provider.

This guide is for merchants building their own affiliate program around a React storefront or SaaS app. React handles the browser UI; your backend still owns Stripe Checkout creation.

Install AffiliateBase in the document shell used by every affiliate landing page. When a buyer starts checkout, submit the generated referral ID with the request to your backend. The public ?via token is not the Stripe client_reference_id.

If your React application uses a framework, follow that framework’s script and server-route conventions. Then use the Stripe guide and verification checklist.

Wire the browser and checkout backend together:

1

Locate the Checkout Boundary

Identify the React action that begins checkout and the backend endpoint that creates the Stripe Checkout Session.
2

Install the Tracking Script

Add the account-specific script to the HTML document or framework layout so it loads before checkout begins.
html
<script async src="https://app.affiliatebase.io/track.js" data-account-id="YOUR_ACCOUNT_ID"></script>
3

Send Referral State to the Backend

Read the generated referral ID after the script is ready and include it in the checkout request. Validate it server-side and pass it to Stripe as client_reference_id.
4

Test a Fresh Referral

Open the exact setup-test affiliate link in a fresh browser session, then complete Stripe test checkout.
5

Confirm the Commission

Check that the completed checkout updated the referral and created the expected sale and commission.

What React Owns in the Flow

Browser Capture

The React page is where the affiliate click becomes a generated referral ID.

Explicit API Handoff

Your checkout request carries referral state to protected server code.

Framework Flexibility

The same contract works with a custom backend or a React framework’s server routes.

React Affiliate Tracking Questions

Is there an AffiliateBase React package?
This guide uses the browser tracking script. It does not require or claim an AffiliateBase npm package.
Can React create Stripe Checkout securely?
The browser should request checkout from your server. Keep Stripe secret-key work server-side and submit only the generated referral ID.
How do I verify attribution?
Complete a test checkout from the generated affiliate link and confirm the referral, sale, and commission in AffiliateBase.

Related Platform Guides

Prove Your React Checkout Handoff

Test the exact referral and checkout route customers will use.