#iavn_chh-Elements

1 messages · Page 1 of 1 (latest)

clever oxide
#

Hi, how can we help?

weary wadi
#

I am implementing the Stripe checkout with Elements, and when the user wants to pay for a product, they are not being redirected to the checkout process. Here I have my code, I do not know if I am missing something ... Or I am not understanding how to implement it.
var stripe = Stripe('pk_test_XXXX', {
betas: ['payment_element_beta_2']
});

                        var options = {
                            clientSecret: @ClientSecret,
                        };
                        var elements = stripe.elements(options);
                        var paymentElement = elements.create("payment");


                        Promise.resolve(
                            stripe.confirmPayment({
                                elements,
                                confirmParams: {
                                    // Return URL where the customer should be redirected after the PaymentIntent is confirmed.
                                    return_url: 'https://example.com',
                                },
                            })
                        ).then(function (result) {
                            console.log(result);
                        }).catch(function (error) {
                            console.log(error)
                        }
                        );
#

Also, testing the code, what happens is that an exception is thrown, but the error object is empty.

#

Hello, could someone help me?

clever oxide
#

Hi, sorry for the late response. Let me TAL

#

Hi, sorry the Doc might be misleading. Could you try to pass in paymentElement instead of elements, on the call to stripe.confirmPayment?

weary wadi
#

Yes, I have tried that, the confirmPayment call does not allow the paymentElement object since it does not have the options object inside.

bleak wyvern
#

bad timing, I still need to watch our internal training on this new Element(it's not public yet)

#

what's the exact error you're getting though?

weary wadi
#

Ok, I was getting confused, so I have to paint the Iframe on my website and there is no redirection, would you have a guide how to implement this? Because the one that exists ( https://stripe.com/docs/payments/payment-element ) is quite poor

The Payment Element is a secure, embeddable UI component that allows you to accept local payment methods from around the globe.

bleak wyvern
#

if you're in that beta then that page has the full details of using the Payment Element