#Shivam Kumar

1 messages · Page 1 of 1 (latest)

warm orbitBOT
quasi jungle
#

Hi there, can you send me the URL of the doc that you are following?

teal ingot
quasi jungle
#

Thanks, and how did you trigger the dialog?

teal ingot
#

when i click Test Institution this dialog trigger.

quasi jungle
#

OK, so I believe you are testing with US bank account payment (aka ACH)?

teal ingot
#

yes

quasi jungle
teal ingot
#

how i trigger this ACH dialog.

quasi jungle
#

Have you got a chance to read the doc that I sent earlier?

teal ingot
#

Can Customer add ACH payment method for future payment?

quasi jungle
teal ingot
#

ok thank you

#

if i have any problem regarding this , can you help me?

quasi jungle
#

Sure, please feel free to reach out should you have questions.

teal ingot
#

<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 .

sharp latch
#

is there a reason why you're not using the Payment Element? and implementing separate logic for card and ACH?