Skip to main content

How to Integrate Stripe with Tapfiliate

This guide walks you through connecting your Stripe payment system with Tapfiliate.

Gumrah avatar
Written by Gumrah
Updated over a week ago

In this article, we will cover:

Stripe Integration Overview

Tapfiliate offers robust and seamless integration with Stripe payment software, enabling automated tracking of affiliate conversions and commissions. This advanced integration setup supports both one-time and recurring commission structures. Additionally, it automates the handling of refunds, disputes, and coupon code tracking, significantly streamlining your affiliate management process.

Pros:

  • Automatically tracks recurring & lifetime commissions

  • Automatically handles refunds & disputes

  • Very easy to activate once code is installed

Cons:

  • Requires developer’s assistance

  • Does not track initial conversions via plugin (javascript needs to be implemented)

Prerequisites for integrating Stripe

To successfully integrate, ensure you have the following:

  • A live Tapfiliate account with access to your account ID.

  • A Stripe account with API key access.

  • Admin/developer access to your website's codebase.

  • Ability to fetch Stripe's Customer ID (cus_...) and Charge ID (ch_...) fields from your transactions.

  • (Optional) An affiliate coupon code set up in both Stripe and Tapfiliate if you plan to use coupon conversion tracking.

Steps to complete tracking setup

Step 1: Set up clicks Tracking

To install Tapfiliate tracking for Stripe, add the following code to the <head> section of every page on your website:

Note:It’s advisable not to use “Google tag manager” since it’s an optional cookie.

<script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>

<script type="text/javascript">

(function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){

(t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

tap('create', 'YOUR-ACCOUNT-ID', { integration: "stripe" });

tap('detect');

</script>

Remember to replace 'YOUR_ACCOUNT_ID' with your unique Tapfiliate account ID. This code snippet is essential for setting up Tapfiliate and preparing it for seamless integration with Stripe.

Option (A): Tracking free trials (for users with recurring subscriptions)

If your user flow consists of a free trial first, and then subsequent purchases, add the below code to the thank you page after user successfully starts their free trial:

<script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>

<script type="text/javascript">

(function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){

(t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

tap('create', 'YOUR-ACCOUNT-ID', { integration: "stripe" });

tap('trial', 'STRIPE CUSTOMER ID');

</script>

Replace “YOUR-ACCOUNT-ID” with your actual Tapfiliate account id and replace the ‘STRIPE CUSTOMER ID’ with the customer id from stripe.

Note: You will require a developer to correctly pull the Stripe customer id via https://docs.stripe.com/api/customers/object

Option (B): Tracking immediate purchase (for e-commerce/subscription without free trial)

If your user flow bypasses a free trial and directly involves a purchase or an upfront subscription, implement the code provided below on the thank you page after purchase:

<script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>

<script type="text/javascript">

(function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){

(t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

tap('create', 'YOUR-ACCOUNT-ID', { integration: "stripe" });

tap('conversion', 'STRIPE CHARGE ID', ORDER AMOUNT, {customer_id: 'STRIPE CUSTOMER ID'});

</script>

Replace “YOUR-ACCOUNT-ID” with your actual Tapfiliate account id and replace the ‘STRIPE CHARGE ID’ and ‘STRIPE CUSTOMER ID’ with the actual charge id and customer id from stripe.

Note: You will require a developer to correctly pull the Stripe charge id and amount via the Stripe API from : https://docs.stripe.com/api/charges/object and the customer id via the Stripe API: https://docs.stripe.com/api/customers/object

Note: Depending on your business model and user flow, you can choose either Option (A) or (B). Please ensure you follow the preceding and subsequent steps as outlined.

Step 3: Connecting Stripe with Tapfiliate (Used to track recurring conversions)

Once you have successfully placed the codes as per the above steps, you can directly connect your stripe account with your Tapfiliate account

Make sure that you have successfully enabled “recurring/lifetime commissions” in the commission structure section to attribute the recurring/lifetime revenue from customers to the originating affiliates.

Note: Stripe plugin connection is used to track recurring/lifetime commissions after the initial javascript/API connection with the website is already made. The stripe plugin does NOT track the clicks and conversions from the website.

Advanced or Optional Features

Coupon Code Tracking:

Create a coupon code in Stripe and assign it to the relevant affiliate in Tapfiliate.​

In your conversion event, add coupon info:

tap('conversion', 'STRIPE_CHARGE_ID', CONVERSION_AMOUNT, {"coupons": "COUPON_ID"});

Ensure that you pull the coupon ID from stripe via :
https://docs.stripe.com/api/coupons/object
and it matches the affiliate’s Tapfiliate profile; otherwise, the conversion won’t be tracked.​

Refunds & Disputes:

Refunds and disputes are automatically handled if Stripe is properly connected and the right transaction IDs are provided.​

How to Test and Verify Integration

To test the integration after completing the steps above, follow the steps below:

1. Create a test affiliate

2. Use affiliate’s referral link/coupon code and follow the user journey.

3. Check if the click and conversion got successfully tracked in the system.

4. Follow the troubleshooting guide if the clicks and conversions are not tracking.

Still need help?

If you have any questions or if something in this guide is unclear, please don't hesitate to contact us at support@tapfiliate.com. We're happy to assist!

Did this answer your question?