Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. If you're comfortable writing some code on your end then you would need to ask your customer for their card details again first. The easiest solution would be to use Stripe Checkout and remove the `data-amount` parameter to not display any price. I've made a simple example showing how to customize Checkout to reflect that you are just looking to update the customer's card: http://jsfiddle.net/kt448bk8/
  2.  
  3. Then once you get the token on your server, instead of creating a charge or a new customer you would need to use the Update Customer API [1] and pass the new card token in the `card` parameter. That would automatically update the customer object and replace the default card with the new one.
  4.  
  5. In PHP the code would look like this:
  6.  
  7. $cu = Stripe_Customer::retrieve("cus_XXXX");
  8. $cu->card = "tok_XXXX";
  9. $cu->save();
  10.  
  11. [1] https://stripe.com/docs/api#update_customer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement