202-ecommerce / stripe_official

After years of hard work with Stripe connector for PrestaShop, 202 ecommerce stop the development of Stripe module on January 9th 2023. Thanks for all contributors that help us!
20 stars 20 forks source link

Successful Orders redirecting to order history instead of confirmation page #185

Closed mrjcgoodwin closed 2 years ago

mrjcgoodwin commented 2 years ago

In 2.4.6 with PrestaShop 1.7.7.2 we are finding that successful Stripe payments are being sent to the order history page rather than the order confirmation page. This means that Google Analytics conversion events for purchases are not being fired.

_I think this may be a similar issue as https://github.com/202-ecommerce/stripe_official/issues/90 but I'll post fresh as the other one has been closed last year even though the issue seems to persist._

I have tried amending orderConfirmationReturn.php along the lines of issue #90:

/*
$url = Context::getContext()->link->getModuleLink(
                'stripe_official',
                'orderSuccess',
                $data,
                true
            );
*/
            $url = Context::getContext()->link->getPageLink(
                'order-confirmation',
                true,
                null,
                array(
                    'id_cart' => (int)$this->context->cart->id,
                    'id_module' => (int)$this->module->id,
                    'id_order' => (int)$id_order,
                    'key' => $secure_key
                )
            );

However it's not rectifying the issue. Something else is causing the incorrect redirect that I've not yet been able to locate.

I may be way off but I'm wondering if it could be because the URL doesn't match when the Stripe intent is created in createIntent.php.

$this->context->link->getModuleLink

clotairer commented 2 years ago

Hello, the issue #90 is not linked to your issue. You’ est an error during the process validateOrder trigger by the webhook called by Stripe. If after 30s, the order is not created (Stripe cannot call the webhook or you have an error during creation) thé user is redirected to the history page instead of summary page because it’s already available. You can check in the table ps_stripe_official_processlogger if you have error logs. We can assist you be sending is an message on addons.prestashop.com, page stripe official and « contact the developper ».

mrjcgoodwin commented 2 years ago

Hello, the issue #90 is not linked to your issue. You’ est an error during the process validateOrder trigger by the webhook called by Stripe. If after 30s, the order is not created (Stripe cannot call the webhook or you have an error during creation) thé user is redirected to the history page instead of summary page because it’s already available. You can check in the table ps_stripe_official_processlogger if you have error logs. We can assist you be sending is an message on addons.prestashop.com, page stripe official and « contact the developper ».

Thank you for the quick response. I haven’t noticed any issues in the Stripe logs with webhook failures but will look into this thank you.

mrjcgoodwin commented 2 years ago

Hi @clotairer, Thanks again for your feedback yesterday.

I've checked the Stripe webhook logs. There's no errors and events are being successfully sent to the following 8 endpoints on {SITE}/module/stripe_official/webhook which I assume is correct?

charge.captured
charge.dispute.created
charge.expired
charge.failed
charge.pending
charge.refunded
charge.succeeded
payment_intent.requires_action

I also can't see any obvious errors in the Process Logger table. Would you expect to see explicit errors in here, or would you need to know something is missing or not happening?

Thank you.

clotairer commented 2 years ago

Can you tell me if all orders are redirected or only once up on a time ? Is order regularly created ? With the rugby status ? If a module have an error on validateOrder PrestaShop hook, the creation can fail. Is it for credit card or other payment method ? For an order paid with a redirection on history page, could you have look on all date Time event :

mrjcgoodwin commented 2 years ago

Can you tell me if all orders are redirected or only once up on a time ? Is order regularly created ? With the rugby status ? If a module have an error on validateOrder PrestaShop hook, the creation can fail. Is it for credit card or other payment method ? For an order paid with a redirection on history page, could you have look on all date Time event :

  • paid date time
  • Webhook call date Time
  • Redirection date
  • … All actions take 1 to 3s.

I don't see any issues with timing - we've set the limits to 1hr (3600) and there's no time outs logged on the server or failed webhooks we can see. The orders all seem to create ok, statuses are updated to 'payment accepted' and emails are triggered etc.

I have noticed that the process_logger table hasn't been updating as recently as I thought - I just noticed the entries are 2021 not 2022. How do I re-enable logging for the module or is this triggered by Prestashop debug mode?

The only other thing I've noticed that may be odd is that in the order details we have a few undefined items for the card details. Is this normal behaviour or should they be getting populated?

Screenshot 2022-10-22 at 11 20 13

Edited as I forgot to answer your other question: All other order types - e.g. bank transfer redirect correctly. It's only the Stripe payments that go to the order history page.

mrjcgoodwin commented 2 years ago

I've installed your diagnostic tool I saw in another thread and it's highlighted a couple of overrides we have in place. I'll try disabling these and report back. Thanks again for your help so far :-)

mrjcgoodwin commented 2 years ago

Hi @clotairer - I just wanted to let you know that thanks to your diagnostic module I believe we've now found an overrides conflict in the code of another module. Thank you for your help troubleshooting this!