Referral Rocket
HomeDashboard
  • What is Referral Rocket?
  • Referral Program Examples
  • Getting Started
    • Campaigns
      • Campaign Types
      • Campaigns Details
        • Milestone Details
        • Reward Details
        • Referrer Widget
        • Invitee Widget
      • Installing/Tracking your Referral Campaign
        • Option 1: Hosted Solution (No/Low Code)
        • Option 2: Custom Solution
          • Simple Referral Program Redirect: Quick Setup Guide
          • Redirect user to hosted campaign
          • Embed Referral Rocket Widget
          • Integrate the referral program inside your webapp for logged in user
        • Referral Tracking
          • Track referral on Sign Up page
          • Track referral on Payments
      • Reward Management
      • Campaign Participants
      • Campaign Dashboards
  • Developer Tooks
    • Javascript SDK
    • REST API
      • API Endpoint
    • Webhooks
      • Setup
      • Testing
      • Events
  • Integrations
    • Stripe
      • How to setup Stripe?
        • Stripe Settings
      • Referral Tracking with Stripe
        • Promo Code Referral Tracking with Stripe
        • Setup Stripe Pricing Table
        • Setup Stripe Payment Links
        • Setup Stripe Payment Button
    • Cashfree
    • Razorpay
    • MemberSpace
    • Outseta
    • Shopify
      • How to setup Shopify?
      • Add Referral Widget on Shopify Stor
      • Popup Script to Display Discount Codes
    • ScoreApp
  • Rewards
    • Tremendous
      • How to integrate Tremendous?
        • Tremendous Settings
      • How to issue rewards with Tremendous?
    • PayPal Mass Payments
    • Wise Batch Payments
    • Stripe
    • Shopify
    • RazorPayX
    • Paypal
  • Affiliate Hub
    • Affiliate Program Hub
  • Product Updates
    • December 2024
  • Trust Center
  • Contact Us
  • FAQ
    • Where to find Campaign ID?
    • Understanding the Test Plan: Perfect for Testing, Limited for Production
Powered by GitBook
On this page
  1. Integrations
  2. Stripe
  3. Referral Tracking with Stripe

Setup Stripe Pricing Table

PreviousPromo Code Referral Tracking with StripeNextSetup Stripe Payment Links

Last updated 4 months ago

Stripe offers a customizable Pricing Table component, which serves as an embeddable interface for displaying various subscription pricing options. It integrates seamlessly with Stripe Checkout, enabling users to easily embed pricing information on their websites.

The basic implementation of the Pricing Table component is as follows:

To send the referral code to Stripe using the Pricing Table, you need to include it as an attribute within the component. For example:

Stripe automatically retrieves the client_reference_id from the component and includes it in the Checkout Session object.

To add the referral code to the Pricing Table, users can insert the following script on the page where the Pricing Table is located. This script updates the client_reference_id and referral code as key-value pairs in the Pricing Table component. Unlike Payment Links or Buy Buttons, the referral code is not visible in the URL when customers click on the Pricing Table. However, Stripe internally tracks the referral data to ensure proper affiliate tracking.

Step 1

  1. Add the universal script on the page

// Add this script in the HEAD tag
<script type="text/javascript" campaign-id="YOUR-CAMPAIGN-ID" 
defer src="https://app.referralrocket.io/widget/widgetIndex.js">
</script>

Step 2

Here’s the script for dynamically updating the Pricing Table component:

// Some code
<script>
        const updatePricingTables = () => {
            const refCode = window.Rocket.getCampaign().getReferralCode();
            if (refCode && refCode.trim() !== '') {
                const tables = document.querySelectorAll("stripe-pricing-table");
                if (tables.length > 0) {
                    tables.forEach(stripeTab => {
                        const code = stripeTab.getAttribute("client-reference-id")
                        // Update the client-reference-id only if it differs from
                        // the current referral code
                        if (code !== refCode) {
                            stripeTab.setAttribute("client-reference-id",refCode);
                        }
                    });
                }
            }
        };
        setTimeout(updatePricingTables, 1000);
        setTimeout(updatePricingTables, 2200);
        setTimeout(updatePricingTables, 3200);
</script>

This script ensures that the client_reference_id is updated dynamically for accurate affiliate tracking, even though the referral code will not be visible in the URL.