Not correct redirect after payment
-
Hello i have a problem with your plugin. When user click on payment go on Redsys payment page, i try to put all credit cart information and click “Payment” but afeter this anypayment are processing and i’m redirecting to checkout page.
How can i resolve?
Thanks
-
Hi,
When the user completes the payment and clicks on the “complete” button in the redsys page, he is redirected to return the url woocommerce provides to gateways. Usually, this page is a thank you page, which confirms the payment. Check this:
https://www.tychesoftwares.com/how-to-customize-the-woocommerce-thank-you-page/
You can also edit the return url woocommerce provides to gateways by using the filter: woocommerce_get_return_url
An example would be like:
add_filter(‘woocommerce_get_return_url’,’override_return_url’,10,2);
function override_return_url($return_url,$order){
//create empty array to store url parameters in
$sku_list = array();// retrive products in order
foreach($order->get_items() as $key => $item)
{
$product = wc_get_product($item[‘product_id’]);
//get sku of each product and insert it in array
$sku_list[‘product_’.$item[‘product_id’] . ‘sku’] = $product->get_sku();
}
//build query strings out of the SKU array
$url_extension = http_build_query($sku_list);
//append our strings to original url
$modified_url = $return_url.’&’.$url_extension;return $modified_url;
}
Result url will be like this:
Hello and thanks for reply, i try to see the error log and i have this report:
12-07-2018 @ 18:10:33 - Generating payment form for order #162102. Notify URL: https://www.mysite.com/?wc-api=WC_MyRedsys 12-07-2018 @ 18:10:33 - Sending data to Redsys Array ( [Ds_SignatureVersion] => HMAC_SHA256_V1 [Ds_MerchantParameters] => eyJEU19NRVJDSEFOVF9BTU9VTlQiOiIzMjI2IiwiRFNfTUVSQ0hBTlRfT1JERVIiOiIwMDE2MjEwMjEwMzMiLCJEU19NRVJDSEFOVF9NRVJDSEFOVENPREUiOiIwNTUwMDA3OTgiLCJEU19NRVJDSEFOVF9DVVJSRU5DWSI6Ijk3OCIsIkRTX01FUkNIQU5UX1RSQU5TQUNUSU9OVFlQRSI6IjAiLCJEU19NRVJDSEFOVF9URVJNSU5BTCI6IjAwMiIsIkRTX01FUkNIQU5UX01FUkNIQU5UVVJMIjoiaHR0cHM6XC9cL3d3dy50ZWxlZ3Jvdy5jb21cLz93Yy1hcGk9V0NfTXlSZWRzeXMiLCJEU19NRVJDSEFOVF9VUkxPSyI6Imh0dHBzOlwvXC93d3cudGVsZWdyb3cuY29tXC9jaGVja291dFwvb3JkZXItcmVjZWl2ZWRcLzE2MjEwMlwvP2tleT13Y19vcmRlcl81YzBhOWI3N2E3MzVmIiwiRFNfTUVSQ0hBTlRfVVJMS08iOiJodHRwczpcL1wvd3d3LnRlbGVncm93LmNvbVwvY2Fycml0b1wvP2NhbmNlbF9vcmRlcj10cnVlJmFtcDtvcmRlcj13Y19vcmRlcl81YzBhOWI3N2E3MzVmJmFtcDtvcmRlcl9pZD0xNjIxMDImYW1wO3JlZGlyZWN0JmFtcDtfd3Bub25jZT0yNjBkMDg2ZjI3IiwiRHNfTWVyY2hhbnRfQ29uc3VtZXJMYW5ndWFnZSI6IjAiLCJEc19NZXJjaGFudF9Qcm9kdWN0RGVzY3JpcHRpb24iOiIxeEJvbWJpbGxhIDYwMFcgU3lsdmFuaWEgR3JvbHV4IHBhcmEgQ3JlY2ltaWVudG8geSBGbG9yYWNpXHUwMGYzbiIsIkRzX01lcmNoYW50X01lcmNoYW50RGF0YSI6IjFkYzAwMzRjOGVhNjE2ZDU3NTVjYTZhNmJlYzU0NDRlMGYxODBhOGQiLCJEc19NZXJjaGFudF9NZXJjaGFudE5hbWUiOiJUcmFucXVpbGlkYWQtRGlnaXRhbCIsIkRzX01lcmNoYW50X1BheU1ldGhvZHMiOiJDIiwiRHNfTWVyY2hhbnRfTW9kdWxlIjoid29vY29tbWVyY2UifQ== [Ds_Signature] => RGbN/jBkajZMOD6DXWsdQ/KtbSUC0dXz961jR1dClUg= ) 12-07-2018 @ 18:15:56 - Generating payment form for order #162102. Notify URL: https://www.mysite/?wc-api=WC_MyRedsys 12-07-2018 @ 18:15:56 - Sending data to Redsys Array ( [Ds_SignatureVersion] => HMAC_SHA256_V1 [Ds_MerchantParameters] => eyJEU19NRVJDSEFOVF9BTU9VTlQiOiIzMjI2IiwiRFNfTUVSQ0hBTlRfT1JERVIiOiIwMDE2Mj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xlIjoid29vY29tbWVyY2UifQ== [Ds_Signature] => nuyh0CRgWlby/Mwwz2LwRm/t7qJ1/EPO2m6+K9gBPIg= ) 12-07-2018 @ 19:40:34 - Checking notification is valid... 12-08-2018 @ 01:44:31 - Checking notification is valid...
Is a thankyou page problem??
Thanks
I have install thankyou page but the order when pay are not mark as complete (i’ve setting yes on setting “?Marcar el pedido como completado tras el pago?”
Also the strange problem is this. Now after installing “ThankYou Page Plugin” the payment are complete, i redirect on thankyoupage where i continue to display the part of checkout and part of finalized order. On backend i see the order like pending and not processing.
Why? How can i resolve?
Thanks
- This reply was modified 5 years, 11 months ago by serviceweb.
Hi,
When a user makes the payment, Redsys shows him a payment complete page. If the payment was good, this page has a button which takes the user to the URL_OK (usually the thank you page). If the payment gone wrong, the button takes the user to URL_KO. Both URLs are configurable in Woocommerce.
Neither of this URLs has any effect on the order status. It’s a Redsys server which connects to https://www.yoursite.com/?wc-api=WC_MyRedsys and POST data to confirm that the payment was good. These data are signed, so none can forge it and are validated by my plugin.
You have to setup the plugin so the redsys notitication is made with HTTP instead of HTTPS. Also, you have to prevent your site from redirecting https://www.yoursite.com/?wc-api=WC_MyRedsys to https://www.yoursite.com/?wc-api=WC_MyRedsys. I have checked that you are using Cloudflare. You have to configure your account so the payment notification URL https://www.yoursite.com/?wc-api=WC_MyRedsys is never cached by cloudflare, and it’s always redirected to your server. You have also to assure that Cloudflare is not blocking the Redsys connections. If you don’t know how to do this, don’t use Cloudflare.
Check this: https://colibris.es/redsys-woocommerce-cloudflare-pedidos-pendientes-pago/
You have to check your server logs to assure you are not blocking Redsys connections to the payment verify URL (https://www.yoursite.com/?wc-api=WC_MyRedsys), some security plugins prevent Redsys from connecting to notify the payment and shows a HTTP 403 Forbidden status code. Disable any security plugins like wordfence to see it his is the problem.
Check that the secret key is correct in the plugin configuration. It has to be the same you entered in the TPV in your bank.
Kind regards,
Resolved. The site was using SNI. Removed HTTPS redirection for notification URL.
Please can you tell me exactly how you removed HTTPS redirection for notification URL.
Thank you in advance ??
Hi,
There are several ways to prevent the Redsys notification query being redirected to HTTPs. It depends on your hosting configuration and web server. Do you use a cache service like Cloudflare? Is your hosting Windows or Linux based? Do you have a control panel (Plesk, Cpanel) to set up your hosting?
I need more info to tell you how to avoid this redirection. The most common configuration is a Linux OS with Apache web server. In this case, you have to open the .htaccess file in your web server root folder and search for something similar to this:
RewriteEngine On
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteCond %{QUERY_STRING} !wc-api [NC] <– you have to add this line
RewriteRule ^(.*)$ https://tudominio.com/$1 [R=301,L,NE]Kind regards,
- The topic ‘Not correct redirect after payment’ is closed to new replies.