#Brian-checkout

1 messages · Page 1 of 1 (latest)

junior nest
#

Hi there, what's your previous custom implementaion?

brave whale
#

To simplify, how can we create an off_session payment setup using the pre-built checkout. The code above is charging the card even though the SetupFutureUsage = "off_session"

junior nest
#

Ok, if I understand your requirement correctly, you want to collect the payment details from your customer without charging them

brave whale
#

We want to create an off_session payment using the pre-built checkout

#

It should be creating an payment intent and not chargint the card

junior nest
brave whale
#

if set to off session

#

What does the off_session setting do then?

#

if it is still charging the card when we set it so off_session in pre-built?

#

setup mode is a different process as it does not create a payment intent for future use, which is what we need.

junior nest
#

Can you tell me what do you achieve here?

brave whale
#

Create an off_session payment using the pre-built checkout.

#

SetupFutureUsage = "off_session" does not see to have any affect

junior nest
#

Sorry I don't get it. off_session payment are a merchant-initiated transaction (MIT) so that your customers don't have to come back online and authenticate.

#

I don't see a use case to use Checkout session for off_session payments.

brave whale
#

Ok. I see. off_session will make sure they don't have to come back to authenticate. That is what you are saying, correct? In that case the question would be how can we create a payment intent with the pre-built checkout? Does setup mode return a payment intent id?

#

We need a payment intent for future use where the user will not have to come back and authenticate.

junior nest
#

Yup, it's much clear now.

So there're two ways to collect payment method for future off_session payments with Checkout session API

  1. Use payment mode, and set payment_intent_data.setup_future_usage=off_session (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage)
  2. Simply Use setup mode
brave whale
#

Right, #1 is what we are doing (see code) but the card is being charged.

junior nest
#

Yes, that's the intended behaviour, if you don't want the card getting charged, use setup mode

brave whale
#

So #1 is not a way to collect for future payment using the "off_session" setting. I'm confused by your answer

junior nest
#

So what's your requirement exactly? do you want the card getting charged during setup or no? You said but the card is being charged. -> so I assume you don't want it get charged in the initial setup?

brave whale
#

Do not want the card to be charged

junior nest
#

Ok, use setup mode then.

brave whale
junior nest
#

OK, I think you don't how to charge customer for off_session payments.

brave whale
#

OK. Back to my original question. Can we create a payment intent with the pre-built checkout? We know how to do this with and have done it witn a custom checkout. How can we do this :

#

"You can just use PaymentIntent API, pass in the amount, customerId and the paymentMethodId, and set the confirm=true"

#

with the pre-built checkout form?

junior nest
#

I still don't understand why you insist to use checkout for off_session payments. Maybe I miss something, can you walk me through your real world use case?

brave whale
#

We want to create a customer, attach the payment method, set it to "off_session" so they do not have to authneticate when we charge the card later, and create and store the customerId and payment intent id to charge later. We want to use the pre-built checkout form to do this so we can take advantage of all of the great features it offers so we do not have to build a new custom form and deal with the two-factor auth, etc.

junior nest
#

Ok, how do you intent to charge your customer later? is it merchant initiated or you customer need to go back to your website and do something?

brave whale
#

Merchant initiated.

junior nest
#

Then just use the PaymentIntent API that I described earlier, no need to use Checkout API here.

brave whale
#

I'm not sure if you understand. We do not want to have to write a custom payment form. We are moving away from that and refactoring using your pre-built checkout form. We are going in circles here. Looking at the code we sent, how can we do what we described without charging the card?

#

In addition, some of our checkouts are real time purchases and some are at a later date, so we need both functionalities. We are not looking for advice on how to model the software but specific questions on the features and functionality of your pre-built checkout form. Can it do what we are asking? It seems like it can but the docs are not 100% clear.

#

maybe the most simple question would be "how do we use the pre-built form to collect customer info, create customer, store the payment information, off_session so we can do a merchant intiataed charge at a later date without immediately making a charge?" Is this possible and if so, how?

junior nest
#

Ok, now I understand your concern, you don't want to build a custom payment form and it totally makes sense.

And to answer your simple question, just use setup mode checkout session, that's all you need to do here. Once the payment method is collected, you can charge your customer for either on_session and off_session payments

  • on_session -> use the payment mode checkout session and pass in the customerId, the Checkout page will automatically present the most recently saved payment method for your customer to confirm
  • off_session -> use the Payment Intent API with confirm=true

Let me know if you need further explanation.

brave whale
#

OK. Thank you.

junior nest
#

And I'd like to remind you that, in rare case the off_session payments can sometimes goes into requires_action state, and you still need to bring your customer back online in order to confirm it. see https://stripe.com/docs/payments/intents