#daydreamix

1 messages · Page 1 of 1 (latest)

lyric nestBOT
weak crater
#

Depends. If you use PaymentElement, yes

#

PaymentRequestButton, no

slate wigeon
#
            var stripe = Stripe(stripe_data.public);
            const elements = stripe.elements();

            var element = document.querySelector("#card-element");
            var form, buttons_element;
            if (element) {
                var card = elements.create('card');
                form = element.closest('form[data-type="form"]');
                buttons_element = form.querySelector("#payment-request-button");
                card.mount('#card-element');
            }```

I do use PaymentElement. 

What is the best practice for creating payment intents? User experience is bad when I create it after user has finally gone through adding their email, shipping details and then finally select credit card it then loads (creating a payment intent) and then renders the credit card form. 

But is it right to create payment intents earlier even if a user ends up not officially paying and then there is just a payment intent sitting in stripe?

Ideally I would have the stripe form ready when a user clicks credit card so they can immediately enter vs having to wait till it loads.
weak crater
#

This is the Card Element iirc

slate wigeon
#

Loading state

weak crater
#

It's fine to create PaymentIntent beforehand, and leave it if customer decide to not pay. It's an "intent" eventually

slate wigeon
#

Rendered

weak crater
#

Oh this is PaymentElement indeed

slate wigeon
#

Maybe referenced old code.

#

A payment intent wont create a customer will it?

weak crater
#

It won't, but it can accept an existing customer id

slate wigeon
#

What are the requirements to creating a payment intent?

weak crater
slate wigeon
#

OK thanks! Gonna rework my checkout. ❤️

lyric nestBOT