Delete a Customer
Permanently delete a customer and all associated cards from your account. This action is irreversible and should be used carefully.
API Credentials
Request Parametersโ
Required - 1 fieldRequired Parameters
`id`STRING(required)
Customer ID to delete (must be a valid customer ID starting with cust_).
Responsesโ
200
Customer deleted successfullyCustomer and all associated cards permanently deleted.
Deletion effects:
- Customer profile is permanently removed
- All associated cards are deleted
- Customer metadata is permanently removed
- Past charges remain in records but customer field becomes null
- Deletion cannot be undone
400
Bad requestInvalid customer ID format.
Common causes:
- Customer ID format is invalid
- ID does not start with cust_
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
- Incorrect HTTP Basic Auth format
404
Not foundCustomer not found.
Common causes:
- Customer ID does not exist
- Customer has already been deleted
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/customers/cust_test_5xuy4w91xqz7d1w9u0t \
-X DELETE \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
customer = Omise::Customer.destroy('cust_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
customer = omise.Customer.retrieve('cust_test_5xuy4w91xqz7d1w9u0t')
customer.destroy()
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const customer = await omise.customers.destroy('cust_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$customer = OmiseCustomer::retrieve('cust_test_5xuy4w91xqz7d1w9u0t');
$customer->destroy();
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Customer customer = client.customers().destroy("cust_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var customer = await client.Customers.Destroy("cust_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
deleted, _ := client.Customers().Destroy("cust_test_5xuy4w91xqz7d1w9u0t")
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
bad_request | Invalid customer ID format | Check ID format |
authentication_failure | Invalid API key | Verify your secret key is correct |
not_found | Customer not found | Verify customer ID exists |
conflict | Customer has active subscriptions | Cancel subscriptions before deleting |
Deletion Responseโ
| Field | Description |
|---|---|
object | Object type (always "customer") |
id | ID of the deleted customer |
deleted | Boolean flag (always true for successful deletions) |
livemode | Whether this was a live mode customer |
Try it outโ
Required - 1 fields