#supreeth_code

1 messages ¡ Page 1 of 1 (latest)

serene voidBOT
#

👋 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/1370464340867547218

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

river marten
#

Redirect based payment methods will require customer to complete the additional action

#

Is your customer in session to complete the additional action?

worn valve
#

Customer will not be in session, we send the setupintent secret to the UI and the UI uses stripe SDK to take payment method details

river marten
#

How do you take the payment method details when the customer is not in session to fill up those information?

worn valve
#

sorry, what I meant is we use stripe SDK to take payment method, and it is initially authorized to 0$ as it is a setup intent.

#

We get a webhook callback from stripe, and then the backend code goes and creates the paymentintent to authorize a hold

river marten
worn valve
#

can this be done from the UI ?

#

ah, I see instead of pass the setup intent secret to the UI, I create a paymentIntent and send that secret ?

#

so that UI can complete on-session payment including redirects ?

river marten
#

Yes, that's right!

#

In this case, this will also take care of redirect based payment methods while customer is in session, save payment method and charge the payment using one Payment Intent

worn valve
#

yeah makes sense

#

I had a follow up question

#

how does this work if we want to charge the payment method of the customer again for the future invoices ?

river marten
#

If you use Invoice API to create an invoice, the saved payment method (pm_123) can be set in default_payment_method field: https://docs.stripe.com/api/invoices/create?api-version=2025-04-30.basil#create_invoice-default_payment_method

If you use Payment Intent API for one-time payment, the saved payment method can be set in payment_method field as explained in: https://docs.stripe.com/payments/save-during-payment#charge-saved-payment-method

Learn how to save the customer's payment method when you confirm a PaymentIntent.

worn valve
#

does this work for redirect based payment methods as well ?

#

doesnt it need to be redirected and authorized again ?

river marten
#

This will work for redirect based payment method that support saving it for future usage. In most of the time, customer will not be prompted to perform additional action since Stripe will inform the issuer that the customer is not present when setting off_session: true. However, there will still be rare case that the issuer may want to additional authentication. Your system should bring the customer back to perform additional action.

worn valve
#

got it

#

where do I set off_session: true ?

river marten
#

Are you referring to Payment Intent or Invoice API?

worn valve
#

both I guess

#

Do I need to set for the initial Payment Intent I create ?

#

To get payment method added

serene voidBOT
river marten
#

off_session is to tell Stripe and issuer whether the customer is present. Since the customer is present during the initial payment flow, you shouldn't set this unless customer is not around.

For Payment Intent API, off_session can be found in: https://docs.stripe.com/api/payment_intents/create?api-version=2025-04-30.preview#create_payment_intent-off_session

For Invoice API, off_session is not supported.

worn valve
#

ohh

#

if we create invoices and want to charge the customer, then how do we go about that ?

#

using redirect-based cards

undone temple
#

hey there, just stepping in for river as they need to step away -- catching up

undone temple
worn valve
#

no worries, thanks for stepping in!

#

I am talking about invoices that we will generate later to be charged to the stored payment method of the customer

#

do we need to set anything specific in that ?

#

considering that there will be redirect-based cards

undone temple
#

If you already collected the payment details and a mandate for off-session usage, you can use the saved payment method to pay the invoice.

worn valve
#

ok

undone temple
worn valve
#

then to clarify:

  1. When I create PaymentIntent for the first time, I set offsession: true and send the secret to the UI, UI sends the payment method to stripe. And PaymentMethod gets added.
  2. When I need to charge customer using invoices in the future, I just set the default_payment_method for the customer to this payment method.
    Does this look correct ?
undone temple
#

I set offsession: true
Not quite -- you likely want to set setup_future_usage: 'off_session'

#

Assuming you're collecting the payment details for the first time with a standalone payment intent

worn valve
#

yes

undone temple
#

This guide explains that flow so that you end up with a payment method you can use later

worn valve
#

thats correct, we want to collect payment method using that and then use that payment method to charge in the future using invoices API

#

got it

#

thanks so much