<head>
tag:
<script>(function(w,r){w._rwq=r;w[r]=w[r]||function(){(w[r].q=w[r].q||[]).push(arguments)}})(window,'rewardful');</script>
<script async src='https://r.wdfl.co/rw.js' data-rewardful='80669a'></script>
Copydata-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>)
Copyreferral
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.
The referral
parameter will be submitted with the rest of the form data in Step 2. Add referral
to the Stripe Customer's metadata.
# 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)
Copy// 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)
Copy# 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)
Copy<?
// 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);
Copyreferral
metadata by
updating the customer.coupon
parameter to Stripe if you're using our double-sided incentives feature (coupons)
Learn more →