1

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 ?

Nimesh khatri
  • 763
  • 12
  • 29

1 Answers1

2

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.

Ywain
  • 16,854
  • 4
  • 51
  • 67
  • Ok, so do you mean we can't proceed for create card operation using Stripe.js only ? – Nimesh khatri Feb 05 '18 at 05:39
  • Yes. Integrating directly with Stripe requires a backend server. Stripe.js is only used for tokenizing payment information. – Ywain Feb 05 '18 at 05:45