Integrating with Stripe

Out-of-the-box features:
  • Conversion tracking
  • Commission based on order amount
  • Supports lifetime commissions
  • Auto-handle recurring commissions
  • Auto-handle refunds and disputes
  • Track order currency
  • Automatically add new customers as affiliate prospects
  • Per category commissions
  • Adds an affiliate recruitment action
  • Track affiliate coupon code conversions

This guide describes how to install Tapfiliate in custom-made websites that have a direct integration with Stripe. You may require a developer to help you integrate.

If you use Stripe through a shopping cart like Shopify, or in a different platform, please follow the guide for the appropriate platform instead.

This guide includes instructions for two kinds of setups:

  • Immediate purchase: Useful for e-commerce, subscription boxes and other subscription services without a free trial.
  • Sign up first, purchase later: Useful for e.g. SaaS and lead-generation businesses.

Both setups can be configured to automatically support recurring/lifetime commissions, by connecting your Stripe account. Automatic handling of refunds and disputes is also supported. Automation features hinge on the use of the values mentioned in this guide: The Stripe Customer ID (starting in cus) and the Stripe Charge ID (starting in ch). Any other value will not work.

For both setups, please first add the following code in the <head> of every page of your website:

  <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>

{{{{NO_ACCOUNT_ID_SET_MESSAGE}}}}

Option 1: Immediate purchases

On your thank you page, add the following code:

  <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>

Have your developer replace [[[[STRIPE CUSTOMER ID]]]] and [[[[STRIPE CHARGE ID]]]] placeholders with the respective Stripe values for current customer and charge. These two values can be found in your Stripe account. Once a sale is made, go to your Stripe account, go to Payments> Choose a sale from the list> Scroll down to Connections> Check the value starting with ‘ch_…‘. This is your Stripe Charge ID.
Stripe charge ID
Then, you’ll have to go to the Customers section, here you will choose a sale once again and click on the customer to view the details. In the framed section, you’ll see a value starting in ‘cus_..‘. This is your Stripe Customer ID.Stripe customer ID{{{{NO_ACCOUNT_ID_SET_MESSAGE}}}}

[[[[ORDER AMOUNT]]]] would be the total value of the conversion. We use this value to calculate any percentage-based commissions you might have set up for your program. Be aware you also need to replace the placeholder text in the code by the actual tag or variable that passes this data, dinamically injecting a new value on each transaction.

Option 2: Sign up first, purchase later

On your thank you page, add the following code:

  <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>

Have your developer replace the [[[[STRIPE CUSTOMER ID]]]] placeholder with the Stripe customer id of the current customer. {{{{NO_ACCOUNT_ID_SET_MESSAGE}}}}
If you struggling with Charge_ID and Customer_ID dynamic values, feel free to guide your developer to Stripe API documentation:
- Stripe Customer object
- Stripe Charge object

Note: To track future recurring/lifetime payments, enable Lifetime/recurring commissions in your commission structure page.

Last step: Connect with Stripe

Tapfiliate has a direct integration with Stripe that adds out-of-the-box automation features. After following the guide above you can connect your Stripe account by clicking the button, logging in and pressing the "+Connect" button:

Connect account now

Important

Please remember to test a conversion before starting your program. This way you can verify that tracking has been set up correctly. You can create a test conversion by following the steps described here.

Start a 14-day free trial with all our features enabled