#jatinpatel0708

1 messages · Page 1 of 1 (latest)

tender oysterBOT
fading inlet
celest lotus
#

paymentMethodForm.addEventListener('submit', (ev) => {
ev.preventDefault();
const accountHolderNameField = document.getElementById('account-holder-name-field');
const emailField = document.getElementById('email-field');
var posting = [];
posting.push({name: 'name', value: accountHolderNameField});
posting.push({name: 'email',value: emailField });

         $.ajax({
            type: 'POST',
            url: "{{ route('create.bank.payment.intent') }}",
            data: posting,
        success: function (response) {

       console.log(response);
       const clientSecret = response.data.client_secret;
       console.log(clientSecret);
      // Calling this method will open the instant verification dialog.
      stripe.collectBankAccountForPayment({
        clientSecret: clientSecret,
        params: {
          payment_method_type: 'us_bank_account',
          payment_method_data: {
            billing_details: {
              name: accountHolderNameField.value,
              email: emailField.value,
            },
          },
        },
        expand: ['payment_method'],
      })
      .then(({paymentIntent, error}) => {
        if (error) {
          console.error(error.message);
        } else if (paymentIntent.status === 'requires_payment_method') {
        } else if (paymentIntent.status === 'requires_confirmation') {
            console.log('require confirm');
        }
      });

        } });
      });
#

here is my code where I need to confirm payment intent, server side or client side?

fading inlet
celest lotus
#

it means I need to replace this code
stripe.collectBankAccountForPayment({
clientSecret: clientSecret,
params: {
payment_method_type: 'us_bank_account',
payment_method_data: {
billing_details: {
name: accountHolderNameField.value,
email: emailField.value,
},
},
},
expand: ['payment_method'],
})
.then(({paymentIntent, error}) => {
if (error) {
console.error(error.message);
} else if (paymentIntent.status === 'requires_payment_method') {
} else if (paymentIntent.status === 'requires_confirmation') {
console.log('require confirm');
}
});

============to ==================
confirmationForm.addEventListener('submit', (ev) => {
ev.preventDefault();
stripe.confirmUsBankAccountPayment(clientSecret)
.then(({paymentIntent, error}) => {
if (error) {
console.error(error.message);
// The payment failed for some reason.
} else if (paymentIntent.status === "requires_payment_method") {
// Confirmation failed. Attempt again with a different payment method.
} else if (paymentIntent.status === "processing") {
// Confirmation succeeded! The account will be debited.
// Display a message to customer.
} else if (paymentIntent.next_action?.type === "verify_with_microdeposits") {
// The account needs to be verified via microdeposits.
// Display a message to consumer with next steps (consumer waits for
// microdeposits, then enters a statement descriptor code on a page sent to them via email).
}
});
});

fading inlet
#

you shouldn't replace the code - it's an addition

celest lotus
#

okay, Thanks where I need to add it please let me know

tender oysterBOT
jagged breach
#

Hi @celest lotus , I'm taking over. Let me know if you have any follow-up questions.

celest lotus
#

I am trying to integrate an ACH direct debit
but i am getting the status is "requires_confirmation",
i have already sent a code

jagged breach
#

Do you have the PaymentIntent ID?

celest lotus
#

here is payment intent id
pi_3N8FMvGbE4TMTQU01pdc03oI

#

now i am getting the payment status is pending

jagged breach
#

It's already succeeded

celest lotus
#

yes, after sometimes is confirm the payment,
why is not confirm instance

jagged breach
#

ACH is a delayed payment method, so the payment can't be confirmed instantly.

celest lotus
#

okay, Thanks

#

when we get this status: "verify_with_microdeposits"