#david-llop-_code

1 messages ยท Page 1 of 1 (latest)

calm yokeBOT
#

๐Ÿ‘‹ 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/1334514796510314526

๐Ÿ“ 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.

molten ice
wet bane
#

๐Ÿ‘‹ Happy to help!

molten ice
#

we have two cases,

  • off-session (hotel owner wants to charge some money to customer via our back-end)

  • and on-session (customer wants to pay some amount of their booking via the my-booking administration section)

#

in the first case, if the payment requires customer interaction, we will simply ignore it (or cancel it) and send the payment via mail to the customer to pay using checkout sessions.

in the second case, the customer can complete the payment if customer interaction is required, like confirming via bank app or something like that 3DS requires nowadays

wet bane
#

Thanks for the additional details

wet bane
molten ice
#

I already have the payment method ID and the customer ID, I guess that's what I need to call paymentIntent->create() and use off_session for back-end chores and on_session when the customer clicked the button

wet bane
#

Correct.

molten ice
#

gonna read this docs you shared and come back in a few ๐Ÿ˜… better than wasting your time ๐Ÿ™

#

thank you very much!

wet bane
#

No worries, happy to help any time!

molten ice
#

just one question, this docs shows a different way of initializing the Stripe Client, my guess is that it's not important for what I need to do, am I right?

#
\Stripe\Stripe::setApiKey('sk_test_CGGvfNiIPwLXiDwaOfZ3oX6Y');

try {
  \Stripe\PaymentIntent::create([

โ˜๏ธ this would be the same as this ๐Ÿ‘‡

$client = new StripeClient('sk_test_CGGvfNiIPwLXiDwaOfZ3oX6Y');

try {
  $client->paymentIntents->create([
wet bane
#

Yes both should be ok, you need can use the same client for all your API calls

molten ice
#

perfect, I think I completely understand the off_session flow stream ๐Ÿ˜ฌ but can't find the information for when it's on_session ๐Ÿ˜…

#

like

When it's on_session and payment required customer's verification, you will receive the status requires_payment_confirmation and the link the customer should visit to confirm this transaction

#

the bold part is what I can't find

wet bane
#

on_session is when a customer choose a saved payment method and choose to pay using it from the frontend.

#

off_session is when your backend charge the customer without his presence on a frontend.

molten ice
#

yeah, but in our front-end there's nothing stripe related, is just a button, and that buttons makes a POST call to our server, and our server executes the stripe->paymentIntents->create(...) with the information

wet bane
#

it's considered as an on_session payment, as the customer is on your frontend and you can ask them to complete the 3DS action if the bank issuer requested that...

molten ice
#

yeah that's what I need ๐Ÿ˜… inform the customer to complete the 3DS action... Oh wait, you mean Stripe only tells me like Yoh, this guy needs to complete the 3DS, tell him to open the bank account

#

and then I need to tell the customer Check your bank app to complete with the step and click [HERE] when done? ๐Ÿค”

#

sorry I'm new to this, what I did in like 10 other payment gateways usually I receive an URL that I need to redirect the customer to, and in that screen they should confirm the purchase, then they are redirected to the success url and a notification is received via webhook, pretty similar to the stripe->session->create flow but without credit card inputs

wet bane
#

You show something like: you need to complete a 3DS action in order to validate this payment (as a button). When the customer clicks on that button, you call that stripe js function

molten ice
#

But I'm not using any JS so far, only server side, there's no Stripe JS involved in all the flow I developed so far ๐Ÿ˜… is it 100% required for this? Is there anything I can do server-side to get the link that that JS generates? ๐Ÿ™

calm yokeBOT
wet bane
#

And share the 3ds next_action url with the customer in order to complete it.

molten ice
#

I see, so if the PaymentIntent contains "status": "requires_action", the property next_action will contain the url to complete the 3DS authorization

solemn nymph
#

Correct