#Shivam Kumar
1 messages · Page 1 of 1 (latest)
Hi there, can you send me the URL of the doc that you are following?
Thanks, and how did you trigger the dialog?
when i click Test Institution this dialog trigger.
OK, so I believe you are testing with US bank account payment (aka ACH)?
yes
OK, https://stripe.com/docs/payments/ach-debit/accept-a-payment?platform=web&ui=API here's how you can get started with ACH direct debit payment
how i trigger this ACH dialog.
Have you got a chance to read the doc that I sent earlier?
Can Customer add ACH payment method for future payment?
Sure, please feel free to reach out should you have questions.
<script>
var stripe = Stripe('{{ env('STRIPE_PUBLISHABLE_KEY') }}');
var elements = stripe.elements();
var cardElement = elements.create('card');
cardElement.mount('#card-element');
var cardholderName = document.getElementById('cardholder-name');
var cardButton = document.getElementById('card-button');
var resultContainer = document.getElementById('card-result');
var cardSuccess = document.getElementById('card-success');
var csrf_token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
cardButton.addEventListener('click', async (ev) => {
var {paymentMethod, error} = await stripe.createPaymentMethod({
type: 'card',
card: cardElement,
billing_details: {
name: cardholderName.value,
},
}
);
if (error) {
resultContainer.textContent = error.message;
} else {
$.ajax({
type: 'POST',
headers: {
'X-CSRF-TOKEN': csrf_token,
},
url: '{{url('account/bank/addcard')}}',
data: { paymentMethodId: paymentMethod.id },
success: function (response) {
cardSuccess.textContent = "Card Added Successfully.";
$('#empty_modal').modal('hide');
window.location.reload();
},
error: function (error) {
resultContainer.textContent = "Error in add card.";
}
});
}
});
</script>
i wrote this code for add card.
but i did not find any js code for trigger a popup for add a ach bank .
is there a reason why you're not using the Payment Element? and implementing separate logic for card and ACH?