ethercreative / web-payments

Web Payments for Craft Commerce
Other
5 stars 7 forks source link

Error on completion: "Call to complete() was ignored because it has already been called. Do not call complete more than once." #26

Open hassanmah opened 2 years ago

hassanmah commented 2 years ago

Hey, I get the following error in console when payment is completed and it stops the page from redirecting.

Call to complete() was ignored because it has already been called. Do not call complete more than once.

My code is as follows

{{ craft.webPayments.button({ cart: craft.commerce.carts.cart, requestDetails: ['name', 'phone'], onComplete: { redirect: '/shop/checkout/order/number={number}', js: 'window.paymentCompleted(cwp.number);', }, requestShipping: 'delivery', style: { height: '52px', } }) }}

Anyone come across this before?

Thanks

Tam commented 2 years ago

Can you share what network requests are sent to Stripe?

hassanmah commented 2 years ago

@Tam This is what I see in console:

image

This is what comes up when I click on the error:

image

Thanks

PS. Can I email you the requests as it's a sensitive project and screenshots expose the URL.

Tam commented 2 years ago

@hassanmah You can email dev@ethercreative.co.uk

goodmixer commented 2 years ago

Having similar issue with page not redirecting after payment.

{{ craft.webPayments.button({ style: { theme: 'light-outline', height: '64px' }, cart: craft.commerce.carts.cart, requestShipping: false, onComplete: { redirect: '/shop/customer/order?number={number}', js: 'window.paymentCompleted(cwp.number);', }, }) }}

cole007 commented 8 months ago

Hi.

We're experiencing a similar issue (Craft Pro 4.7.1 with Craft Commerce 4.4.1.1, Stripe for Craft Commerce 4.1.1 and Web Payments | 4.0.0).

Web payments not completing and after modal pop-up (in browser scenario) user is returned to the payment page as if nothing has happened. In the back-end under the cart (Orders > Attempted Payments) I can see a transaction has been attempted with a status of Redirected but with A Gateway Code of null.

As with others the browser console says

Call to complete() was ignored because it has already been called. Do not call complete more than once.

Any thoughts on resolving?

Cole