Jump to content
Larry Ullman's Book Forums

Updating Credit Card Through Stripe


Jonathon
 Share

Recommended Posts

Hi Larry,

 

Just wondered if I could get your thoughts on the best way to offer a user to update a credit card with Stripe. I plan to let Stripe handle everything really. So I never touch or handle any credit card information. I'm going to be using subscriptions. Which is great using checkout, I let Checkout take the information, Stripe creates the customer and assigns them to my plan and bills them each interval.

 

But how then would you suggest is the most user friendly way to allow someone to edit card details?

 

Also, out of interest, what web hooks do you look for with your site or do you just send the whole webhook regardless what it is to yourself?

 

Jonathon

Link to comment
Share on other sites

Hey Jonathon, glad you're enjoying Stripe! This is a common enough issue. What you'd do is take the new CC info using Stripe.js or Checkout. Then you'd retrieve the customer from Stripe:

 

https://stripe.com/docs/api/php#retrieve_customer

 

Then you'd do an update, providing the new token as the card value:

 

https://stripe.com/docs/api/php#update_customer

 

This replaces the existing card on file with the new card. 

 

As for the web hooks, if you create a web hook script, Stripe sends every event notification there. It's then up to you to decide which ones matter and which ones don't. For subscriptions, the invoice.payment_succeeded event is most meaningful. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...