#ruul_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/1267424419467366400
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
hello
I was planning to remove the setup session to add cards from our flow but seems like in this case we might need it but I'm not sure if that's the way to go since it was having issues even though we set it up it required additional security for some
for the initial purchase checkout works fine handling the extra verification part but
what if user wants to switch to a new card when subscription is active that is not added before via checkout session
hi! well there are multiple ways, https://docs.stripe.com/payments/checkout/subscriptions/update-payment-details is one of them for example, to save a new card and mark it as default future future payments. Or the customer can do it in the portal (https://docs.stripe.com/customer-management/configure-portal) too.
will it work with additional verification if required?
* Creates a Stripe Checkout Session for setting up a customer card
* without specifying any currency or price.
* @param customerId - The ID of the customer for whom the card is being saved.
* @returns The URL of the Checkout Session for setting up the card.
*/
public async createSetupCheckoutSession(
customerId: string,
success_url: string,
cancel_url: string
): Promise<Stripe.Checkout.Session> {
const session = await this.stripe.checkout.sessions.create({
payment_method_types: ["card"],
mode: "setup",
customer: customerId,
success_url,
cancel_url,
});
return session;
}
we had this before
for saving cards
but when we actually tried to use them for purchasing subscriptions
some required additional steps for verification/security
when I posted it here, I was told depending on webhooks wasn't the best way to solve this using the webhook for when subscription requires additional steps to complete
yes it handles 3D Secure
we are already using this code on prod though and it happened
* Purchase subscription
* @param customer customer id
* @param price stripe price id
* @param paymentMethodId id of the payment method (optional)
* @param quantity number of items (optional)
* @param trialDays trial days (optional)
* @returns subscription object
*/
public async purchaseSubscriptionWithPaymentMethodPresent(input: {
customer: string;
price: string;
paymentMethodId: string;
quantity?: number;
trialDays?: number;
coupon?: string;
}): Promise<Stripe.Subscription> {
const { customer, price, paymentMethodId, quantity, trialDays, coupon } =
input;
return this.stripe.subscriptions.create({
customer,
items: [{ price, ...(quantity && { quantity }) }],
default_payment_method: paymentMethodId,
...(trialDays && { trial_period_days: trialDays }),
...(coupon && { coupon }),
});
}```
sure, and that's normal. any payment any time can require 3D Secure
why do you do it that way instead of the recommended way of confirming the Subscription's latest_invoice->payment_intent on the frontend?
this is before the subscription is created
if you're doing "save card with a Setup CheckoutSession -> immediately create a Subscription to charge that saved card" then sure, that is not a good way of doing it and can lead to double-3DS
setup -> and then this
there are three flows
first is when you try to purchase something if you don't have a card you use setup & then purchase
second when you want to add a new card just the setup
third is when you set a card default we try to charge every open invoice on the new default
when making the switch
which of those three flows are we discussing in this thread?
all of them since they can lead up to charge one way or another
from the way it looks we need to depend on that specific webhook event ( I can't remember which one it was)
but I was advised against it
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
this one
ok. Well at a high level my recommendations are this.
first is when you try to purchase something if you don't have a card you use setup & then purchase
normal flow of create Subscription and confirm latest_invoice->payment_intent on the frontend. https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
second when you want to add a new card just the setup
there are multiple ways, https://docs.stripe.com/payments/checkout/subscriptions/update-payment-details is one of them for example, to save a new card and mark it as default future future payments. Or the customer can do it in the portal (https://docs.stripe.com/customer-management/configure-portal) too
third is when you set a card default we try to charge every open invoice on the new default
do the above, and then while the customer is still present on your site after adding that card, grab the PaymentIntent of the Invoices you're interested in and call https://docs.stripe.com/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-existing on the frontend, to attempt payment of each one and handle 3D Secure if needed. I think this flow isn't one we really have an explicit guidance for.
that event you're mentioning is mainly useful for handing when 3D Secure is required on an off-session recurring payment and you need to contact the customer, which is different than the 3 flows we're discussing here.
will it require 3d secure after the initial purchase or is that a possibility?
if the first payment/setup was authenticated there are exemptions for recurring payments (https://stripe.com/guides/strong-customer-authentication#:~:text=for our users.-,Recurring transactions,-This exemption can) but it's at the bank's discretion and you need to handle the case where the exemption is not granted, 3D Secure is required, and the customer needs to come back to authenticate the payment(we have a setting in the Dashboard to automatically email the customer a link to the hosted invoice page when that hapens, or you can listen to that webhook and handle it yourself).
oh my god
if the email confirmation is a thing
I was doing this for nothing -.-
that was the only problem that we had
so client can configure it on dashboard ?