#yen6305
1 messages ยท Page 1 of 1 (latest)
Can you share the example PaymentIntent?
Yes ofcourse
const paymentIntent = await stripe.paymentIntents.create({
amount: totalAmount,
currency: "eur",
payment_method_types: ['card', 'ideal', 'paypal'],
// capture_method: 'manual',
// automatic_payment_methods: {
// enabled: true,
// },
metadata: metadata,
});
Ah I meant, PaymentIntent ID (pi_xxx)
Or a request ID (req_xx) should work too
thanks, let me check..
Are you sure that the code you shared above is the one thats running?
The request body doesn't contain payment_method_types , it used automatic_payment_method instead
https://dashboard.stripe.com/logs/req_LI1Sq3M2zyb9Hy
Can you restart your server and create a new PaymentIntent?
A fresh example would help
Okay
also try providing a higher amount (currently you're only setting 0.50)
Oh the problem might be that the amount is too low?
Please give me a sec
I've set it on 0.50 on purpose tho, cause i am also testing on production
I see. We strongly recommend against testing in production.
Card networks don't really like that.
No I meant, I tested it locally first with the Stripe CLI
After that I checked if it worked on production
Is that a bad practicw?
Ah I thought you meant you're using your Live API keys for testing.
Using Live API keys for testing is against card network recommendations.
You can use your Test API keys to run test scenarios in production environment.
Oh eh shit yeah I have been using live API keys for testing on production. Because I was wondering if it worked with real credit card details
Is that wrong?
Yeah.. If the code works in test mode with test cards, it should work just fine with live mode.
Ah so, okay ill stop testing with real card details
Actually, what happens with the card network if you do tho?
Because ive done it multiple times, just to check if the real credit details were working or not
Not sure as I've not really looked into aftermaths of testing in live mode
Our support team would be able to provide a deeper context on that
https://support.stripe.com/?contact=true
Ah oki
Could you help me with something?
Can you see why I get this error https://api.stripe.com/v1/payment_intents/pi_3NkTYbD7Shm9DtKO1vdtIBYo/confirm 400
Everything worked yesterday and i havent changed my code since then so i am not sure why this error is occuring
The error message is quite clear no?
https://dashboard.stripe.com/test/logs/req_rMJnFHtsMroQDf
Payment details were collected through Stripe Elements using automatic payment methods and cannot be confirmed with a Payment Intent configured with payment_method_types
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Oh, wait
Yeah here right?
const paymentIntent = await stripe.paymentIntents.create({
amount: totalAmount,
currency: "eur",
payment_method_types: ['card', 'ideal', 'paypal'],
// capture_method: 'manual',
// automatic_payment_methods: {
// enabled: true,
// },
metadata: metadata,
});
yup
But I've commented out automatic_payment_methods
You are using deferred intent flow where you collect payment method information before creating a PaymentIntent.
if you don't set paymetnMethodTypes when you create elements then that means you're using automatic payment methods client-side
https://stripe.com/docs/js/elements_object/create_without_intent#stripe_elements_no_intent-options-paymentMethodTypes
So the PaymentMethod you collected was collected with automatic_payment_method: true by default on client-side which doesn't match payment_method_types: ['card', 'ideal', 'paypal'], server-side
Either you'd need to pass payment method types on both (client-side and server-side) OR remove it from server-side call
Ah okay
I am using Payment Element tho
Is it possible to pass it in the options? (client-side)
Like this:
const paymentElementOptions = {
layout: "tabs",
paymentMethodTypes: ['card', 'ideal', 'paypal'],
};
And then
<PaymentElement id="payment-element" options={paymentElementOptions} />
Okay this doesnt work lol
Oh shi it works! Thanks a lot ๐
NP! ๐ Happy to help