If you’re using a payment provider (e.g. WooCommerce, GoHighLevel) and not Stripe directly, please refer to other integrations.

After signing up and selecting Stripe as your payment provider, you need to do a few things before you can start using Afficone.

  1. Connect your Stripe Account

After signing up selecting Stripe as your payment provider, click the Connect with Stripe button. This will lead you to a Stripe-hosted page where you can select the Stripe Account you want to use for this integration.

In order to track your orders and subscriptions as well as handle refunds, Afficone will receive a few webhook events when something happens on your Stripe account. More specifically charge.refundedinvoice.paid and checkout.session.completed.
  1. Install our tracking script on your website

In order to track affiliate clicks, you have to add our <script> tag to all of your website’s pages.

For example, if you have a landing page at example.com, but your billing page is at app.example.com, you have to add the script to both of these pages.

Installation

Add the Afficone tracking script to your website.

  1. Integrate your Stripe’s payment system

Depending on how you handle payments on your side, you might have to add some additional code on your backend.

If you’re using client-based Stripe checkouts, you have to add the clientReferenceId property to your checkout configuration.

<script src="https://js.stripe.com/v3/"></script>

stripe.redirectToCheckout({
    success_url: 'https://example.com/success',
    mode: 'payment' | 'setup' | 'subscription',
    line_items: [
        // The items being purchased
    ],
    clientReferenceId: window.Afficone.referral ?? null
});

Offering free trials?

If you’re creating Stripe customers via API (that’s usually the case when offering a free trial), you have to set some customer metadata manually.

This is done by specifying an _afficoneRef property in the metadata object when creating a customer:

const stripe = require('stripe')('[Your API key]');

const customer = await stripe.customers.create({
   metadata: {
       _afficoneRef: '[Referral Code]',
   }
});

You can pass the referral code from the browser to your backend - it’s located in window.Afficone.referral.