Note: double-sided incentives are part of the Growth plan. 

"Double-sided incentives" allow you to apply coupons to referred customers, and are a great way to increase the conversion rate for affiliate traffic. Not only does this increase your revenue, higher conversion rates help motivate affiliates and keep them engaged — the more successful your affiliates are, the more they'll want to promote you!

We call them double-sided (or two-sided) incentives because in addition to the affiliate's incentive to drive traffic (i.e. the commission) the visitors also have an incentive to convert (i.e. the coupon).

This article will show you how to add a double-sided incentive (coupon) to your Rewardful campaign.

Tip for advanced users: the coupon data will also be accessible through our JavaScript API. You can use this to customize your website or populate coupon form fields based on the current coupon.

Step 1: Create a coupon in Stripe

Create a new coupon from your Stripe dashboard. This will be the coupon that is applied to new customers who sign up.

You can choose any type (fixed amount or percentage) and duration (forever, once, multiple months). But it's important that you do not specify a redemption limit:

Once you've created the coupon, you'll need to copy and paste the ID into Rewardful. You can find the ID here:

Step 2: Paste the coupon ID into Rewardful

On your Edit Campaign page, click the "Toggle advanced settings" link in the bottom right corner. Paste the coupon ID into the text field labelled "Stripe Coupon ID" as shown below:

Step 3: (Code) Pass the coupon back to Stripe

Note: This step will need to be performed by a developer.

When your signup form is submitted, our JavaScript will automatically pass a parameter named coupon to your server, along with the rest of the signup form data. If there is no coupon attached to your campaign, or the visitor isn't a referral, coupon  will not be inserted.

(Tip: This is exactly how Step 3 of the initial Rewardful setup works.)

You must then pass this coupon parameter to Stripe, similar to how referral is passed as metadata.

For example, your Ruby code might look something like this:

Stripe::Customer.create(
  email: params[:email],
  metadata: { referral: params[:referral] },
  coupon: params[:coupon]
)

Note the coupon: params[:coupon] being passed to Stripe.

This will add the coupon to the Stripe customer and apply a discount to their invoices based on the coupon settings.

⚠️ IMPORTANT ⚠️

Stripe's API will raise an error if you attempt to pass an invalid coupon code. Rewardful attempts to never include an invalid coupon code, but we recommend implementing error handling nonetheless — as always.

One approach is to validate the coupon by attempting to retrieve it from Stripe before adding it to the customer object. For example, in Ruby:

coupon = Stripe::Coupon.retrieve(params[:coupon]) rescue nil

Stripe::Customer.create(
  email: params[:email],
  metadata: { referral: params[:referral] },
  coupon: coupon
)

Retrieving the coupon first (and handling any Stripe API errors) guarantees you'll never encounter a "No such coupon" error when creating the customer.

Have more questions?

If you have more questions or would like code samples in another programming language, please let us know at hello@getrewardful.com or by live chat. We'll be happy to help!

Did this answer your question?