Stripe

The ReferralHero Stripe is a powerful integration that enables a seamless connection between your ReferralHero account and your Stripe payment gateway. This support document provides a comprehensive overview of the integration's key features, outlining how you can make the most of this powerful tool for your referral marketing campaigns.

Here is what can be done with the ReferralHero Stripe integration:

  • Import Stripe customers into ReferralHero

  • Create customers in ReferralHero when starting an onboarding flow or completing a Stripe payment page/checkout

  • Track Stripe trialing, active, and other subscription events in ReferralHero

  • Track Stripe transactions

  • Sync Stripe customer's conversion value and total spend to RerferralHero

  • Apply Stripe coupons to customers when a ReferralHero reward is unlocked

Connect Stripe Account to ReferralHero

Follow these steps to securely link your Stripe account to ReferralHero for a reliable integration.

  1. In the Stripe Dashboard, navigate to Developers > API Keys section, ensure you grant the necessary permissions in your Stripe account for event tracking with RH.

  1. Go to Stripe Dashboard > Developers > API Keys and copy the Secret Key.

  1. If you would like to enable Test mode in the integration, turn on “Test mode” in your Stripe Dashboard and copy the Test Secret Key.

  1. In ReferralHero, go to Edit Campaign > Integrations > Stripe, and click the button "Connect your Stripe account."

  1. Enter the live Stripe Secret Key in the API KEY text box.

  2. Enter the test Stripe Secret Key in the TEST API KEY text box.

  3. Click "Connect" and "Save".

  1. The "Transaction Tracking" event is automatically generated upon connecting your Stripe account.

  2. Your Stripe account is now successfully connected.

Note: The "Transaction Tracking" event automatically includes Stripe transactions in the "Transactions" tab under the "Reward Logs".

Test the Integration with Stripe "Test Mode"

Test mode is a testing environment that simulates creating real events without the risk of affecting real transactions or moving actual money. Leverage "Test Mode" to safely test the ReferralHero integration without processing real transactions.

  1. Toggle on the option “Enable Test Mode” in the ReferralHero Stripe integration

  1. Toggle on the option “Test mode” in your Stripe dashboard

Import Stripe Customers into ReferralHero

  1. In your ReferralHero campaign dashboard, go to Subscribers > Import > Import from CRM.

  2. Enter a URL for the default referral link.

  3. Toggle on the option to optionally send imported customers a welcome email.

  4. Click "Import."

Note: Import may take 1 to 2 hours to complete, depending on the number of customers in your Stripe account

Automatic Creation of Customers in ReferralHero

You can create customers in ReferralHero when they are added to Stripe using the following methods:

Custom Form

Use the ReferralHero JavaScript RH.form.submit() or RH.pendingreferral() when implementing a custom form/checkout on your website to capture signup or customer information. Data will be automatically synced with ReferralHero when they are created in Stripe.

Stripe Payment Link

You need to create a custom Stripe thank you page on your website to use this feature.

Follow the steps below to generate unique payment links with Stripe and add customers automatically when payment is completed.

  1. Go to your website and add the following ReferralHero script to your Stripe thank you page:

<script> 
window.onload = (event) => { 
    let checkout_id = new URLSearchParams(document.location.search).get('session_id'); 
    if (RH) { 
        RH.stripe_checkout(checkout_id) 
    } 
} 
</script>

The RH.stripe_checkout() works similarly to RH.organicTrackReferral(), which adds organic subscribers or tracks referrals as unconfirmed/confirmed on the conversion page to your referral campaign.

  1. Go to your Stripe dashboard > Payments > Payment Links and click "+ New."

  1. Choose a product on the "Payment Page" tab.

  1. Go to the "After Payment" tab, check the option "Don't show confirmation page" to redirect customers to the custom thank you page on your website.

  2. Enter your custom thank you page URL by attaching an additional parameter session_id as shown below to the URL text box: https://mywebsite/Stripethankyoupage?session_id={CHECKOUT_SESSION_ID}

  3. Click "Create link."

  1. Copy the payment link created and send it to your customer.

  1. The customer will be created in ReferralHero when they complete the payment.

Definitions to Track Referral Events

There are three types of Stripe events that can be tracked in the integration based on specific Stripe activities:

  1. Stripe Status Change: Monitor changes in customer statuses (such as trialing or active) to trigger referral actions in ReferralHero.

  2. Payment Succeeds in Stripe: Record referral events when specific payment transactions occur in Stripe.

  3. Transaction Occurs: This event is automatically created when the Stripe account is connected. It logs the transaction data in the “Transactions” tab, sets the Conversion Value and updates the Lifetime Spend with the Stripe Total_Spend in the subscriber profile. You must track this event if you plan to use affiliate reward structures.

Example 'Stripe Status Change' event

This example illustrates an event that sets the referral status from 'pending' to 'unconfirmed' when a Stripe subscription state moves into trialing.

Example 'Payment Succeeds' event

This example illustrates an event that sets the referral status from 'unconfirmed' to 'confirmed' when a customer's Stripe payment amount is greater than $50.

Example 'Transaction Tracking' event

This example illustrates the event that sends the Stripe transaction data, which is logged in the “Transactions” tab. It also sets the Conversion Value and updates the Lifetime Spend with the Stripe Total_Spend in the subscriber profile.

Options for Applying Stripe Coupons

Enhance your referral campaigns by offering discounts through Stripe coupons, seamlessly integrated with ReferralHero. Stripe customers' accounts will automatically apply a discount code when they unlock a reward in ReferralHero.

  1. Set up a reward in your ReferralHero campaign.

  2. Go to your Stripe integration in ReferralHero and click the button "+ Add Reward Coupon."

  1. Select the coupon you would like to apply to the Stripe customer from the dropdown.

  2. Select the reward that the customer needs to unlock to earn the discount.

Example ‘Reward Coupon’ event

This example illustrates that when the Stripe customer successfully refers one referral and unlocks the reward "cybermonday19",

the 'Reward Coupon' event set up for the reward "cybermonday19" will automatically apply the discount code "cybermonday19" to the customer's account in Stripe.

Track Stripe Transactions

ReferralHero supports ongoing transaction tracking, empowering you to reward affiliates for transactions that occur over time. This feature allows you to provide commissions beyond the initial transaction.

Note: For existing Stripe customers, the first-ever payment amount becomes the Conversion Value, and the Stripe Total_Spend is reflected as the Lifetime Spend in the ReferralHero subscriber profile.

Scenario Overview

Stripe integration events:

  1. “Transaction Tracking”

  2. "Stripe Status Change" event triggered when a subscriber moves into "Active", setting the referral to confirmed.

Reward settings:

  1. Reward the referrer for each transaction completed by a “Confirmed” referral

  2. Reward the referrer 10% of each transaction by the “Confirmed” referral

  3. Reward should recur for 10 transactions

Expected Behavior of Events:

  1. A Pending referral is simultaneously created in ReferralHero when a Trialing customer is created in Stripe.

  2. The Trialing customer purchases a $200 plan and transitions into Active status in Stripe

  3. "Stripe Status Change" event triggers, changing the referral status from Pending to Confirmed.

  4. "Transaction Tracking" event is triggered, logging data in the Transactions tab, and updating the subscriber profile.

  5. A reward of $20 is unlocked by the referrer

  6. The referral makes another payment in Stripe

  7. “Transaction Tracking” event is triggered again, logging data in the Transactions tab, and updating the subscriber profile

  8. Rewards are unlocked by referrer for 10 transactions.

Last updated