Support » Plugin: Braintree For WooCommerce » Charged twice after getting blank page on checkout

  • Resolved blazc

    (@blazc)


    We are having difficulties with our Braintree for Woocommerce payment system on web store with credit card payments.
    When user is on the final step of entering credit card details and then proceeding with payment, it redirects him to a blank page. After that customers usually go back to the page with payment details and commit another payment, the second time it goes through successfully and does not get stuck on the blank page anymore. But it charges them twice.
    This started happening a month ago, but only sometimes, on random products and on both VISA and MasterCard credit cards.

    At first I asked Braintree’s official support and they replied with the following:

    It sounds like customers are seeing duplicate transactions because the checkout page doesn’t confirm the successful transaction. This issue sounds like it would be an issue with the client-side result handling. Since it’s occurring on the client-side I’m not able to fully see the issue though.

    From what I can see, two API calls were sent to process. Since the first one was not confirmed successfully on the client side the customer submitted another API call by clicking the “pay” button.

    This could result when the result object isn’t being handled properly for that transaction. It looks like you’re using a third-party shopping cart called Braintree for WooCommerce. I would recommend reaching out to their support directly to take a look into your checkout page. They may be able to pinpoint how the result object is handled and help ensure that doesn’t continue.

    They suggested to ask for further help here.

    Thank you all in advance,
    Blaž

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author mr.clayton

    (@mrclayton)

    Hello @blazc,

    I checked your website and I believe I know the reason for your double charge. You have an exception that is occurring during your checkout process.

    When I processed a mock payment, the server responded with a 500 HTTP response code. That means the code encountered an unrecoverable error. The error is most likely happening after the plugin processes the payment so the customer is charged but the redirect to the order received page doesn’t happen.

    You should look in your servers logs to determine the location of the error and that will tell us which plugin is causing issues.

    Kind Regards,

    @mrclayton thank you for a quick response.

    I did check my error_log and it seems that the only error that occurs before the customers payment (sometimes it could be less than an hour before, sometimes even a few hours), but after that error, the next purchase seems to suffer the glitch.

    Here is the stack trace:

    PHP Fatal error:  Uncaught Error: Call to a member function get_id() on array in /home/liashop/public_html/wp-content/plugins/woo-payment-gateway/includes/braintree-wc-functions.php:804
    Stack trace:
    #0 /home/liashop/public_html/wp-content/plugins/woo-payment-gateway/includes/braintree-wc-functions.php(777): bwc_get_3_0_0_deprecated_order_prop('id', Array)
    #1 /home/liashop/public_html/wp-content/plugins/woo-payment-gateway/includes/braintree-wc-functions.php(782): bwc_get_order_property('id', Array)
    #2 /home/liashop/public_html/wp-content/plugins/woo-payment-gateway/includes/class-wc-braintree-gateway.php(1854): bwc_get_order_property('payment_method', Array)
    #3 /home/liashop/public_html/wp-content/plugins/woo-payment-gateway/includes/class-wc-braintree-gateway.php(236): WC_Braintree_Payment_Gateway::is_3ds_vaulted_nonce(Array)
    #4 /home/liashop/public_html/wp-includes/class-wp-hook.php(286): WC_Braintree_Payment_Gateway->process_order(Array)
    #5 /home/liashop/public_html/wp-includes/plugin.php(208): WP_Hook->apply_filters(Array, in /home/liashop/public_html/wp-content/plugins/woo-payment-gateway/includes/braintree-wc-functions.php on line 804
    • This reply was modified 4 months, 1 week ago by blazc.
    • This reply was modified 4 months, 1 week ago by blazc.

    I would also mention that on test environment it doesn’t give this error
    Test environment
    WordPress version: 4.9.10
    WooCommerce version: 3.5.5
    Braintree for WooCommerce: 2.6.53

    production environment
    WordPress version: 5.1.1
    WooCommerce version: 3.5.4
    Braintree for WooCommerce: 2.6.64

    • This reply was modified 4 months, 1 week ago by blazc.
    • This reply was modified 4 months, 1 week ago by blazc.
    Plugin Author mr.clayton

    (@mrclayton)

    Hi @blazc,

    The method process_order is only ever called by WC when a payment is being processed. It expects a WC_Order object always or an exception will be thrown. Do you have any custom code on your production server that’s using the plugin’s filters?

    It’s possible your code is passing the array instead of the expected order. You mentioned that those logs were up to an hour before the error which is odd. Did you pull that stack trace from the WC logs? If so can you dive deeper in to your actual server logs? There may be some missing entries.

    When I tested your site I got an immediate HTTP 500 response which indicates a server error. That error should be logged in your server error logs.

    We are asking merchants to test our release candidate 3.0.0 before we release it to the WordPress repo. Can you try it and see if you get the same error?

    https://support.paymentplugins.com/hc/en-us/articles/360026512014-3-0-0-Release-Candidate

    Kind Regards,

    blazc

    (@blazc)

    We did update your plugin to 3.0.0 and to the newest WP and WC versions. I will report back on monday if there are improvements.

    The only plugin that extended checkout gateway was “WooCommerce PayPal Checkout Gateway”, but since the Paypal gateway is in your Braintree plugin, we shall switch to that.

    Thanks,
    Blaž

    • This reply was modified 4 months ago by blazc.
    • This reply was modified 4 months ago by blazc.
    Plugin Author mr.clayton

    (@mrclayton)

    @blazc,

    Now that you are using our release candidate I attempted to process an order on your site using a card that would return a processor decline message. The attempt was successful and the 500 HTTP code was not present.

    In the previous version of the plugin we attached a filter to the process_order function where you were seeing that exception. I wonder if you were using that filter for anything and passing back an unexpected object type.

    Kind Regards,

    blazc

    (@blazc)

    I am not sure what was causing it before, but it seems to work now.
    Thank you for your help.

    Best regards,
    Blaž

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.