#teamtalk

1 messages ยท Page 1 of 1 (latest)

dreamy horizonBOT
barren scaffold
#

Is there a specific error?

sage laurel
#

Ye I get this

#

Uncaught (Status 402) (Request req_aNW2rKb9tSqSFs) Sending credit card numbers directly to the Stripe API is generally unsafe

barren scaffold
#

Looking

#

Can you share an acct_xxx where it works?

sage laurel
#

๐Ÿ‘

#

I haven't been able to make it work anywhere yet

#

They told me it's enabled and I can see the docs

barren scaffold
sage laurel
#

Is this a prerequisite to Moto?

barren scaffold
#

1 moment

#

I'd recommend writing in to our team about this: https://support.stripe.com/contact

#

The issue isn't specific to your integration or API calls, so not something I can help with

sage laurel
#

What is it related to if you don't mind me asking

dreamy horizonBOT
barren scaffold
#

FWIW, you can tokenise with Elements and use MOTO which is likely the recommended approach

sage laurel
#

That sounds perfect are there any docs for such

#

I'm stuck in this for ages and stripe support via contact aren't sure yet

barren scaffold
#

Not specifically. Are you using Elements currently?

sage laurel
#

Yes

barren scaffold
#

Which? Payment Element? Card?

sage laurel
#

Payment element

barren scaffold
#

That way you're not handling any card data and can use MOTO

sage laurel
#

Perfect I will give that a go and if I get stuck I'll reach back thank you!

sage laurel
#

Will this request sca at any point

fallen crow
#

That will depend on the issuer's bank...

barren scaffold
#

No as MOTO is exempt from SCA

sage laurel
#

Thank it'll automatically know it's Moto will it?

barren scaffold
#

You still need to pass the MOTO parameter when you create the PI, so yes

#

You just omit the parmaeters where you're passing the card number etc directly

sage laurel
#

๐Ÿ‘

sage laurel
barren scaffold
#

No, you need both. The former creates the Payment Element instance

#

The latter will create a Payment Method object from the card details entered into the Payment Element. You can then use that to create the MOTO Payment Intent

#

I imagine your payment form will have a onSubmit handler, so in that you'd call createPaymentMethod, and then with the result you can make your backend API call to create the PI

sage laurel
#

Can I show you on a jsbin what I have so far

barren scaffold
#

Sure

sage laurel
#

is this along the right lines

barren scaffold
#

Yes, looks good. In your POST to /motointent.php you need to add a payment_method parameter which will be the result of createPaymentMethod

#

Something like:

await fetch("/motointent.php", {
  method: "POST",
  body: JSON.stringify({ payment_method: result.paymentMethod })
})
#

Then you can use that payment_method param in the body in your PHP fucntion that creates te Payment Intent

sage laurel
#

Great when you said previously omit the payment_method_data hash is that in the response, or do you mean just not include that as a parameter in the intent

barren scaffold
#

Remove that from your parameters in the call that creates the Payment Intent. You just need to pass payment_method with that param you're passing from front-end instead

sage laurel
barren scaffold
#

You won't need to call confirmPayment for MOTO payments

sage laurel
#

Will the intent return me a success or somthing?

barren scaffold
#

Pass confirm: true in your PI creation call, it should succeed immediately

sage laurel
#

Giving it a go now, sorry for all the questions

barren scaffold
#

np at all

sage laurel
#

Since I am collecting the payment method as well as amount do I need to pass that to the intent as well?

const options = {
      mode: 'payment',
      amount: 1099,
      currency: 'gbp',
      paymentMethodCreation: 'manual',
    };
#

Do I need to pass the amount to the intent

barren scaffold
#

Yes

#

The amount and currency values need to match between what you initialise the Payment Element with (above) and what you create the intent with

sage laurel
#

OK great it's working - result.paymentMethod gives object so needed to get result.paymentMethod.id

#

Am I just looking for status in the response to see if it succeeded?

#

And thank you for this

quick nacelle
#

Hello ๐Ÿ‘‹
Taking over as ynnoj needs to step away soon.

It is a long running thread, mind giving me a short summary? Looks like you're implementing Defer Intent flow with PaymentElement

sage laurel
#

Ye using it to process MOTO it's all working I just wanting to check how I would know if it completed on the client side is it to just check the status parameter from the object

quick nacelle
#

When you say "it completed" are you asking about the Payment confirmation? If so, yes the PaymentIntent status should reflect this

sage laurel
#

Yes that right

#

Will do,

#

is there a way to omit the postcode field from the payment element

quick nacelle
sage laurel
#

How I do disbale postal collection on payment element, cant see a parameter sorry for my ignorance

quick nacelle
#

Its under fields.billingDetails.address.postalCode
Look at the link I shared above

sage laurel
#

I am not confirming payment as it's 'confirm' => true, in intent (for MOTO). Is there a way to do it in the const paymentElement = elements.create('payment');

#

maybe

quick nacelle
#

Yes, you'd pass the options to .create()

like

    fields: {
      billingDetails: {
        postalCode: 'never'
      }
    }
});```
sage laurel
#

OK that doesn't work, if there's no alternative or MOTO perhaps doesn't support it then it's cool

#

Thank you!