When you collect a customer’s payment information, a Stripe token is created. This token can only be used once, but that doesn’t mean you have to request your customer’s card details for every payment.
Saving credit card details for later
To make a card available for later charging, including subscriptions, create a new
Customer instead of a
Charge by providing their email address and tokenized card information.
Be certain to store the customer ID on your side for later use. You can subsequently charge that customer by passing the customer ID—instead of a card representation—in the charge request.
Charges using saved card details can be customized in the same ways as one-time charges.
Automatic card updates
Saved payment method details can continue to work even if the physical card has been replaced by the issuing bank. Stripe works with card networks and automatically attempts to update saved card details whenever a customer receives a new card (for example, replacing an expired card or one that was reported lost or stolen). This allows your customers to continue using your service without interruption and reduces the need for you to collect new card details whenever a card is replaced.
Automatic card updates requires card issuers to participate with the network and provide this information. It is widely supported in the United States, allowing Stripe to automatically update most American Express, Visa, Mastercard, and Discover cards issued there. International support varies from country to country. It is not possible to identify which cards can be automatically updated.
You can use webhooks to be notified before or after a card is automatically updated. Listening for
payment_method.updated notifies you of updates to a card that happen via an API call, while
payment_method.automatically_updated notifies you of automatic card updates from the network. These events include the card’s new expiration date and last four digits, should you need to update your own records.
Changing the default payment method
Although many of the cards you save can be automatically updated, you should still adopt a process that allows customers to update or replace the cards on file (for example, a customer wants to change the card being billed or their card can’t be automatically updated). The end of the process requires an update customer call, providing a new token for the
This sets the new card as the default payment method for future payments. It also deletes the previously saved card.
Multiple payment methods
Customers can also store multiple payment methods. The first one saved to a customer is set as the
default_source. This is used for subscription payments and whenever a charge request is made with just a customer ID.