Skip to main content
POST
cURL
Use this when you move existing Stripe billing to Ledger: it’s the first step of Migrate from Stripe Billing. Pass the exact customerId as a URL-encoded query value and the customer’s stripeCustomerId from your Stripe account. Create the customer first with Create or get a customer. Ledger checks that the Stripe customer exists in the Stripe account connected for the key’s environment (Sandbox or Live), adds ledger_organization_id, ledger_customer_id and ledger_env to its metadata, and saves the link. It changes nothing else on the Stripe customer and charges nothing. After linking, Checkout and upgrades use this Stripe customer and its saved cards. A Sandbox customer on a test clock brings the clock’s time with it. Linking the same Stripe customer again changes nothing. The call returns 409 stripe_customer_already_linked when the customer is linked to a different Stripe customer, 409 stripe_customer_linked_elsewhere when another of your customers has this one, and 409 stripe_customer_owned_elsewhere when its metadata names another Ledger workspace or environment. Unknown customers return 404 customer_not_found; a Stripe customer that doesn’t exist or was deleted returns 404 stripe_customer_not_found. The key needs the customers:write permission.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

customerId
string
required
Required string length: 1 - 255

Body

application/json
stripeCustomerId
string
required

The customer's existing Stripe customer, in the Stripe account connected for this environment.

Maximum string length: 255

Response

The customer is linked to the Stripe customer

customerId
string
required
stripeCustomerId
string
required