Using AI coding agents like Claude Code or Cursor? Try the official Chargebee Agent Skills to speed up your development.Try now
ChargebeeAPI

Delete a payment source

Idempotency Supported

Deletes a payment source. Once the payment source is deleted, if

  • Deleted payment source is Primary, and Backup is available
    • The Backup payment source will become the Primary payment source.
  • Deleted payment source is Primary, and no Backup is available
    • The other payment source available, but not assigned to any subscription, will become the Primary payment source.

      Note: When multiple payment sources exist, the payment method added most recently will be considered.

    • If other payment sources available are assigned to subscriptions, the auto collection attribute for the customer will be set to Off, and the events card_deleted and payment_source_deleted will be triggered.

  • Deleted payment source is attached to subscriptions
    • Dunning will be initiated for subscriptions attached to this payment source if auto collection is set to On, and when no customer default is present.

If there is no such payment source present in the gateway for the customer, this API will return successfully without throwing any error.

Sample Request

Sample Result[JSON]

URL Format

POST https://[site].chargebee.com/api/v2/payment_sources/{cust-payment-source-id}/delete

Returns

Customer object
Resource object representing customer
Payment source object
Resource object representing payment_source