#bhanu365 - store card details
1 messages · Page 1 of 1 (latest)
Hello, are you asking how to collect the card details and save them as a PaymentMethod? Or are you saving them already but not sure how to set it as the default for renewal payments?
@hot widget I just saved customer ID only, When I use a different card detail from testing cards like 4000000000000069 (Expired) then I am getting an error, Like "You haven't attached customer ID with source" or something like this.
I just want any customer can buy a plan and we can save card details and we will not show card form anymore if we have their card details and when their subscription plan ends so it can easily auto-renewal.
Apologies for the delay. What call are you making when you get that error?
Is it on the subscription creation call?
Also can I ask why you are using tokens here to collect card data? That is workable but is considered a legacy integration path so we typically recommend against using it if you are starting to build you app now
Thanks for the recommendation. I'm not familier with the stripe. I have implimented the code in the chunks because I don't understand How can I build this functionality Can you please suggest me what can I do for this?
I have already wasted too much time of this
If you are looking to do this with your own custom page, this is a good guide to start with https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
Here is the step where we start talking about collecting payment info and saving it to the user https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#collect-payment
Can you take a quick look over that and let me know if that looks like about what you are looking for?
Thanks, let me check
Is it "PaymentMethods" will use for the buy the subscription?
👋 catching up on this as my teammate had to step away
I believe you're on this step: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#complete-payment
These are our subscription. 1st one is not a plan.
a PaymentMethod object will be created after a customer fills in their payment details in the Payment Element, and you call stripe.confirmPayment
that PaymentMethod will be attached to the customer you created in an earlier step. If you used payment_settings: {save_default_payment_method: 'on_subscription'} when creating the subscription, the PaymentMethod will be saved as the customer's default PaymentMethod and used for all future invoices tied to that subscription
clientSecret: '{{CLIENT_SECRET}}',
CLIENT_SECRET is client secret ID?
i have passed client secret ID but getting error
You'll want to use the client_secret associated with the first invoice's PaymentIntent: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#create-subscription
"$stripe->subscriptions->create()"
I need to call this method when a user select any plan and after that we perform this API method ($stripe->subscriptions->create()) and then we call card element to show the form to the users and then we will get client secret ID from the "$stripe->subscriptions->create()" right?
After you create the subscription, you'll use the client secret returned in the create subscription request to present the PaymentElement: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#add-the-payment-element-to-your-page