Connect your Stripe account to Blossu to automatically track conversions, attribute sales to the right partners, and calculate commissions.
Before you can track revenue, you need to connect your Stripe account to Blossu. This allows us to receive webhook events when payments are made.
In your Blossu dashboard, go to the Setup page and navigate to the "Attribute revenue" step.
Click the "Connect" button next to Stripe. You'll be redirected to Stripe to authorize the connection.
On Stripe, select the account you want to connect and click "Connect". You'll be redirected back to Blossu automatically.
How you pass the referral ID to Stripe depends on how you've integrated Stripe into your product. Choose the approach that matches your setup:
Use this if you create Checkout Sessions on your server, use custom payment forms, or want to track promo codes.
Use this if you use Stripe.js on the frontend, or Stripe's no-code tools like Payment Links, Buy Buttons, or Pricing Tables.
If you create Checkout Sessions on your server, you need to pass the referral ID from the client to your server, then include it in the session creation.
When the Blossu tracking script detects a referral, it stores the referral ID in window.blossu_ref_id. You need to pass this to your server when creating a checkout.
// Get the referral ID from the Blossu script
const referralId = window.blossu_ref_id || null;
// Pass it to your checkout endpoint
fetch('/api/create-checkout', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
priceId: 'price_xxx',
referralId: referralId,
}),
});On your server, include the referral ID as the client_reference_id when creating the Checkout Session. This is how Blossu knows which partner referred the sale.
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [{ price: req.body.priceId, quantity: 1 }],
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
client_reference_id: req.body.referralId, // The Blossu referral ID
});If you're using custom payment forms instead of Checkout Sessions, you can store the referral ID in the customer or subscription metadata:
const customer = await stripe.customers.create({
email: req.body.email,
metadata: {
blossu_ref_id: req.body.referralId,
},
});
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [{ price: 'price_xxx' }],
metadata: {
blossu_ref_id: req.body.referralId,
},
});Use this option if you integrate with Stripe on the client side, either using Stripe.js or Stripe's no-code embeds like Payment Links, Buy Buttons, or Pricing Tables.
Add data-blossu to any link that points to a Stripe Payment Link. The Blossu script will automatically append the referral ID when the link is clicked.
<a href="https://buy.stripe.com/YOUR_PAYMENT_LINK" data-blossu>
Subscribe Now
</a>Add data-blossu to your stripe-buy-button element:
<stripe-buy-button
data-blossu
buy-button-id="buy_btn_xxx"
publishable-key="pk_live_xxx"
></stripe-buy-button>Add data-blossu to your stripe-pricing-table element:
<stripe-pricing-table
data-blossu
pricing-table-id="prctbl_xxx"
publishable-key="pk_live_xxx"
></stripe-pricing-table>Here's what happens when a referred customer makes a purchase:
Visitor arrives via referral link - The Blossu tracking script captures the partner's code and stores it as blossu_ref_id.
Customer starts checkout - The referral ID is passed to Stripe via client_reference_id or metadata.
Payment completes - Stripe sends a webhook to Blossu with the payment details and referral ID.
Blossu attributes the sale - We match the referral ID to the partner and calculate their commission.
For subscription businesses, Blossu automatically tracks all recurring payments. When a customer renews, we attribute the revenue to the original referring partner based on the stored referral ID.
To test your integration:
Visit your site with a test referral link (e.g., yoursite.com?via=test)
Complete a test purchase using Stripe's test card (4242 4242 4242 4242)
Check your Blossu dashboard - you should see the conversion attributed to the test partner