Stripe Payment Links Integration
Stripe Payment Links let you accept payments without writing code. AffiliateBase automatically tracks conversions from Payment Links, Pricing Tables, and Buy Buttons.
How It Works
When you add the AffiliateBase tracking script to your page:
- Script detects Stripe Payment Links, Pricing Tables, and Buy Buttons
- Automatically appends
client_reference_idwith the referral ID - Conversions are tracked without any code changes
Setup
Step 1: Add the Tracking Script
Add to any page containing Stripe Payment Links:
<script>
(function(w,r){
w._abq=w._abq||[];
w[r]=w[r]||function(){(w[r].q=w[r].q||[]).push(arguments)}
})(window,'affiliatebase');
</script>
<script
async
src="https://cdn.jsdelivr.net/npm/affiliatebase-tracking@1/src/index.js"
data-org-id="YOUR_ORG_ID">
</script>
Step 2: Add Your Payment Links
No changes needed to your Payment Links. Just add them normally:
<!-- Stripe Payment Link Button -->
<a href="https://buy.stripe.com/xxxxx">Buy Now</a>
The tracking script automatically modifies Payment Link URLs to include the referral ID.
Supported Stripe Elements
Payment Links
Standard Payment Link buttons work automatically:
<a href="https://buy.stripe.com/xxxxx" class="your-button-styles">
Get Started - $29/month
</a>
Pricing Tables
Stripe Pricing Tables are automatically enhanced:
<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
<stripe-pricing-table
pricing-table-id="prctbl_xxxxx"
publishable-key="pk_live_xxxxx">
</stripe-pricing-table>
The script adds client-reference-id to the pricing table.
Buy Buttons
Stripe Buy Buttons also work automatically:
<script async src="https://js.stripe.com/v3/buy-button.js"></script>
<stripe-buy-button
buy-button-id="buy_btn_xxxxx"
publishable-key="pk_live_xxxxx">
</stripe-buy-button>
Testing
Verify Script Enhancement
- Open browser Developer Tools
- Click an affiliate link to your page (e.g.,
?via=test) - Inspect a Payment Link element
- Check that
client_reference_idwas appended to the URL
Test a Purchase
- Visit your page via an affiliate link
- Click a Payment Link
- Complete checkout with test card
4242 4242 4242 4242 - Verify conversion appears in AffiliateBase dashboard
No-Code Platforms
Webflow
- Add the tracking script to your site’s Custom Code (head)
- Add Stripe Payment Links using embed blocks
- Tracking works automatically
Squarespace
- Add the tracking script via Code Injection (header)
- Use Code Blocks to embed Payment Links
- No additional configuration needed
WordPress
- Add tracking script to header (via theme or plugin)
- Embed Payment Links in posts or pages
- Automatic tracking enabled
Multiple Payment Options
If your page has multiple payment options, all are tracked:
<!-- All of these work automatically -->
<a href="https://buy.stripe.com/monthly">Monthly - $29</a>
<a href="https://buy.stripe.com/annual">Annual - $290</a>
<stripe-pricing-table pricing-table-id="prctbl_xxxxx">
</stripe-pricing-table>
<stripe-buy-button buy-button-id="buy_btn_xxxxx">
</stripe-buy-button>
Limitations
Referral Required
The script only adds tracking when a valid referral exists. If a visitor arrives without an affiliate link, no client_reference_id is added.
External Payment Links
Payment Links on external domains (not your site) won’t be tracked. The tracking script must be on the same page as the Payment Link.
JavaScript Required
Automatic enhancement requires JavaScript. Users with JavaScript disabled will see unmodified Payment Links.
Combining with Checkout Sessions
You can use both Payment Links and Checkout Sessions:
- Payment Links: Simple purchases, no-code setup
- Checkout Sessions: Custom flows, complex products
Both track conversions the same way through the client_reference_id.
Troubleshooting
Payment Link URL Not Modified
- Check tracking script is loading (look for console logs)
- Verify a referral was captured (
window.affiliatebase_referral) - Ensure Payment Link is a valid
buy.stripe.comURL
Conversion Not Attributed
- Verify referral existed before clicking Payment Link
- Check Stripe webhook delivery in Stripe Dashboard
- Ensure AffiliateBase webhook endpoint is active
Pricing Table Not Enhanced
- Ensure tracking script loads before Stripe’s pricing-table.js
- Check for JavaScript errors in console
- Try refreshing the page with an affiliate parameter
Next Steps
- Learn about Checkout Session integration for custom flows
- Set up coupon code tracking as an alternative
- Review troubleshooting if issues persist