VectleSkillsStripe error "No such customer" when creating an invoice via API

Stripe error "No such customer" when creating an invoice via API

Export

Diagnoses the Stripe No such customer error when creating invoices through the API. Use when an invoice create call fails because the customer id is wrong, belongs to another account, or is a test-mode id used in live mode. Not for payment-method or tax errors.

TL;DR

No such customer almost always means the customer id is wrong: a typo, an id from the wrong Stripe account, or a test-mode id sent to live mode (or vice versa). Re-fetch the customer from your own database, confirm you are using the right mode keys, and recreate the invoice with the corrected id.

Error

```text
No such customer: 'cus_1Ab2Cd3Ef4Gh5Ij'

## Steps

1. Log the exact customer id your code sent and compare it against the customer record in your database.
   Expected: You see whether the id is mistyped, stale, or missing.
2. Check which API key mode you are running: test keys only see test customers, live keys only see live customers.
   Expected: Mode mismatch is confirmed or ruled out in one check.
3. Search the customer id in the Stripe dashboard with the same mode toggle as your request.
   Expected: The customer either exists (id typo) or does not (wrong account or mode).
4. If the customer lives in a different Stripe account (platform vs connected account), pass the right account context on the request.
   Expected: The invoice create call now targets the account that owns the customer.
5. Store the Stripe customer id next to your user record and validate it before every invoice create.
   Expected: Repeat calls stop failing with No such customer.

## When to use

- Invoice create fails with No such customer
- You are juggling test and live mode keys
- You work with connected accounts or multiple Stripe accounts

## When not to use

- The error names a payment method or price id instead
- The customer was deleted on purpose (you need a new customer object)
- You are creating the customer in the same call (check the create response first)

## Compatibility

All Stripe API versions; REST and all official SDKs (Node, Python, Ruby, PHP, Java, Go, .NET). Mode rules identical across SDKs.

## Variant phrasings

### ### No such customer test mode vs live mode

### ### No such customer on connected account

### ### Stripe customer id not found

## Root cause

Stripe scopes every object to one account and one mode. The API resolves the customer id in the account/mode implied by your secret key; anything else 404s with No such customer even though the id looks valid.

## Edge cases

- Deleted customers also raise No such customer, so a formerly-valid id can start failing
- Copying ids between dashboard and code invites whitespace or truncation errors
- Archived customers are gone too; recreate rather than restore

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_1yoKBVNQ3JzQ2JwtyKy7DA

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 5, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 3, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=Stripe+error+%22No+such+customer%22+when+creating+an+invoice+via+API&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.