Skip to navigation

Create a customer

In this quickstart you record a company you bill as a customer in Paid, in a sandbox organization, where nothing is ever charged. Every invoice, event and order in Paid belongs to a customer, so they are the first thing an integration sets up.

Litware runs an AI support agent and has just signed Northwind Traders. By the end, Litware will have:

  1. Northwind Traders as a customer, named by Litware’s own ID
  2. a way to look it up, change its details, and page through every customer on the account

Before you start

  • Set up your account: a sandbox organization and an API key starting paid_sk_test_, exported as PAID_API_KEY.
  • Make your first request: check that the key works.
  • Have curl to hand. Paid’s SDKs don’t support api.paid.ai/v1 yet, so the steps below call it over HTTP.

1. Create a customer

Customers are in the customers=v1 beta: send Paid-Beta: customers=v1 with each customer request.

Create a customer for Northwind Traders with its billing details, which Paid shows on invoices and uses for tax. externalId is Litware’s own ID for the company, from its CRM. Every write also sends an Idempotency-Key, so retrying it after a timeout can never create two customers. Save the request body from the API tab below as northwind.json, then send it:

curl https://api.paid.ai/v1/customers \
-H "Authorization: Bearer $PAID_API_KEY" \
-H "Paid-Version: 2026-11-01" \
-H "Paid-Beta: customers=v1" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d @northwind.json

From here on, each step shows only the method, path and body. Send the same headers with each one.

{
"externalId": "northwind",
"name": "Northwind Traders",
"legalName": "Northwind Traders Ltd",
"email": "billing@northwind.example",
"currency": "usd",
"address": {
"line1": "1 Harbour Street",
"city": "London",
"postalCode": "E1 8AA",
"country": "GB"
},
"taxIds": [{ "type": "gbVat", "value": "GB123456789" }]
}

livemode is false because the customer is in a sandbox organization. Store the cus_ ID where you can: it never changes. externalId is unique on your account, so creating a second customer with northwind returns 409 resource_exists.

2. Look a customer up

Anywhere the API asks for a customer, it takes Paid’s cus_ ID or your externalId, so a service that only knows Litware’s CRM ID never needs to store Paid’s. Retrieve the customer by its externalId:

curl https://api.paid.ai/v1/customers/northwind \
-H "Authorization: Bearer $PAID_API_KEY" \
-H "Paid-Version: 2026-11-01" \
-H "Paid-Beta: customers=v1"

The response is the same customer object the create returned.

3. Keep its details current

When Northwind changes its billing contact, update the customer. Send only the fields that change:

PATCH /v1/customers/northwind
{
"email": "finance@northwind.example",
"metadata": { "crmOwner": "dana" }
}

The response is the whole customer with the new email. metadata holds your own key-value pairs; Paid stores them and never acts on them.

4. List your customers

List customers to sync them with your CRM. Lists return the newest customers first, a page at a time, and filters narrow them, such as email:

curl -G https://api.paid.ai/v1/customers \
-H "Authorization: Bearer $PAID_API_KEY" \
-H "Paid-Version: 2026-11-01" \
-H "Paid-Beta: customers=v1" \
--data-urlencode "limit=100"

The response is a list object with the customers in data. When hasMore is true, send its nextCursor as cursor to get the next page. Read Pagination for a loop that reads every page.

5. Archive a customer

When a company stops being your customer, archive it. The request has no body:

An archived customer stays readable and on its invoices, and keeps its externalId reserved, but can’t be put on new orders. Lists leave it out unless you pass includeArchived=true. Archiving fails while the customer still has an active order.

Next steps