#raghul-s_docs
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/1298841849141788717
๐ 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.
- raghul-s_docs, 12 hours ago, 6 messages
Hi there, are you referring to the
payment_method_options.card.setup_future_usage in PaymentIntent creation? Yes this is the param you should use if you only want to save card payment method through PaymentElement. Have you tried it out?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You mean, I should use this param in create payment intent API? In that case, don't I need to specify setupFutureUsage in the Payment element?
Are you using the deferred intent creation flow? https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=payment
Yesterday, I got this https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage for solution. But as I mentioned, we use Payment element for checkout in UI and not the checkout session mentioned in the link I shared
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
No, the API reference that I shared earlier is about PaymentIntent, not Checkout
oh okay, Will that work in our case?
I mean, using the payment_method_options.card.setup_future_usage param in create payment intent API doesn't require us to specify setupFutureUsage in the Payment element. And whatever we set in the Payment intent API (whether off_session or on_session), will be used for the payment method saved with the Payment intent. Is this correct?
It depends, if you are using deferred intent creation flow, then you also need to set the same in Payment element. Otherwise you don't.
We use deferred intent flow
Then we need to specify setupFutureUsage on element eventhough if we use payment_method_options.card.setup_future_usage in PaymentIntent creation, right?
Yes you need to set them both in elements and paymentIntent
The elements options and paymentIntent options must match
oh okay. I'll try this
I tried without specifying setupFutureUsage in Payment element options. And specifying the payment_method_options.card.setup_future_usage in PaymentIntent creation. The flow worked without any errors.
Here are the links,
Create a PI with payment_method_options
https://dashboard.stripe.com/test/payments/pi_3QDIWlByVlfITvRX0rVNKG2w - pm_1QDIWmByVlfITvRX7RGmJlYx
Reusable to subscription https://dashboard.stripe.com/test/subscriptions/sub_1QDIk6ByVlfITvRX5w7SrgJa
Recurring PI of a invoice used pm_1QDIWmByVlfITvRX7RGmJlYx https://dashboard.stripe.com/test/payments/pi_3QDIl0ByVlfITvRX1cm9qupa
You said we need to set setup_future_usage both in elements and paymentIntent. I haven't set it in the elements. Can you check the above links and let me know if it's all fine? And any other issue I can expect as I haven't set it in the elements?
Please go through the attached resources and let me know
๐ Taking over this thread, catching up now
BNPL payment method don't support setup for future usage, so it's expected that they are not shown in Payment Element: https://docs.stripe.com/payments/payment-methods/payment-method-support#buy-now-pay-later-api-support
By reviewing the past conversations, it's not necessary to set the setup_future_usage at payment_method_options level since BNPL doesn't support off_session in the first place.
The recommended integration will be:
- In deferred intent options, set
setupFutureUsagetooff_session: https://docs.stripe.com/js/elements_object/create_without_intent#stripe_elements_no_intent-options-setupFutureUsage (This will filter payment methods that don't support off_session such as BNPL payment methods) - In Payment Intent creation,
setup_future_usageshould be set tooff_session: https://docs.stripe.com/api/payment_intents/create#create_payment_intent-setup_future_usage (You don't have to specify atpayment_method_options.{{payment-method-type}}.setup_future_usagelevel)
By doing so, the Payment Element will show all the payment methods that support off_session (which BNPL don't)
But we need to display BNPL options in the Payment element. When we set setup_future_usage: "off_session", BNPL goes off. When we don't set, we cannot save the payment method for future use. Thats the problem
If you don't specify setup_future_usage for the payment method under payment_method_options in the element options in the deferred intent flow, BNPL will show in the supported country and currency. However, your EUR isn't supported in CA account, it's expected that BNPL such as Klarna won't show.
The reason why BNPL not shown is not due to whether setup_future_usage is set, but the currency (EUR) and country (CA) filters out the BNPL since this combination doesn't supported BNPL payment method. For example, CA account only supports Klarna in CAD, but not EUR
payment_method_options support at deferred intent flow is limited. Unfortunately, only card and us_bank_account are supported in elements: https://docs.stripe.com/js/elements_object/create_without_intent#stripe_elements_no_intent-options-paymentMethodOptions
Thats right. We are aware of that. In CA VPN with CAD currency, when I set setup_future_usage: "off-session", BNPL option goes off. If setup_future_usage is not set to off_session, BNPL options displays. I can confirm you this again. Checking this
Yup! This is expected.
Could you share the use case what you would like to use the deferred intent flow for?
Elements options for deferred intent is designed to have the same setup_future_usage for all payment methods, and can't be configured at the payment method level
Yeah, but without specifying the setup_future_usage in payment element options, and specifying in Payment intent creation at level worked
Below are the same sample links I attached in previous messages:
Create a PI with payment_method_options
https://dashboard.stripe.com/test/payments/pi_3QDIWlByVlfITvRX0rVNKG2w - pm_1QDIWmByVlfITvRX7RGmJlYx
Reusable to subscription https://dashboard.stripe.com/test/subscriptions/sub_1QDIk6ByVlfITvRX5w7SrgJa
Recurring PI of a invoice used pm_1QDIWmByVlfITvRX7RGmJlYx https://dashboard.stripe.com/test/payments/pi_3QDIl0ByVlfITvRX1cm9qupa
Can you check this
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
without specifying the setup_future_usage in payment element options
BNPL will show if the currency and country is supported.
Your example works because this is the card payment. When your elements set as CA with CAD, Klarna will show. If the customer selects Klarna and make a subscription, the subscription creation will fail
Card as a payment method is supported in all the integration types, so that's why your example payment intents and subscriptions will work
Thats what I need. I understood that Klarna is only for on session & one time and cannot be saved. Im not looking to save any BNPL methods or any other methods which cannot be saved for future use. I need other payment options which can be saved for future use to have setup_future_usage: off_session
The setup_future_usage in payment element and in Payment intent API should be same, else confirmPayment API throws error.
While initialising the payment element, I need all payment options to be displayed. So, setup_future_usage in payment element hides BNPL options. When they checkout with any payment method except BNPL, they have to be saved for future use.
In this case, you'd need to maintain the logic whether a payment method is supported for off_session or subscription, then create the Payment Intent accordingly. If any new payment method is enabled, you should ensure this logic is maintained