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

Update a card payment source

Idempotency Supported

Merchants look to update card details when:

  • The billing address of a customer has changed. In such a case, modify the billing address in the Chargebee and the payment gateway.
  • The expiration date of the card has been extended by the bank. (This usually happens when the date of card expiry is in near future).

Multiple parameters such as address, expiry date, month, and so on, can be updated through this API.

Meta data can also be added additionally(supported in Stripe only). Metadata is a JSON object. It is used to store additional information about customers.

In Stripe and Braintree payment gateways, changes in card details are auto-updated. This feature can also be used for other payment gateways in which auto-update is not enabled or is not supported by Chargebee.

Sample Request

Sample Result[JSON]

URL Format

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

Input Parameters

gateway_meta_data
optional, jsonobject

Additional data about this resource can be passed to Stripe gateway here in the JSON Format. This will be stored along with payment source at the gateway account.

reference_transaction
optional, string, max chars=50

Reference transaction is used for future purchases. This is only applicable for Vantiv.

card
Parameters for card
pass parameters as card[<param name>]

Returns

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