Skip to content

Stripe guide

Refenue reads payments from your Stripe account to credit partners. You connect it once per mode (test and live) with a restricted key, a Stripe key that can only do what you allow.

Create the restricted key

  1. In Stripe, open Developers → API keys and click Create restricted key. Do this in test mode for your test connection and in live mode for live.
  2. Name it "Refenue" and set these permissions, leaving everything else as None:
ResourceAccessWhy
ChargesReadEach payment and refund
CustomersReadThe customer's email, to match payments to signups
Checkout SessionsReadThe referral you passed to Checkout
SubscriptionsReadRenewals and cancellations
Webhook EndpointsWriteSo Refenue can add its own webhook
  1. Create the key and paste it in Developers → Stripe in the Refenue dashboard.

Refenue checks the key's permissions, stores it encrypted, and adds a webhook endpoint to your Stripe account. If a permission is missing, it tells you which.

What Refenue does with each event

Stripe eventWhat happens
checkout.session.completedLinks the Stripe customer to the partner, using the referral or the email. Works for guest checkouts too
charge.succeededRecords one sale per charge and creates the commission
charge.refundedReduces the commission in step with the refund
charge.dispute.createdReverses the commission and flags it
customer.subscription.created, .updated, .deletedTracks the subscription's status

Every event is stored by its ID before it's processed, and a sale is unique per charge, so a webhook Stripe sends twice never creates two sales. Developers → Stripe events shows the latest events and what Refenue did with each.

How a payment is matched to a partner

The first rule that matches wins:

  1. The Stripe customer is already linked to a partner, from an earlier payment.
  2. A referral id in the customer's metadata (refenue_referral).
  3. A referral id in the Checkout session's metadata or client_reference_id.
  4. The customer's email equals the email of a lead from refenue.signup().

Once a customer is linked, every renewal follows the same partner for as long as the commission rule lasts. Only a team member can move a customer to another partner.

Someone who never clicked a partner link, or who was already a customer, is never credited to a partner.

Amounts and currencies

Commissions are calculated on the charge amount, after discounts and before tax, in the charge's currency.

Refunds and disputes

  • Full refund before the commission is paid: the commission is reversed.
  • Partial refund, or any refund after it was paid: a negative adjustment comes off the partner's next payout.
  • Dispute: the commission is reversed and flagged for you.

Test mode

Connect a test-mode restricted key (rk_test_...) while the dashboard is in test mode. Test payments with cards like 4242 4242 4242 4242 then create test commissions, and nothing touches live data or your plan's usage.

Disconnecting

Disconnect in Developers → Stripe removes Refenue's webhook from your Stripe account and deletes the stored key. You can also delete the restricted key in Stripe at any time; Refenue stops receiving events straight away.