#adamreisnz-off-session

1 messages · Page 1 of 1 (latest)

fervent seal
#

Hey, by setup for off-session usage, do you mean you have used setup_future_usage when you created a PaymentIntent?

chilly gyro
#

Yes, that's correct

#

We specify off_session for the payment intent, so that we can use it off session in the future.

#

So in that case, the card will likely be authenticated

#

I know how to get a list of sources attached to a customer, but I am wondering if we can "see" which ones have been set up for off-session and which ones haven't

#

This will help us communicate to our customers to inform them whether their (off session) payments will likely fail or not

fervent seal
chilly gyro
#

I am not sure that is entirely correct. We can still attach a payment method to a customer, and then fail authentication.

#

That means the card will not be usable for off session usage, but it will be attached to the customer.

#

Also, not sure what it would mean then if we create a payment method, with setup_future_usage set to ON_SESSION.

#

This will still attach the payment method to the customer, if we want it to.

#

It just means that for those payments, the customer will be present in our checkout flow.

#

So they will be asked to authenticate.

#

Would you be able to double check this with a colleague please?

fervent seal
#

Sure, let's clarify a bit here. From this https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage

Providing this parameter will attach the payment method to the PaymentIntent’s Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete
I believe that it will only be attached if authentication succeed

#

So if you use this parameter, you shouldn't worry about the case that the Payment failed but the PaymentMethod is still attached to the Customer

chilly gyro
#

Hmm, so we use a slightly different flow (based on Stripe's recommendation in an earlier chat I had here)

#

Let me clarify

#

Because we need to know the country of a card to determine the fee that will be charged (domestic vs international), we first create a payment method in the client.

#

From this, we obtain the paymentMethodId, which we send to the server if they continue with the payment, and we attach this to the payment intent.

#

At this point, there will not be a customer yet.

#

We then specify in the payment intent, that the future usage should be set up as off_session

#

We then create the customer object, and attach this payment method to the customer.

#

We do this manually.

#

Then we confirm the payment on the client using the client secret.

#

So because we set it up for off_session, we can then use this card for future off session payments, with the member not being present.

#

If I were to use on_session, this would not be possible.

#

But all the rest would be the same.

#

The card would still be attached to the customer.

#

It would just not be usable for off session payments.

#

We have tested this with your authentication-required test card.

#

So it seems to work as expected, and the card that is authenticated and set up for off_session, will not require authentication anymore when we make a subsequent off session payment

#

The card that we flagged as on_session, will fail the subsequent off session payment, with an error saying that it requires authentication.

#

Sorry for the wall of text, but it's a complicated flow

fervent seal
#

Thanks for writing in details. Yes I can grasp the flow better

chilly gyro
#

So yes, I am hoping to figure out somehow if a card was set up for off-session or not

#

Or alternatively: whether it will require authentication, or not

fervent seal
#

So the question is, with a given PaymentMethod, you want to know if it was off-session or on-session?

chilly gyro
#

Yes, correct

#

But this may not be something that you know, as the bank or card issuer may decide that

fervent seal
#

That's a good point, let me looking around for a while

chilly gyro
#

Alright

fervent seal
#

Okie, I believe that on_session and off_session is by PaymentIntent, not PaymentMethod. For example you can have one Customer, one PaymentMethod, but you can create 2 PaymentIntent separately with on_session of off_session by each.

#

So it's really the PaymentIntent should tell whether it was on_session or off_session, not the PaymentMethod itself

chilly gyro
#

Right

#

Ok that might give me something to dig into

#

Would I just check the value of setup_future_usage ?

fervent seal
#

for PaymentIntent, yes

#

its object has the value of setup_future_usage

chilly gyro
#

Ok

#

I will give it a go, thank you 🎉