> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revenuebee.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting up your data

> Send customers from your database, from Stripe, Paddle or Shopify, or both.

Pick the one that matches how you work.

## Stripe, Paddle or Shopify only

Connect Stripe, Paddle or Shopify in the CRM. Your customers there show up on their own.

## Your database only

Send each customer with [`contacts.upsert`](https://docs.revenuebee.ai/sdk/upsert-contact).

Then send what they do and pay, so the CRM knows them as well as you do: [events](https://docs.revenuebee.ai/sdk/add-event.md), [subscriptions](https://docs.revenuebee.ai/sdk/subscriptions.md), [payments](https://docs.revenuebee.ai/sdk/payments.md), [notes](https://docs.revenuebee.ai/sdk/notes.md) and [conversations](https://docs.revenuebee.ai/sdk/communications.md). See everything in the [SDK](https://docs.revenuebee.ai/sdk/client.md) or the [API reference](https://docs.revenuebee.ai/api-reference/introduction.md).

## Both

Stripe often sends a customer before you do. Once you know their Stripe id, link them. For Paddle use `type: "paddle"` with their `ctm_` id, for Shopify `type: "shopify"` with their numeric id:

> [tab] Upsert
>
> ```ts theme={null}
> // your customer, created the first time, found every time after
> const [contact, contactError] = await crm.contacts.upsert({
>   dbId: user.id,
>   name: user.name,
>   emails: [user.email],
> });
> if (contactError) throw new Error(contactError.message);
>
> // link their Stripe customer to them
> const [linked, linkError] = await crm.externalAccounts.add({
>   partyId: contact.id,
>   type: "stripe",
>   value: user.stripeCustomerId, // e.g. "cus_123"
> });
> if (linkError) throw new Error(linkError.message);
> ```

> [tab] Look up
>
> ```ts theme={null}
> // the customer you already sent, found by your own id
> const [found, lookupError] = await crm.contacts.resolve({ dbId: user.id });
> if (lookupError) throw new Error(lookupError.message);
>
> // link their Stripe customer to them
> const [linked, linkError] = await crm.externalAccounts.add({
>   partyId: found.partyId,
>   type: "stripe",
>   value: user.stripeCustomerId, // e.g. "cus_123"
> });
> if (linkError) throw new Error(linkError.message);
> ```

> [tab] Saved id
>
> ```ts theme={null}
> // the contact.id you saved in your own database the first time
> const [linked, linkError] = await crm.externalAccounts.add({
>   partyId: user.crmPartyId,
>   type: "stripe",
>   value: user.stripeCustomerId, // e.g. "cus_123"
> });
> if (linkError) throw new Error(linkError.message);
> ```

**Upsert** creates the customer if they're new. **Look up** finds one you've already sent. **Saved id** is fastest: store `contact.id` in your own database the first time, and skip the extra call.

They become one customer, and nothing is lost.

## Good to know

* **Your details win.** Stripe, Paddle and Shopify never rename a customer you've sent.
* **Your own customers are never merged.** Linking a Stripe, Paddle or Shopify id that another of your customers already has fails with `conflict`.
* **A shared email never merges anyone.** Two people can use the same address.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.