> For the complete documentation index, see [llms.txt](https://refkit.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://refkit.gitbook.io/docs/integrate-refkit/stripe.md).

# Connect Stripe

Use Stripe when RefKit should receive payments and refunds from your Stripe account.

## 1. Connect the correct mode

Choose Stripe in Setup or **App > Billing**, then connect:

* Stripe test mode while testing.
* Stripe live mode for production payments.

The two connections are separate.

## 2. Identify before checkout

Complete [capture and identify](/docs/integrate-refkit/manual-setup.md) before creating the Stripe object used for billing.

`POST /v1/identify` returns:

```json
{
  "stripe_metadata": {
    "refkit_click_id": "clk_...",
    "refkit_customer_id": "rcus_...",
    "refkit_program_id": "prg_..."
  }
}
```

Attach these exact values to the relevant Stripe Customer, Checkout Session, PaymentIntent, or Subscription.

Do not assume Stripe copies metadata between related objects. Add it to the objects your billing flow creates.

## 3. Let Stripe report revenue

Do not call `/v1/transactions`, `/v1/transactions/refunds`, or `/v1/transactions/disputes` for a Stripe App. RefKit receives those events through the connected Stripe App.

## Verify

Open a test affiliate link, create a new Customer, and complete a Stripe test-mode payment with a positive commissionable amount.

The setup checklist should show:

1. Test affiliate link opened.
2. Test signup matched.
3. Test payment received.
4. Test commission created.

If the payment appears without a commission, check the metadata and call order in [Troubleshooting](/docs/integrate-refkit/troubleshooting.md).
