#adamreisnz-off-session
1 messages · Page 1 of 1 (latest)
Hey, by setup for off-session usage, do you mean you have used setup_future_usage when you created a PaymentIntent?
setup_future_usage only mean you attached that PaymentMethod to a Customer. To know which PaymentMethod is currently attached to a Customer, you will need to list it based on customer Id: https://stripe.com/docs/payments/save-during-payment#web-create-payment-intent-off-session
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
"have been set up for off-session" only mean that PaymentMethod is saved to a Customer object. On the PaymentMethod object, you have customer field which tell if it is saved to a customer: https://stripe.com/docs/api/payment_methods/object#payment_method_object-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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?
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
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
Thanks for writing in details. Yes I can grasp the flow better
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
So the question is, with a given PaymentMethod, you want to know if it was off-session or on-session?
Yes, correct
But this may not be something that you know, as the bank or card issuer may decide that
That's a good point, let me looking around for a while
Alright
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