#Lunar

1 messages ยท Page 1 of 1 (latest)

winged gullBOT
upper forum
#

๐Ÿ‘‹ happy to help

#

could we please continue the conversation here

potent abyss
#

Sure thing, sorry!

upper forum
#

Can I ask, in regards to MOTO: The javascript library captures the client card details and returns a token to my backend (PHP), then my backend uses that token to charge the card and declare the transaction as MOTO during payment intent.

How does the Javascript library know not to prompt for 3D secure, seeing as it's only after that point when MOTO is declared ?
Or rather.. If I test with either of these cards and MOTO.
I get the error that card requires auth.

#

would you mind removing the messages from the main channel?

potent abyss
#

Done, thanks.

upper forum
#

no worries

#

how are you gathering the card details?

potent abyss
upper forum
#

you're creating a checkout session for yourself as a MOTO agent?

potent abyss
#

That form returns a token to my php backend, then I create a \Stripe\PaymentIntent::create($data); with that token, customer and append payment_method_options[card][moto] = true.

#

Yeah, we're creating a stripe MOTO terminal in our CRM. MOTO is enabled on the account but theres almost no documentation that I can find.

upper forum
#

wait what?

#

oh this is the legacy checkout

potent abyss
#

Yeah, inherited code.

upper forum
#

sorry I'm not really familiar with the legacy Checkout integration

potent abyss
#

I can migrate.

upper forum
#

I need a couple of seconds to try to wrap my head around it

upper forum
potent abyss
#

Before you invest time in the issue then, can I ask if the cards I mentioned before:

#

SHOULD work as MOTO, or if they'll always fail MOTO by design?

upper forum
#

these won't even work in a normal scenario using the legacy integration if I'm not mistaken

#

based on this https://support.stripe.com/questions/mail-order-telephone-order-(moto)-transactions-when-to-categorize-transactions-as-moto it seems that MOTO is outside the scope of SCA meaning they won't demand 3DS if they were collected with a PaymentIntent that has the payment_method_options[card][moto] = true

#

so you need to change your integration to first create the PI and then send the client_secret to a front-end app where you can collect the payment details using PaymentElement

potent abyss
#

Do you have any code examples I can take a look at?

#

You're saying create the PI first, then capture card details via JS, correct?

upper forum
#

yes correct

potent abyss
upper forum
#

exactly

#

the only difference would be in the creation request for the PI where you would define your payment_method_options[card][moto]=true

potent abyss
#

Okay, great. I'll give that a go thanks.

If I have more questions should I start a new thread or use this one?

upper forum
#

we usually keep the thread opened for about 1h

#

you could use it until it gets closed

potent abyss
#

Thanks very much for your help, hopefully I'll be alright from here, much appreciated!

upper forum
#

let me know if you need any more help

potent abyss
#

Sorry to bother you with this one:

#

PIs that aren't completed after creation - will they auto clear or is it usual to get a bunch of orphaned PIs / need to write a cleanup bot myself?

potent abyss
#

Righto, thanks

upper forum
#

sure thing

potent abyss
#

Heylo, I have a checkout working with PI and Payment Element, however I'm struggling to get it set up as MOTO.

#

When creating the PI, I can pass moto = true, and it tells me I need to also do "confirm" = true.

#

But If I do that then I get "You cannot confirm this PaymentIntent because it's missing a payment method. You can either update the PaymentIntent with a payment method and then confirm it again, or confirm it again directly with a payment method."

#

Surely it's chicken and egg, as I can't do confirm true until I have card details, I can't capture card details without saying "moto" because I'll get 3DSecure challenge without moto ?

obsidian kelp
#

Hello, I think for Moto Payments you are supposed to pass the raw card details to your backend and confirm them there. I don't think the payment element supports collecting card details for MOTO payments.

potent abyss
#

Okay, that's different to tarzan's outline, but thats okay.

#

Can I use your payment form to pass those card details to my backend?

#

If so, how?

obsidian kelp
#

I don't believe so but tarzan saying otherwise makes me think one of us was mistaken. I am checking in on this with my colleagues and will get back to you with what we can find

potent abyss
#

Okay great, I can't imagine I'd be PCI compliant if I capture the details myself.

upper forum
#

@obsidian kelp I might have been off on this, sorry for the inconvenience

#

I was mistaken between Payment Elements and Card Elements, with MOTO and the way they work

obsidian kelp
#

Yeah thank you, we are aligned on that now. So @potent abyss you can't use the Payment Element to collect card details here, but you can collect card details by using the Card Element. That would allow you to create a Payment Method object from the client side and your backend can create and confirm your MOTO PaymentIntent using that PaymentMethod's pm_123... ID

potent abyss
#

I'd guess I'm going to get the same error if I implement that flow in stead of the version I've just written with a payment element?

obsidian kelp
#

Ah, that page actually does not show off the function that was needed for the flow that I mentioned. Checking for the right doc now...

#

You would use that Stripe.js function along with your card element to tokenize the CC info as a payment method. Then you would create the payment intent serverside with the parameters from the MOTO doc but also passing in the ID of your newly created payment method

potent abyss
#

At point of card detail input, how do I prevent a 3DS check though - because in that scenario the card details are entered before stripe knows it's MOTO ?

#

stripe
.createPaymentMethod({
type: 'card',
card: cardElement,

Is there a way I can set moto = true on that cardElement object?

obsidian kelp
#

That call won't trigger a 3DS auth request. You would only be able to trigger 3DS auth with the card element if you are confirming a Payment Intent

potent abyss
#

I'm not following, the https://stripe.com/docs/js seem remedial to me, can you point me at a https://stripe.com/docs/ article that outlines a moto transaction ?

obsidian kelp
potent abyss
#

I've read that one already, it doesnt show where they're getting their card details from. * securely

obsidian kelp
#

And then use the payment method from there to create the payment method

potent abyss
#
                                        // We don't want to let default form submission happen here,
                                        // which would refresh the page.
                                        event.preventDefault();

                                        stripe.createPaymentMethod({
                                            type: 'card',
                                            card: cardElement,
                                            billing_details: {
                                                // Include any additional collected billing details.
                                                name: 'Jenny Rosen',
                                            },
                                        }).then(stripePaymentMethodHandler);
                                    });
#

So at this step, in stead of running stripe.createPaymentMethod I'd hack it to post the raw card data to my server, then post the card data to stripe via php like in stack overflow ?

agile ocean
viscid jolt
#

@potent abyss let us know if you have any follow up questions

potent abyss
potent abyss
#

Do you have a vanilla JS version ?

agile ocean
#

Not sure I understand. That is just JavaScript and HTML (via Handlebars)

#

Remix the Glitch and you can see the full code

potent abyss
#

Ignore me, it's the code snippet on front page looked like part of a node module - I see via the remix bit theres more javascript wrapping it up and it makes sense now.

viscid jolt
#

I'll archive this thread soon as I need to step away but feel free to reach out to us in #dev-help in case you have any questions ๐Ÿ™‚