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
- 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.
- Name it "Refenue" and set these permissions, leaving everything else as None:
| Resource | Access | Why |
|---|---|---|
| Charges | Read | Each payment and refund |
| Customers | Read | The customer's email, to match payments to signups |
| Checkout Sessions | Read | The referral you passed to Checkout |
| Subscriptions | Read | Renewals and cancellations |
| Webhook Endpoints | Write | So Refenue can add its own webhook |
- 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 event | What happens |
|---|---|
checkout.session.completed | Links the Stripe customer to the partner, using the referral or the email. Works for guest checkouts too |
charge.succeeded | Records one sale per charge and creates the commission |
charge.refunded | Reduces the commission in step with the refund |
charge.dispute.created | Reverses the commission and flags it |
customer.subscription.created, .updated, .deleted | Tracks 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:
- The Stripe customer is already linked to a partner, from an earlier payment.
- A referral id in the customer's metadata (
refenue_referral). - A referral id in the Checkout session's metadata or
client_reference_id. - 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.