Stripe Web Transactions

Track commission on purchases made through Stripe Checkout and subscriptions on your website - not just in-app purchases.

When you enable Stripe Web Payments in your settings, you can track web transactions alongside your mobile purchases.

What You Can Track

Once configured, Insert Affiliate automatically tracks:

  • Stripe Checkout purchases (one-time and subscription)
  • Initial subscription purchases
  • Subscription renewals

Setup Guide

Step 1: Enable Web Payments

  1. Go to Settings → Web Transactions
  2. Change Web Transaction Method from "Disabled" to "Stripe Web Payments"
  3. Click "Save Settings"

Step 2: Set Up Stripe Connect

Before you can track web transactions, you must connect your Stripe account:

  1. Go to Settings → Stripe Connect
  2. Click "Connect with Stripe"
  3. Complete the Stripe onboarding process:
    • Log in to your existing Stripe account, OR
    • Create a new Stripe account
    • Provide required business information
    • Submit verification documents (if requested)
  4. You'll be redirected back to Insert Affiliate once complete

Status indicators:

  • Active: Your Stripe account is fully connected and ready
  • Restricted: Additional information needed - click "Continue Onboarding"
  • Pending: Documents under review (usually 1-2 business days)

That's it! Web transaction tracking is now active.


Implementation: Passing Affiliate Codes

When creating a Stripe Checkout session, include both required fields in all three metadata locations to ensure proper tracking:

const session = await stripe.checkout.sessions.create({
  line_items: [
    {
      price: 'price_1234',
      quantity: 1,
    },
  ],
  mode: 'subscription',
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
  // 1. Session metadata (available in checkout.session.completed event)
  metadata: {
    insertAffiliate: insertAffiliate || '',
    insertAffiliateCompanyId: insertAffiliateCompanyId || '',
  },
  // 2. Subscription metadata (persists with subscription)
  subscription_data: {
    metadata: {
      insertAffiliate: insertAffiliate || '',
      insertAffiliateCompanyId: insertAffiliateCompanyId || '',
    },
  },
  // 3. Payment Intent metadata (available on each payment)
  payment_intent_data: {
    metadata: {
      insertAffiliate: insertAffiliate || '',
      insertAffiliateCompanyId: insertAffiliateCompanyId || '',
    },
  },
});

Required Metadata Fields

Both of the following fields are required for proper affiliate attribution:

  • insertAffiliate - The affiliate's short code (identifier)
  • insertAffiliateCompanyId - Your Insert Affiliate company ID

These fields must be passed in all three metadata locations (session, subscription, and payment intent) to ensure Insert Affiliate can properly track and attribute payments.


How to Get the Required Values

You need to retrieve both values from the Insert Affiliate SDK. Refer to your platform's SDK documentation for specific implementation details.

Getting the Affiliate Identifier

The affiliate identifier can come from multiple sources:

  • Deep linking: When a user clicks an affiliate link, capture the identifier through your deep linking platform
  • Short code: Users can manually enter or apply an affiliate short code

View JS SDK documentation →

Getting the Company ID

Your Insert Affiliate company ID is also required.

View JS SDK documentation →

Passing to Your Backend

Send both values to your backend when creating checkout sessions:

const response = await fetch('/create-checkout-session', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    priceId: 'price_1234',
    insertAffiliate: affiliateId,
    insertAffiliateCompanyId: companyId,
    successUrl: window.location.origin + '/success',
    cancelUrl: window.location.origin + '/cancel',
  }),
});

Testing Your Setup

Important Note About Testing

Insert Affiliate currently runs on a production Stripe Connect instance only. This means:

  • You cannot use Stripe's test mode or test card numbers
  • You must use real payment methods for testing
  • Recommended workaround: Create a promo code in your Stripe Dashboard to make test transactions free or very low cost (e.g., $0.01)

Testing Steps

  1. Enable Stripe Web Payments in your settings
  2. Connect your Stripe account via Stripe Connect
  3. (Optional but recommended) Create a promo code in your Stripe Dashboard for 100% off or a minimal amount
  4. Make a real purchase with both required fields (insertAffiliate and insertAffiliateCompanyId) in the metadata
  5. Apply your promo code if you created one
  6. Check your transactions dashboard to confirm the transaction appears

Troubleshooting

Transactions Not Showing Up

Check these common issues:

  • Stripe Connect status: Verify your Stripe account shows as "Active" in settings
  • Web Payments enabled: Confirm "Stripe Web Payments" is selected in settings
  • Required metadata fields: Confirm you're passing both insertAffiliate and insertAffiliateCompanyId in all three metadata locations (session, subscription_data, payment_intent_data)
  • SDK initialization: Ensure the Insert Affiliate SDK is properly initialized and returning valid values for both fields

What Happens Next

Once configured:

  1. Purchases with affiliate metadata automatically create commission records
  2. View all transactions in your dashboard
  3. Configure commission rates per affiliate
  4. Set up payment methods to pay your affiliates

Need Help?

If you encounter any issues during setup, contact support and we'll help you get configured.