Narayan Subedi
Narayan Subedi

Reputation: 1343

Problem creating customer in Stripe which was deleted earler

I have created customer with specific UUID via Stripe SDK in Java. I have deleted the customer from stripe dashboard and I am trying to create Customer with same UUID again. But Stripe create API returns error saying : An error occurred: com.stripe.exception.InvalidRequestException: Customer already exists.; code: resource_already_exists; request-id: req_ijx6XztFJpbl9M, but while creating subscription for same UUID, API returns : com.stripe.exception.InvalidRequestException: No such customer: <uuid>; code: resource_missing; request-id: req_WGL7FhMKf47uh6

Any help is appreciated. Thanks

Upvotes: 3

Views: 2877

Answers (1)

Nolan H
Nolan H

Reputation: 7419

Customers are soft-deleted as noted in the API docs: https://stripe.com/docs/api/customers/delete

You cannot create a new customer with the same ID after deletion -- the error is correct. You can still retrieve the deleted customer directly, and you'll find it has deleted=true.

Using custom IDs is not recommended. If you're trying to align with internal IDs, using metadata is the suggested approach, and maintain the mapping to the Stripe-generated IDs in your system.

Upvotes: 6

Related Questions