#teamtalk
1 messages ยท Page 1 of 1 (latest)
Is there a specific error?
Ye I get this
Uncaught (Status 402) (Request req_aNW2rKb9tSqSFs) Sending credit card numbers directly to the Stripe API is generally unsafe
๐
I haven't been able to make it work anywhere yet
They told me it's enabled and I can see the docs
Ah, ok. This is unrelated to MOTO specifically and more sending PAN data: https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Is this a prerequisite to Moto?
1 moment
I'd recommend writing in to our team about this: https://support.stripe.com/contact
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
The issue isn't specific to your integration or API calls, so not something I can help with
What is it related to if you don't mind me asking
Explains it
FWIW, you can tokenise with Elements and use MOTO which is likely the recommended approach
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
Not specifically. Are you using Elements currently?
Yes
Which? Payment Element? Card?
Payment element
Ok, you want to do this: https://stripe.com/docs/payments/accept-a-payment-deferred
Passing paymentMethodCreation: 'manual': https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=payment#additional-options
Then you can call createPaymentMethod with the Elements instance: https://stripe.com/docs/js/payment_methods/create_payment_method_elements
That will give you a pm_xxx ID that you can pass to your PI creation call (https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method) and omit the payment_method_data hash
That way you're not handling any card data and can use MOTO
Perfect I will give that a go and if I get stuck I'll reach back thank you!
Will this request sca at any point
That will depend on the issuer's bank...
No as MOTO is exempt from SCA
Thank it'll automatically know it's Moto will it?
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
๐
Intead of using elements.create('payment'); I shoul use stripe .createPaymentMethod({elements}) ?
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
Can I show you on a jsbin what I have so far
Sure
here's what i have so far https://pastebin.com/X3cE0p3d
is this along the right lines
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
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
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
Hey, so do I after this just then confirm the payment stripe.confirmPayment with the client secret?
You won't need to call confirmPayment for MOTO payments
Will the intent return me a success or somthing?
Pass confirm: true in your PI creation call, it should succeed immediately
Giving it a go now, sorry for all the questions
np at all
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
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
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
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
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
When you say "it completed" are you asking about the Payment confirmation? If so, yes the PaymentIntent status should reflect this
Yes that right
Will do,
is there a way to omit the postcode field from the payment element
You can set the postal_code to never when you create PaymentElement
https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-fields-billingDetails-address-postalCode
I don't know if it works differently for MOTO payments but typically if you set it to never and disable postalcode collection on PaymentElement then you'd need to pass it manually when calling confirmPayment
Again, not sure if MOTO is exempt from this. Would recommend giving it go in test mode
How I do disbale postal collection on payment element, cant see a parameter sorry for my ignorance
Its under fields.billingDetails.address.postalCode
Look at the link I shared above
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
Yes, you'd pass the options to .create()
like
fields: {
billingDetails: {
postalCode: 'never'
}
}
});```