Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with credit cards on customer payment link #23902

Closed
edemonair opened this issue Jun 11, 2019 · 5 comments · Fixed by #43858
Closed

Problem with credit cards on customer payment link #23902

edemonair opened this issue Jun 11, 2019 · 5 comments · Fixed by #43858
Labels
focus: checkout Issues related to checkout page. plugin: woocommerce Issues related to the WooCommerce Core plugin. team: Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues type: bug The issue is a confirmed bug.

Comments

@edemonair
Copy link

edemonair commented Jun 11, 2019

The problem concerns customer payment link and custom payment gateways. The main thing is that customer can't effect payment by credit card. These (WireCard and Micropayment) and most of other plugins alike store payment data in session. Such customers usually visit web-site the first and maybe the last time. It is worth mentioning that shopping cart is empty for such customers.

After a set of tests a problem of non-complete setting of session cookie in browser was found. WC_Session/WC_Session_Handler classes restore woocommerce session, but check whether this cookie is based on $_COOKIE variable. During the render of 'pay-order page' WC_Session/WC_Session_Handler miss functionality for setting wc_session into $_COOKIE. Unfortunately, this functionality for setting cookie into $_COOKIE variable initializes only on the cart page or when customer adds/removes products from shopping cart. Thats why the customer hasn't got any possibility to complete such order as payment gateway passes explicitly to woocommerce session (that wasn't completely set).

Steps to reproduce the behavior:

  1. Go on to 'pay-order' page (http://wp.artemanokhin.com/checkout/order-pay/18/?pay_for_order=true&key=wc_order_PzEY1bg8YMVfw);
  2. Select one from credit card (CC) payments and submit the order.
  3. After that you will get non loading CC form (WireCard) or crashed thank-you page (Micro-Payment).

To sum up, at the point of getting session data, method has_session() is always false, as $COOKIE hasn't got any woocommerce_session param. In addition, before rendering order-pay page or at the point of init_session_cookie(), the app needs to initialize method set_customer_session_cookie() with true param for $cookie = false (and only for the case of pay-order page) for correct payment process with custom gateways (lots of them don't care about pleasant storing of data without session).

non_complete_session_setting

@kloon
Copy link
Member

kloon commented Jun 12, 2019

Give the new wc_load_cart function a go and see if this resolves the issue for you?

@kloon kloon added the needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. label Jun 12, 2019
@edemonair
Copy link
Author

edemonair commented Jun 12, 2019

It doesn't resolve. This bug is present in up-to-date release version 3.6.4. Order-page renders through wc_load_cart() method. But there isn't any process that correctly and fully sets woocomerce session cookie into the browser.

I have made own external fix, but it's really dirty. It was enough for my case, but it doesn't solves the problem in woocommerce core.

add_action('wp', array($this, 'orderPayPageSessionImprovement'), 0);

function orderPayPageSessionImprovement() {
        $page = filter_input(INPUT_SERVER, 'REQUEST_URI');
        if (strpos($page, "order-pay") !== false) {
            do_action('woocommerce_set_cart_cookies', true);
        }
}

@claudiosanches claudiosanches added status: needs review and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Jun 19, 2019
@claudiosanches claudiosanches added type: bug The issue is a confirmed bug. and removed status: needs review labels Aug 1, 2019
@claudiosanches claudiosanches added this to the 3.7.1 milestone Aug 1, 2019
@alorbach
Copy link

I have a simular problem, customers clicking the order-pay/[ordernum]/?pay_for_order=true&key=[orderkey] link can see the shopping card, but once they want to pay with Paypal Plus in my case, they are redirected to the Shopping Card which is empty.

This worked well versions ago :(

@claudiosanches claudiosanches modified the milestones: 3.7.1, 3.8.0 Oct 1, 2019
@vedanshujain vedanshujain modified the milestones: 3.8.0, 3.9.0 Oct 2, 2019
@vedanshujain vedanshujain added the priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. label Oct 2, 2019
@juliaamosova juliaamosova removed this from the 3.9.0 milestone Nov 25, 2019
@claudiosanches claudiosanches removed the priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. label Nov 26, 2019
@ObliviousHarmony ObliviousHarmony added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 21, 2022
@peterfabian peterfabian added priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. focus: checkout Issues related to checkout page. labels May 5, 2022
@rrennick rrennick added the team: Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues label Oct 17, 2023
@pmcpinto pmcpinto removed the priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. label Dec 29, 2023
@mikejolley
Copy link
Member

I realise this is a very old issue which hasn't had any updates in some time, so this may be out of date or had fixes or workarounds in place, but to summarise it seems that:

  • This is a problem affecting certain 3rd party payment gateways, rather than core ones
  • It affects paying for a previous order, not the full cart -> checkout flow, so a user may not have a session

I think if a payment gateway needs to make use of sessions outside of the full cart/checkout flow it should ensure a session is in place. However, I understand that this is not straightforward because cookies need to be set early so the payment method may not get a chance to do so.

I think the best workaround we could implement would be to ensure that a session is created upon entry to the pay for order page, or checkout. It might be difficult to test without an effect extension however. Looking into it.

@mikejolley
Copy link
Member

I've added a fix here: #43858

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: checkout Issues related to checkout page. plugin: woocommerce Issues related to the WooCommerce Core plugin. team: Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues type: bug The issue is a confirmed bug.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.