Stripe – Add new card to existing customer

If you are on the 2015-02-18 API version or later then the cards attribute has been changed to sources as you can see in the changelog

The documentation on the Create Card API shows the following code now:

customer = stripe.Customer.retrieve('cus_xxxxxxxxxx')
customer.sources.create(card=card_token)

You can find your API version in the API keys settings in the dashboard and you can also use the Stripe-Version header to force your API request to an older API version so that cards still work as explained in the Versioning documentation:

stripe.api_version = '2015-01-26'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)