Adding Refindie to Your Website
Install tracking script and integrate with your payment system.Integration Steps
1. Add the tracking script
Copy and paste the script below in the<head>
section of your website.
Script Parameters:
data-program-id
- Your affiliate program ID (required)
2. Get referral data
The script sets a global object with referral information:refindie_metadata.program_id
(string | number)refindie_metadata.ref_code
(string)refindie_metadata.is_new_visit
(boolean)
3. Send data during payment
Include referral data in your payment API calls to attribute commissions.Integration Options
Option 1: Stripe Connect (Recommended)
- Connect your Stripe account in Settings > Integration
- Pass the referral metadata to Stripe Checkout using the
metadata
field (exactly the object fromwindow.refindie_metadata
)
- Professional payment processing
- Commission tracking via Stripe metadata
- Payment history and manual payout verification
Option 2: Referral API
Use the server-to-server endpoint when you use a custom payment provider or want to record a referral manually.- Endpoint:
POST /api/referral
- Headers:
x-api-key: <YOUR_PROGRAM_API_KEY>
- Body (JSON):
ref_code
(string)program_id
(string | number)spent_amount
(number, in cents)currency
(string, e.g. “USD”)transaction_id
(string, unique)
Implementation Examples
React Component (Next.js)
API Route (app/api/checkout/route.ts)
AI Assistant Prompt
Copy this prompt into your AI assistant to implement this feature:Tips and Help
💡 Important Tips
- Add the script to all your pages to never miss a referral
- Referral data is available as soon as the script is loaded
- Test the integration in development mode before production
✅ Verification
To verify that the integration works, open your browser console and typewindow.refindie_metadata
. You should see the referral data.
Support
If you encounter any difficulties, contact us at contact@refindie.com or consult our documentation.- Email: contact@refindie.com
- Check our Program Creation guide