#rock_api

1 messages ¡ Page 1 of 1 (latest)

fossil otterBOT
#

👋 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.

frail vapor
#

No you shouldn't use the legacy checkout.js and calling the Cards API directly.

#

And use setup more checkout session to collect payment methods from your customer without charghing them.

fading idol
#

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?

fossil otterBOT
neat trout
#

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.

neat trout
#

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)?

fading idol
#

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?

neat trout
#

Apologies for the delay. Looking into your last query.

fading idol
#

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.

neat trout
fading idol
#

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.

neat trout
#

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

fading idol
#

So this means if default_payment_method is set then it will be used always unless and until this is empty?

neat trout
#

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

fading idol
#

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.

neat trout
#

Yes, you are right.

fading idol
#

Thanks, that helps a lot.