Integrating Rewardful is a quick way to set up affiliate and referral programs for Stripe's client-side checkout. We automatically track referred Visitors, Leads and Conversions from your affiliates, customers, influencers and/or partners. Commissions are automatically adjusted for any billing event changes such as downgrades, upgrades, free trials, cancellations and refunds.
Each person that signs up to your program will receive a personalized dashboard where they can create and manage their affiliate links, stats and track their success.
To set up the integration:
Then follow these steps to complete the integration:
I. Adding the Rewardful Tracking Script
Grab your Rewardful script from STEP 1 on the JavaScript integration page (Note: you don't need to add Step 2 as another code will handle the referral UUID).
Note: For users using Google Tag Manager in their WordPress site, grab this version of the STEP 1 script.
Paste the STEP 1 script into the <head> section of your website. It must appear on every page of your application and marketing website.
II. Add the referral data to your signup form
Add data-rewardful to the form that gets submitted when you create a Stripe customer (signup form, upgrade form, etc.):
<form action="/signup" method="post" data-rewardful>
<!-- your signup form here -->
</form>)
Rewardful will automatically insert a hidden input named referral into the form, which will get submitted to your server along with the rest of this form's data. The value will be a UUID representing the current referral. You'll pass this UUID parameter to Stripe in the next step.
Notes:
Read more about how Rewardful automatically attaches to forms β
Refer to our JavaScript API If you're using a JavaScript framework like React, Vue, etc.
III. Add the referral UUID to Stripe Customer metadata
The referral parameter will be submitted with the rest of the form data in Step 2. Add referral to the Stripe Customer's metadata.
Ruby
Please see the Stripe API Reference for full documentation on creating a customer with Ruby.
# Gather params submitted with <form>
customer_params = {
email: params[:email],
source: params[:stripe_token] # Obtained with stripe.js
}
# Add the `referral` parameter from Rewardful to the Stripe customer metadata, if present.
if params[:referral].present?
customer_params[:metadata] = { referral: params[:referral] }
end
# Create the customer in Stripe.
Stripe::Customer.create(customer_params)
Node.js
Please see the Stripe API Reference for full documentation on creating a customer with Node.js.
// Gather params submitted with <form>
const customerParams = {
email: req.body.email,
source: 'tok_visa' // Obtained with stripe.js
}
// Add the `referral` parameter from Rewardful to the Stripe customer metadata, if present.
if (req.body.referral) {
customerParams.metadata = { referral: req.body.referral }
}
// Create the customer in Stripe.
stripe.customers.create(customerParams)
Python
Please see the Stripe API Reference for full documentation on creating a customer with Python.
# Gather params submitted with <form>
customer_params = {
'email': request.POST['email'],
'source': request.POST['stripe_token'] # Obtained with stripe.js
}
# Add the `referral` parameter from Rewardful to the Stripe customer metadata, if present.
if 'referral' in request.POST:
customer_params['metadata'] = { 'referral': request.POST['referral'] }
# Create the customer in Stripe.
stripe.Customer.create(**customer_params)
PHP
Please see the Stripe API Reference for full documentation on creating a customer with PHP.
<?
// Gather params submitted with <form>
$customerParams = array(
'email' => $_POST['email'],
'source' => $_POST['stripe_token'] // Obtained with stripe.js
);
// Add the `referral` parameter from Rewardful to the Stripe customer metadata, if present.
if( isset($_POST['referral']) ) {
$customerParams['metadata'] = array('referral' => $_POST['referral'])
}
// Create the customer in Stripe.
\Stripe\Customer::create($customerParams);
Adding the referral UUID to the Stripe customer's metadata converts the referral and associates it with the affiliate. Whenever that customer is charged, a commission will be paid to the affiliate according to your campaign rules.
Notes:
If you already have a Stripe customer created, simply add the
referralmetadata by updating the customer.You'll also need to pass the
couponparameter to Stripe if you're using our double-sided incentives feature (coupons) Learn more β
IV. Confirming the Rewardful dashboard initial setup
Go back to your Rewardful dashboard, click the
Ok I've completed thisbutton.On the next set of instructions, open the link that has a
?via=installon an incognito window or private browser, let your site fully load.Go back to your Rewardful dashboard and refresh the page. If the STEP 1 tracking script is correctly placed, it will confirm your Rewardful initial dashboard setup.
If there's no confirmation, please chat with us or email us so that we'll check things for you.
V. Referrals are not tracking? Check the following (Troubleshooting)
Make sure that:
The Rewardful tracking script is installed as described in this article.
The script from Step 1 includes your API key from the dashboard.
The referral UUID is being passed to Stripe when you create the customer.
You tested using an incognito/private window.
If you still see the issue, reach out to our support team, and weβll be happy to take a look.
