Delete Customer
Delete Customer Mutation
Deletes an existing customer entity from the system.
Arguments
id
ID!
The ID of the customer to delete
Return Type
CustomerDeletePayload! - Confirmation of the delete operation.
Return Fields
CustomerDeletePayload:
deletedID
ID
The ID of the deleted customer
Usage Example
mutation {
deleteCustomer(id: "cust_123456789") {
deletedID
}
}JavaScript Example
Important Considerations
Soft vs Hard Delete
The pyck system implements soft deletes by default, meaning:
The customer record is marked as deleted (
deletedAttimestamp is set)The customer data remains in the database for audit purposes
The customer will not appear in normal queries
Related data (orders, transactions) remains intact
Data Integrity
Before deleting a customer, consider:
Active Orders: Check if the customer has pending or active orders
Outstanding Invoices: Verify all invoices are settled
Related Records: Consider impact on order history, payments, and analytics
Audit Requirements: Ensure deletion complies with business audit needs
Permissions
Customer deletion typically requires:
Administrative privileges
Proper authorization for the tenant/organization
Compliance with data retention policies
Error Scenarios
The mutation may fail in these cases:
Not Found: Customer ID doesn't exist
Permission Denied: Insufficient privileges to delete customers
Constraint Violations: Customer has dependent records that prevent deletion
Business Rules: Custom business logic prevents deletion
Best Practices
Confirmation: Always confirm deletion with users before executing
Backup: Consider exporting customer data before deletion
Audit Trail: Log deletion operations for compliance
Bulk Operations: For multiple deletions, implement proper error handling
Related Cleanup: Plan for cleanup of related customer data if needed
Alternative Approaches
Instead of deletion, consider:
Deactivation: Mark customer as inactive rather than deleting
Archiving: Move old customers to an archived status
Data Anonymization: Remove personal data while keeping transaction history
Last updated
Was this helpful?
