Skip to main content

Track payments with Tolt's API

Credit partners when you bill with another payment provider or your own checkout.

Written by Nick

If you don't bill with Stripe, Paddle or Chargebee, send payments to Tolt yourself. The tracking script records the click and the sign-up in the browser, and your server sends each payment to Tolt's API. Tolt then credits the partner and runs your flows.

Before you start

Add the tracking script to every page of your website and app. See Add the tracking script to your site.

Set it up

  1. When someone creates an account, call tolt.signup() with their email and save the customer_id it returns on your user. See Track sign-ups as leads.

  2. Go to Settings › API keys, click Create API key and store the key on your server.

    API keys page with the public key and the Create API key button
  3. Each time a referred customer pays, send the payment to Tolt from your server with that customer_id. This TypeScript example uses Tolt's SDK:

    await tolt.transactions.create({
    customer_id: "cus_123",
    amount: 4900,
    charge_id: "ch_123",
    });

    amount is in the smallest currency unit, so 4900 is $49.00. Send a unique charge_id with every payment, so a retried request isn't counted twice.

Tolt now records each payment as a transaction, and your flows create commissions for the partner.

Good to know

  • Keep your API key secret. Never put it in client-side code or a public repository. The Public key on the same page is the one that's safe in the browser.

  • Don't send payments through the API that a Stripe, Paddle or Chargebee integration already records, or commissions count twice.

  • No browser involved, such as a mobile app or a sales-led deal? You can record clicks and customers through the API too. See Server-side tracking.

  • For developers: Record payments has examples in TypeScript, Python and cURL, and covers refunds and how to look up a customer.

Did this answer your question?