Nimesh khatri
Nimesh khatri

Reputation: 763

Add new card to existing customer in Stripe using stripe.js only

I'm using Stripe.js for creating customers,cards and charges everything works like charm but one thing I want to do is add new card to existing customer but I can't proceed further due to an error, below is the example code

var customer =  Stripe.Customer.retrieve('cus_xxxxxxxxxx');
customer.Cards.create(card=card_token);

error: Cannot read property 'retrieve' of undefined

Or is there any api which could be helpful to retrieve and create source card directly using ajax call ?

Upvotes: 1

Views: 1343

Answers (1)

Ywain
Ywain

Reputation: 17503

Stripe.js is only used to tokenize payment information in the customer's browser.

All other API operations must be done server-side, in the programming language of your choice. Refer to this tutorial to learn more about payment flows with Stripe's API: https://stripe.com/docs/quickstart.

Upvotes: 2

Related Questions