#bit - confirm sepa

1 messages ยท Page 1 of 1 (latest)

primal parrot
#

hey there, please be patient, many users here right now

white timber
#

sure ๐Ÿ™‚ I'll write down the problem in the meanwhile, take all the time you need, and thanks in advance for your help

primal parrot
#

Yea, and please share the request ID where you get the error

white timber
#

pi_3KZU3BDdn72I1qqY2o0lOhdK

#

const listener = async event => {
// Show a loading screen...
showSpinning();
event.preventDefault();

                            stripe.createPaymentMethod({
                                type: 'sepa_debit',
                                sepa_debit: elements.getElement('iban'),
                                billing_details: {
                                    name: document.getElementById("name-element").value,
                                    email: document.getElementById("email-element").value,
                                }
                            }).then(function (result) {
                                if (result.error) {
                                    showFancyError('Errore - il pagamento non รจ stato effettuato!', result.error.message);
                                } else {
                                    if (result.paymentMethod) {
                                        if (result.paymentMethod.sepa_debit && result.paymentMethod.sepa_debit.bank_code
                                            && result.paymentMethod.sepa_debit.bank_code == '02008') {
                                            showNoUnicreditPlease();
                                            return;
                                        }
                                        else
                                            confirmPayment(result.paymentMethod);
                                    }
                                }
                            })
                        }
#

function confirmPayment(paymentMethod) {
stripe.confirmSepaDebitPayment('<%=ClientSecret%>', {
payment_method: paymentMethod
}).then(function (result) {
hideSpinning();

                                if (result.error || result.paymentIntent.status === 'payment_failed') {
                                    showFancyError('Errore - il pagamento non รจ stato effettuato!', result.error.message);
                                } else {
                                    if (result.paymentIntent.status === 'succeeded' || result.paymentIntent.status === 'processing') {
                                        showSuccessTransaction();
                                    }
                                    else
                                        alert('result.paymentintent.status pagamento NON effettuato - errore status sconosciuto: ' + result.paymentIntent.status);
                                }
                            });
                        }
                        form.addEventListener('submit', listener);
#

sorry it has some text in italian

#

mainly, I create a paymentMethod, I check for some bank codes I don't want to accept, and this works... so I get the paymentMethod correctly

#

then I pass the paymentMethod as a parameter to my "confirmPayment" function

primal parrot
#

Whats the actual request/ error you encounter? In which part of this?

white timber
#

when I send the stripe.confirmSepaDebitPayment

#

I use the "paymentMethod" I took from the parameter of the function

#

and the result is the one you can see in the paymentIntent above

#

so the problem is in the confirmPayment function, I suppose

#

the api answer is:

primal parrot
#

Which lines exactly are you referring to? I only see the confirmation with the elements.get(iban). Is there another one?

#

It sounds like you have a version with an existing payment method being provided

#

in which case you'd only send the ID, not the object

white timber
#

ahhhhhhhhhhh

primal parrot
#

eg payment_method: 'pm_123'

white timber
#

let me try

#

he didn't like it

primal parrot
#

Can you share teh actual request ID from the network?

white timber
#

maybe I found the problem

#

req_uKaIfkv8K7sqKZ

#

the payment_intent is on "processing"

#

my fault

primal parrot
#

Yes it looks like you're trying to confirm the same payment again, you need to use a new one to test this

white timber
#

you made my day ๐Ÿ™‚

primal parrot
#

Hooray!

#

Glad i was able to help ๐Ÿ˜„

white timber
#

๐Ÿ‘