flappingfish:
Apparently this module relies on the user returning to the website to note the payment was a success and there is no webhook file which can result in an order being placed and paid for but not being recorded??
Stripe library has a "webhook.php" which apparently isn't the file i should point too in stripes dashboard under webhooks settings?
I have had a number of these unrecorded orders and always put it down to checkout rush but on another site with the same module and no checkout rush issues i found a revolut payment was taken from my customer but the system treated it like they had not paid and their basket remained filled with the items.
Do I set the url to '/checkout_success' or does this module require a "/stripe_webhook.php" as chatgpt suggests? (provided below but... the code it provided for this looks like it has placeholders and a few details wrong.. made up functions ect lol)
I've been looking into this as well, and my conclusion is that it's more complicated than you might think.
Basically the idea is that you can use a webhook to catch successful payments when the customer for some reason doesn't return to the confirmation page, and let the server handle the order.
Setting the webhook url to the success page won't do the trick because you want the payment to be processed first. Setting it to the confirmation page won't work either, because there's no customer, so there's no session, and nothing will be processed.
In theory you could set it to the confirmation page (or directly to main_page=checkout_process) with the session id in the url to restore the session, and thus make the necessary information available to process the order. However, there's no customer logged in, so stripe will be thrown out. You might circumvent that, and write an alternative checkout_process module, but I think you must really know what you are doing to keep that secure.
There could be another reason for these unrecorded orders though. You might want to make sure that the process for return based payment methods is working correctly, because for me it wasn't.
I encountered three problems:
-
As already pointed out by bahlir, the $confirmationURL needs to be changed or you will get an error
-
If you require conditions to be checked, the conditions will not be posted when the customer returns to the page, and will be redirected to the payment page,
I fixed that with a check in the header.php
$stripeRedirect = false;
if (isset($_GET['redirect_status'])) $stripeRedirect = true;
if (DISPLAY_CONDITIONS_ON_CHECKOUT == 'true' && !$stripeRedirect) {
if (!isset($_POST['conditions']) || ($_POST['conditions'] != '1')) {
$messageStack->add_session('checkout_payment', ERROR_CONDITIONS_NOT_ACCEPTED, 'error');
}
}
- When the customer is redirected to the confirmation page the javascript variables set by create.php have gone out of scope. Without a PublishableKey the script will return an error and nothing happens. I was able to fix that by redeclaring this variable in the jscript_stripe.php when $stripeRedirect is true, but there is probably a more elegant solution, if you know more about Javascript than I do.
I'm testing the Stripe.com payment integration module using ZC 2.1.0 without OPC, but it's possible that you have the same problem in your setup, and that might be another reason why orders have been paid for but are not processed.
You need to choose a redirect based payment method to test this. I'm now testing IDEAL, a payment method that is popular in the Netherlands.