Stripe API
Last updated
Last updated
Go to Step 4 (PromoteKit Integration) in your PromoteKit setup tab to follow along with these instructions. We also have a video walkthrough for NextJS:
The PromoteKit script will go on both your site's landing page (where you'll be sending referrals), and the page on your site / app where your customers checkout. It's ok if your marketing site and app site are on different subdomains - the cookie tracking works across all subdomains of a domain. A common setup would be embedding the script on your marketing site at yourdomain.com, and app domain at app.yourdomain.com.
Copy this script and paste it within your site's <head> or <body> tags.
Once the script is embedded, the referral ID will be retrievable with JavaScript/TypeScript using window.promotekit_referral
, or with PHP using $_COOKIE['promotekit_referral']
You will need to pass this ID in the metadata field when creating a Stripe checkout session or when creating a Stripe subscription. In the body of either of these API calls, include promotekit_referral
within the metadata.
If you want to attach referrals to affiliates manually when they signup to your service and before they have paid, you can use this function:
Email is a required parameter, and stripe customer id is an optional parameter.