craigchristenson / woocommerce-2checkout-api

2Checkout Payment API WooCommerce Payment Module
MIT License
57 stars 43 forks source link

Authorization Failed. No Items Selected. #36

Open ahmednabik opened 6 years ago

ahmednabik commented 6 years ago

Hi, recently I am getting the authorization failure with "No Items Selected" error. I know this is not an issue with the cards as I have personally tried checking out with multiple valid cards. What can be the cause of that Issue? I can post screenshot from 2CO API Call log if it helps.

Thanks

RomanStone commented 5 years ago

++ Same Problem.

Found More info: issues/43 issues/34 issues/17

Checked address/phone, billing info. No luck

[Added] Found related errors in wp-content/debug.log [10-Sep-2019 14:40:27 UTC] PHP Notice: Undefined property: WC_Gateway_Twocheckout::$notify_url in wp-content/plugins/twocheckout/wc-twocheckout.php on line 364

RomanStone commented 5 years ago

OK Found what was wrong "Checkout Fields editor plugin" Open your checkout page and make sure that ALL FIELDS ARE ENABLED AND VISIBLE (billing fields too) those fields are used by 2CO payment (generate token)

nobel0 commented 4 years ago

OK Found what was wrong "Checkout Fields editor plugin" Open your checkout page and make sure that ALL FIELDS ARE ENABLED AND VISIBLE (billing fields too) those fields are used by 2CO payment (generate token)

Thank you very much for your comment, it helped me figure out what is happening to my store :) It turned out because i am using a custom checkout plugin (Custom Fields WooCommerce Checkout Page By Jcodex) and it make a lot of troubles always getting authorization failed and lost so many sales because of that.. Man it ruined everything even facebook ads.. Thanks so much.

nobel0 commented 4 years ago

OK Found what was wrong "Checkout Fields editor plugin" Open your checkout page and make sure that ALL FIELDS ARE ENABLED AND VISIBLE (billing fields too) those fields are used by 2CO payment (generate token)

Can you help me pls, i am getting this error again, i thought it was solved but it is not. I am using woofunnel and it styles my checkout page, but it gives that error "authentication failed"???

Thanks

ahmednabik commented 4 years ago

OK Found what was wrong "Checkout Fields editor plugin" Open your checkout page and make sure that ALL FIELDS ARE ENABLED AND VISIBLE (billing fields too) those fields are used by 2CO payment (generate token)

Can you help me pls, i am getting this error again, i thought it was solved but it is not. I am using woofunnel and it styles my checkout page, but it gives that error "authentication failed"???

Thanks

I solved the error 2 years ago by removing any and all plugins that were modifying my woocommerce native checkout page. Since you are using woofunnel, it must be hiding an essential checkout field that is used by the 2checkout plugin to generate a token. I would recommend discussing this issue with woofunnel team and send them the 2checkout plugin files and ask them to check how the plugin is generating the token and see if they are hiding any required field from the checkout page.

I have since shifted to Shopify (best decision I ever made - f**k woocommerce) else I would have checked the plugin code and told you what the required fields are. If you are a bit familiar with coding, you can open the files in editor and see the part where the token is generated.

ahmednabik commented 4 years ago

I checked the code from the repository and here are the fields from "billing" address required to generate the token.

"billingAddr" => array(
                                        'name'          => $order->get_billing_first_name() . ' ' . $order->get_billing_last_name(),
                                        'addrLine1'     => $order->get_billing_address_1(),
                                        'addrLine2'     => $order->get_billing_address_2(),
                                        'city'          => $order->get_billing_city(),
                                        'state'         => $order->get_billing_state(),
                                        'zipCode'       => $order->get_billing_postcode(),
                                        'country'       => $order->get_billing_country(),
                                        'email'         => $order->get_billing_email(),
                                        'phoneNumber'   => $order->get_billing_phone()

If woofunnel is hiding the billing address inputs or any of the fields in the array above (name, address line 1, address line 2, city, state, zip code, country, email, phone number), the token will not be properly generated and the 2checkout API will return failed authorization.

Hope it helps. Best wishes.

nobel0 commented 4 years ago

I checked the code from the repository and here are the fields from "billing" address required to generate the token.

"billingAddr" => array(
                                        'name'          => $order->get_billing_first_name() . ' ' . $order->get_billing_last_name(),
                                        'addrLine1'     => $order->get_billing_address_1(),
                                        'addrLine2'     => $order->get_billing_address_2(),
                                        'city'          => $order->get_billing_city(),
                                        'state'         => $order->get_billing_state(),
                                        'zipCode'       => $order->get_billing_postcode(),
                                        'country'       => $order->get_billing_country(),
                                        'email'         => $order->get_billing_email(),
                                        'phoneNumber'   => $order->get_billing_phone()

If woofunnel is hiding the billing address inputs or any of the fields in the array above (name, address line 1, address line 2, city, state, zip code, country, email, phone number), the token will not be properly generated and the 2checkout API will return failed authorization.

Hope it helps. Best wishes.

Thank you soo much Mr. Ahmednabi for helping me out and taking the time to help. I will check the codes in woofunnel if they are matched with these arrays...

Question: Does it will through the "authentication failed" error even if the arrays are not ordered/listed as the 2checkout?? Because even tho i didn't delete any field BUT changed the order of the fields yet gives me that error << is there such thing?

Thanks a lot for helping me out.. Very appreciated Best Regards

nobel0 commented 4 years ago

Hello Mr. @ahmednabi058 and @craigchristenson . Please i need your help ASAP, it is better if i can contact you through Skype, PLEASE.

I am always getting unauthorized guys, no matter what i do... I really need a help please... I am just wasting money on advertising... I am TOTALLY sure all the field array are available.. I have switched to cartflows but with the same problem, when NEW CUSTOMER enters his card details and click complete order he will get unauthorized.. I am pretty sure it is from this plugin...

Waiting for your response guys... Please this is my skype name: nobel.ninja Thanks

craigchristenson commented 4 years ago

Hey buddy I pinged you on skype, lets figure out whats going on.