#rock_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1331122108281131060
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
No you shouldn't use the legacy checkout.js and calling the Cards API directly.
https://docs.stripe.com/payments/checkout/migration you should migrate to the new Checkout sessions API
And use setup more checkout session to collect payment methods from your customer without charghing them.
I tried implementing this mechanism to try to get the amazon and cashapp methods from users, but they were not getting implemented without the charge attached.
And hence I shifted back to the legacy code which is already implemented here.
Ok, so I will have a look at the setup mode, is this the payment element?
@fossil otter
Using the checkout to redirect the users to the checkout flow, cant we use the payment element here?
Also here, after retrieving the payment method id, https://docs.stripe.com/payments/save-and-reuse?platform=checkout&ui=stripe-hosted#charge-saved-payment-method
the manual creation on paymentIntent object is that necessary to further charge? cant we just retry the failed invoice when the invoice-payment-failed is received?
Ok, so I will have a look at the setup mode, is this the payment element?
No this is for Payment Links and Stripe Checkout.
What about this?
Using the checkout to redirect the users to the checkout flow, cant we use the payment element here?
Which integration are you intending to use? Hosted checkout page (Stripe Checkout) or custom payment flow (Payment Elements)?
Currently I am using the legacy checkout.js to get the card details using token system.
To which jack said I should not use these anymore to get the payment method details. Now I want to understand what should I use since checkout seems a little different approach, rather than just implementing the payment element to get the card details and then attach it with the customer.
My current legacy thing works but it sets the newly added card as default in the customer object, where I want to make sure that this card will not be charged for renewals, since I want this new card to act as a manual backup-card.
@neat trout u there sir?
Apologies for the delay. Looking into your last query.
You can use the new Checkout to also to just get the card details and attach to the customer. The link you shared (https://docs.stripe.com/payments/save-and-reuse?platform=checkout&ui=stripe-hosted#create-checkout-session) is the recommended way of doing that. Can I check what issue are you facing with this proccess instead?
With this process, users will be redirected to checkout window. Which we want to avoid as want the users to be on our website for this.
in the step-5 here https://docs.stripe.com/payments/save-and-reuse?platform=checkout&ui=stripe-hosted#charge-saved-payment-method
is the manual creation of PaymentIntent necessary, cant I just retry the invoice with the payment method ID at time of reenwals
Again, task is to implement a mechanism to add a card detail from user and only charge the ongoing subscription renewal whenever the default payment method fails. Once the default method is working again, charge the same only. Hope this clarifies.
With this process, users will be redirected to checkout window. Which we want to avoid as want the users to be on our website for this.
You can consider using the embedded checkout: https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=embedded-form
Or you can implement Payment elements: https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
is the manual creation of PaymentIntent necessary, cant I just retry the invoice with the payment method ID at time of reenwals
The main purpose of these guide is to collect the payment method details from your customer and attach it to them. You can use the payment method other ways instead of this: https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=stripe-hosted#charge-saved-payment-method
ok got it.
Just one last thing
Also whats the difference between setting the default_source in customer object and default_payment_source in subscriptions object?
As unless and until I update the susbcriptions_object with the new card info the renewals go through with the card set at checkout during first payment.
I read both customer and subsription object details, but no viable difference I could find.
Also whats the difference between setting the default_source in customer object and default_payment_source in subscriptions object?
default_source is the default payment source for a Customer [0, 1]. default_payment_method [2] is the default payment method for that Subscription. A default_paymebt_method is always used to charge for a Subscription before a defaulst_source is used.
[0] https://docs.stripe.com/api/sources/object
[1] https://docs.stripe.com/api/customers/object?lang=ruby#customer_object-default_source
[2] https://docs.stripe.com/api/subscriptions/object#subscription_object-default_payment_method
So this means if default_payment_method is set then it will be used always unless and until this is empty?
As unless and until I update the susbcriptions_object with the new card info the renewals go through with the card set at checkout during first payment.
As mentioned in the API doc, as long as a default_payment_method is set for the Subscription, it will be used to charge the customer. Only if it's not set then the default_source will be used.
So this means if default_payment_method is set then it will be used always unless and until this is empty?
Yes
Means I dont have to worry about the new payment object getting set as default_source in the customer object , Even if the subscrptions default_payment_method is lets say ( have insuffieceint funds) , the newly added customer default_source is not going to be used unless until it is added in sub object.
Yes, you are right.
Thanks, that helps a lot.