Skip to main content
Version: 2019-05-29 (Current)

Delete a Card

Permanently remove a card from a customer's account. This action is irreversible.


๐Ÿ”‘API Credentials

Request Parametersโ€‹

Required - 2 fieldsPath Parameters
โ–ผ
`id`STRING(required)
Customer ID (must be a valid customer ID starting with cust_).
Example:"cust_test_5xuy4w91xqz7d1w9u0t"
Constraints:Must be a valid customer ID
`card_id`STRING(required)
Card ID to delete (must be a valid card ID starting with card_).
Example:"card_test_5xuy4w91xqz7d1w9u0t"
Constraints:Must be a valid card ID, Card must belong to the customer

Responsesโ€‹

200

Card deleted successfully

Card permanently removed from customer account.

Deletion effects:
  • Card is permanently removed from customer
  • Card details are no longer accessible
  • Card cannot be used for future charges
  • Past charges remain in records but card field becomes null
  • If this was the default card, customer's default_card becomes null
  • Deletion cannot be undone

400

Bad request

Invalid customer ID or card ID format.

Common causes:
  • Invalid ID format
  • IDs do not start with cust_ or card_

401

Unauthorized

Authentication 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 found

Customer or card not found.

Common causes:
  • Customer ID does not exist
  • Card ID does not exist
  • Card does not belong to the specified customer
  • Card has already been deleted

Code samplesโ€‹

curl https://api.omise.co/customers/cust_test_5xuy4w91xqz7d1w9u0t/cards/card_test_5xuy4w91xqz7d1w9u0t \
-X DELETE \
-u skey_test_5xuy4w91xqz7d1w9u0t:

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
bad_requestInvalid ID formatCheck customer and card ID formats
authentication_failureInvalid API keyVerify your secret key is correct
not_foundCustomer or card not foundVerify IDs exist and card belongs to customer
conflictCannot delete card in useWait for pending charges to complete

Deletion Responseโ€‹

FieldDescription
objectObject type (always "card")
idID of the deleted card
deletedBoolean flag (always true for successful deletions)
livemodeWhether this was a live mode card

Try it outโ€‹

Required - 2 fields
โ–ผ