#jean-baptiste-r_code

1 messages Β· Page 1 of 1 (latest)

rugged domeBOT
#

πŸ‘‹ 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/1329729155478196257

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

plush wharf
#

Little note: We are only doing one time payments.

tough rain
#

hello! taking a look, gimme a while

#

https://support.stripe.com/questions/what-is-the-difference-between-on-session-and-off-session-and-why-is-it-important - this explains on-session and off-session in detail. In summary

β€œOn session” is when the customer pays on your app/website, while β€œoff session” is when the payment is initiated automatically or by the merchant.

when you use setup_future_usage, you'll typically use off_session so that you can reuse the PaymentMethod either off-session on on-session. If you use setup_future_usage='on_session, the saved payment method cannot be used off_session.

Note : If you don't include setup_future_usage when creating the PaymentIntent, this means the payment method that used to make payment is one-time use, and cannot be reused

You can charge a saved payment method later off-session, which you can read about in more detail here : https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=stripe-hosted#charge-saved-payment-method

plush wharf
#

Thank you for your answer πŸ™‚

#

So, in my use case, because I'm only using one-time payments, I can just remove the setup_future_usage property and everything will be fine πŸ€”

#

Payments are always initiated "on_session", but I guess it's not the case with bank transfers πŸ€”
I'm not sure if I'm doing something wrong right now tbh

tough rain
#

what's the issue that you're facing? can you share more?

rugged domeBOT
plush wharf
#

My initial payment was the code I send you on the first message.
Initially, I offered users to pay by card (or Apple Pay/Google Pay for that matter).

For some reasons, I need to let them use SEPA debits and bank transfers.
When I add them in the payment_method_types property, I have an error: Stripe tells me that bank transfers are not allowed with setup_future_usage property.
So I'm thinking about removing the setup_future_usage property to remove this error. (and it works, I have no error when I remove this property)
But here is my problem: I don't know what are consequences when I remove this property. Are there some security issues ? Or else ?
(We only do one-time use payments, so according to your first message, it should be fine for payments, but not sure about security)

simple lintel
#

πŸ‘‹ taking over for my colleague. Let me catch up.

plush wharf
#

Lemme 30sc, looking for screnshots

#

Hello, thank you πŸ™‚

simple lintel
plush wharf
#

So, here is the error from Stripe, now I'm gonna show you what I changed in our code

#

In our backend application, I changed this:

      const paymentIntent = await stripe.paymentIntents.create({
        amount: Math.round(payload.amountInEuros * 100),
        currency: payload.currency || 'eur',
        customer: payload.customerId,
        payment_method: payload.creditCardId,
        payment_method_types: ['card'],
        setup_future_usage: payload.setupFutureUsage,
        confirm: payload.confirm || false,
        metadata: {
          ...payload.documentData,
          ...(payload.metadata || {}),
        },
      })

to this:

      const paymentIntent = await stripe.paymentIntents.create({
        amount: Math.round(payload.amountInEuros * 100),
        currency: payload.currency || 'eur',
        customer: payload.customerId,
        payment_method: payload.creditCardId,
        payment_method_types: ['card', 'customer_balance', 'sepa_debit'],
        setup_future_usage: payload.setupFutureUsage,
        confirm: payload.confirm || false,
        metadata: {
          ...payload.documentData,
          ...(payload.metadata || {}),
        },
      })

The only line who changed is the payment_method_types property.
According to your documentation, customer_balance is the enum value for bank transfers and sepa_debit for SEPA debits

#

I think you have all the needed information... Don't hesitate to ask πŸ™‚

Sorry if my english is weird tho πŸ™

simple lintel
#

passing setup future usage means that you're asking your customer whether they agree that you save their PaymentMethod to be used in the future

#

Customer Balance can't be used in the future automatically

#

since the customer needs to wire the money to the provided bank account

plush wharf
#

Sounds logic πŸ€”

simple lintel
#

there's no security aspect in using sfu or not

plush wharf
#

Oh okay, so I can simply remove the sfu property and everything is fine ?

simple lintel
#

yes but this also means that if the customer chooses to pay by card or SEPA Debit, you won't be able to charge them in the future directly

plush wharf
#

I'm not sure what you mean sorry πŸ˜“

simple lintel
plush wharf
#

Oh, so it means that I can't save the card (or any other payment method) for future payments ?

simple lintel
#

if you remove the setup_future_usage param yes

#

but don't worry

#

there's a workaround this

plush wharf
#

I have a last question

simple lintel
#

sure

plush wharf
#

This is exactly what I'm looking for, but I'd like to not use the payment_method_types because we are now using the Dashboard.
Will this solution (I mean, the solution with payment_method_options you just sent) be a problem ? Or will everything be fine with this ?

simple lintel
#

no you can still pass the pmo while still using PaymentMethodConfigurations (pmc)

plush wharf
#

Alright thank you, I'm going to do some tests then πŸ™‚

Have a good day/evening !