Feature

Custom API Integration

Integrate any payment processor with our simple API. Paddle, Lemon Squeezy, Gumroad, Polar, Razorpay, or your own custom solution — if it has webhooks, it works with Revshare.

POST /api/referral
await fetch("/api/referral", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY",
  },
  body: JSON.stringify({
    ref_code: "affiliate123",
    program_id: "prog_xxx",
    spent_amount: 4900,
    currency: "USD",
    transaction_id: "order_123",
    customer_id: "cust_456",
  }),
});

Works with any payment provider

StripeStripe
PaddlePaddle
Lemon SqueezyLemon Squeezy
GumroadGumroad
PolarPolar
DodoDodo
RazorpayRazorpay

How It Works

A simple 4-step process to track affiliate sales from any payment provider

1

Visitor clicks link

Affiliate shares yoursite.com?ref=code

2

Script saves ref

Our script stores the ref in cookies

3

Customer pays

Payment provider sends you a webhook

4

Call our API

Your webhook handler calls Revshare

API Reference

POSThttps://www.revshare.so/api/referral

Headers

Content-Typeapplication/json
x-api-keyYour API key from the dashboard

Request Body

ref_code
stringrequired

The affiliate's referral code

program_id
stringrequired

Your program ID

spent_amount
integerrequired

Sale amount in cents (e.g., 4900 = $49.00)

transaction_id
stringrequired

Unique transaction ID (prevents duplicates)

currency
string

Currency code (defaults to USD)

customer_id
string

Customer ID for recurring revenue tracking

Example: Paddle Webhook

Here's how to integrate with Paddle. The same pattern works for Lemon Squeezy, Gumroad, or any provider with webhooks.

1

Pass ref_code to checkout via custom_data

2

Set up a webhook endpoint

3

When payment succeeds, call our API

4

We handle commission tracking

/api/paddle-webhook
// Next.js example
export async function POST(req) {
  const event = await req.json();
  
  if (event.event_type === 
      'transaction.completed') {
    const { custom_data, details } = 
      event.data;
    
    if (custom_data?.ref_code) {
      await fetch(
        'https://revshare.so/api/referral',
        {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'x-api-key': process.env.API_KEY,
          },
          body: JSON.stringify({
            ref_code: custom_data.ref_code,
            program_id: custom_data.program_id,
            spent_amount: details.totals.total,
            transaction_id: event.data.id,
          }),
        }
      );
    }
  }
  
  return Response.json({ ok: true });
}

Ready to integrate your payment provider?

Our API works with any payment processor. Get your API key and start tracking in minutes.