magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

2.1.0rc - Paypal Website Payments Standard module doesn't work #4785

Closed commcad closed 8 years ago

commcad commented 8 years ago

Steps to reproduce

  1. Install Magento from 2.0.7 > Upgrade to 2.1.0rc using Web Setup Wizard (no sample data)
  2. Store > Configuration > Sales > Payment Method > Enable Website Payments Standard
  3. Insert valid facilitator (merchant) email + API credentials > Save > Clear cache

  4. Products > Category > Add New Category
  5. Products > Catalog > Add New Product
  6. Save everything, go get a coffee, let the cron do their thing every minutes
  7. Go to frontend, register as a new customer, place an order, checkout using Paypal

    Expected result

  8. Succeed page/we have received your order confirmation, order created, qty adjustment, etc

    Actual result

  9. Error message "We can't place the order."
  10. The PP sandbox works fine as I can see the payments in both buyer & facilitator paypal accounts.

4magebugrep

Trace in TXT format trace for pp bug.txt

commcad commented 8 years ago

Loaded sample data and carried the same frontend steps > same error and trace.

Cache emptied > reindexed > stats refreshed > Redis-cli flushall/flushdb, everything I could do to set this back to a ootb stance.

Let me know if you need me to do anything else (I'll archive this VM in a meantime)

commcad commented 8 years ago

Thanks for looking into this Alena. YOU have to make this PP work ;)

Any workaround that you know of (temp fix) please let me know as I plan on putting RC1 in prod in a week (i know i know, not for prod etc) We just can't delay too much longer here so we'll make use of it. Everything else works flawlessly (for us anyway). We'll upgrade to a stable version in Aug or Sept.

Ubuntu 16.04 NGINX 1.10.0 MariaDB 10.0.24 PHP 7.0.4 PhpRedis Extension REDIS 3.2.0 (for session & page cache)

alena-marchenko commented 8 years ago

Hi @commcad

Please provide us with debug.log that contains response from PayPal (debug can be enabled in Advanced Settings section for PayPal Website Payments Standard), this should help to identify the cause of the issue.

commcad commented 8 years ago

Hello @alena-marchenko

Sure. Attaching the entire sys i/o from 2.07 composer-project install > update to 2.1.0rc using Web Setup. TestBuy/sandboxed performed with the paypal debug mode On as requested.

system.txt

See line no. 1435 SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base_grand_total' in 'field list', query was: INSERT INTO sales_invoice_grid

commcad commented 8 years ago

MariaDB [storedB]> show columns from sales_invoice_grid; +-----------------------+----------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+----------------------+------+-----+---------+-------+ | entity_id | int(10) unsigned | NO | PRI | NULL | | | increment_id | varchar(50) | YES | MUL | NULL | | | state | int(11) | YES | MUL | NULL | | | store_id | smallint(5) unsigned | YES | MUL | NULL | | | store_name | varchar(255) | YES | | NULL | | | order_id | int(10) unsigned | NO | MUL | NULL | | | order_increment_id | varchar(50) | YES | MUL | NULL | | | order_created_at | timestamp | YES | MUL | NULL | | | customer_name | varchar(255) | YES | | NULL | | | customer_email | varchar(255) | YES | | NULL | | | customer_group_id | smallint(6) | YES | | NULL | | | payment_method | varchar(128) | YES | | NULL | | | store_currency_code | varchar(3) | YES | | NULL | | | order_currency_code | varchar(3) | YES | | NULL | | | base_currency_code | varchar(3) | YES | | NULL | | | global_currency_code | varchar(3) | YES | | NULL | | | billing_name | varchar(255) | YES | MUL | NULL | | | billing_address | varchar(255) | YES | | NULL | | | shipping_address | varchar(255) | YES | | NULL | | | shipping_information | varchar(255) | YES | | NULL | | | subtotal | decimal(12,4) | YES | | NULL | | | shipping_and_handling | decimal(12,4) | YES | | NULL | | | grand_total | decimal(12,4) | YES | MUL | NULL | | | created_at | timestamp | YES | MUL | NULL | | | updated_at | timestamp | YES | MUL | NULL | | +-----------------------+----------------------+------+-----+---------+-------+ 25 rows in set (0.00 sec)

commcad commented 8 years ago

MariaDB [storedB]> > ALTER TABLE sales_invoice_grid ADD base_grand_total decimal(12,4) AFTER grand_total;

pp_test

;)

alena-marchenko commented 8 years ago

Hi @commcad

Please provide us with debug.log file that is located in var/log directory under magento root folder. Please als ensure that "Debug: option is set to Yes Under PayPal Payments Standard configuration.

commcad commented 8 years ago

@alena-marchenko

Sure, see attached debug.txt below.

All looking very good on the paypal side of things having success ack and all. I also have the payment registered and issued to the seller. Can't be a paypal bug...been using Paypal for the last 12 years with litle over $500,000 in sales and never came across a payment failure.

See above post no 6 where I highlighted the bug. The mage's database column aren't named properly. Easy fix is to rename the column to what it should be but I am unaware of other possible crashes that could occur while doing/renaming this table column.

Same bug on Magento 2.1.0rc2 by the way. Can't run a shop using the Paypal payment option :/

debug.txt

alena-marchenko commented 8 years ago

Hi @commcad

We've created MAGETWO-54787 internal ticket regarding this issue. Thank you.

Nerogee commented 8 years ago

I used fresh installed magento2.1 and still having unable to place order issue. column base_grand_total is there in sales_invoice_grid table.

maderlock commented 8 years ago

Do we have visibility on these MAGETWO-54787 tickets? They keep being mentioned, so I assume they can be viewed somewhere?

commcad commented 8 years ago

@maderlock MAGETWO-54787 internal ticket.

Let's hope for this to be included in the upcoming release. In a meantime the ALTER table fix works like a charm. I haven't had any complications amending the column name (both dev & prod).

maderlock commented 8 years ago

Thanks @commcad. Not happy with having to adjust the schema, but without any idea of timescales I've used your fix.

BigBri41 commented 8 years ago

What commcad said. I placed the column in a different place based on the insert query that errored, but I imagine both would work. Here's the query i ran to fix the issue.

ALTER TABLE magento.sales_invoice_grid ADD COLUMN base_grand_total DECIMAL(12,4) NULL DEFAULT NULL AFTER shipping_and_handling;

maderlock commented 8 years ago

@BigBri41 Did you try the alter statement by @commcad? Is the nullable part important?

BigBri41 commented 8 years ago

@maderlock The query that I ran is basically the same as the one @commcad posted, it just placed the column in a different place in the table, I expect that any inserts into the table reference the column by name though so that shouldn't be an issue. I have a feeling that the nullable part is important as its parent table (sales_invoice) has base_grand_total set as nullable also. I'm not sure that you would be able to add a non-nullable column to a table that has existing data either.

Tristan-N commented 8 years ago

@BigBri41 I had the same problem (couldn't create invoices in the backend in Magento 2.1) but solved it by the next query in MySQL as mentioned by mauromm @ https://github.com/magento/magento2/issues/5324:

ALTER TABLE `sales_invoice_grid`
    ADD COLUMN `base_grand_total` DECIMAL(12,4) NULL DEFAULT NULL COMMENT 'Base Grand Total' AFTER `grand_total`;

MySQL gave an error "Mysql isn't here anymore" but after running the script for a second time, it gave an duplicate column error. The column was created the first time and i was able to create invoices in the backend and the error never occurred again.

Many thanks to @mauromm and hope this helps for you aswell.

s00071609 commented 8 years ago

The below method from commcad seems to work. Should there be Create Account option in the end when you reach to the SUCCESS screen?

Does anyone have any idea when magento new version will be released?

Strange that there is no option for customers to create account when placing orders... Thought 2.1 would have it but cant see in my install at least. Any idea? MariaDB [storedB]>

ALTER TABLE sales_invoice_grid ADD base_grand_total decimal(12,4) AFTER grand_total;

commcad commented 8 years ago

@s00071609 Have a look in Magento Admin > Stores > Configuration > Sales > Checkout > Checkout Options

I could be totally wrong here but the Magento ootb setting is set by default to "Allow Guest Checkout". Setting this to NO should force the customer to Sign-up prior.

I'm personally unaware of any timeframe RE future release. Happily running M2.1.0GA in both dev and prod here. That original ALTER method is not complaining in any ways so I'll keep abusing it until this is fixed officially (lots of cfg products, swatches, invoices, c-memo, newsletters... using it all flawlessly)

s00071609 commented 8 years ago

I think Guest Checkout is quite important and would not be good to turn it off. But as the 2.1 release note says that guest checkout create account opens after checkout, I was wondering if there is still some issue with it. Basically there are two ways to checkout as guest, first way is buy manually filling in all details and using paypal express to checkout.

Second to directly jump to PayPal from mini- cart and complete checkout.

The first option displays a button "Create Account" at success screen, second option doesn't but I think i saw that a clean install of 2.1 without any data, shows the button when checking out in first or second way.

Most people like to simply hit paypal and checkout without entering anything. SO this method should trigger Create Account in the end. Not sure its a bug or a feature that does not exist. Below is the success page using first and second methods: expresscheckout normalcheckout

commcad commented 8 years ago

@s00071609 I see your point now. Feature or bug I can't answer unfortunately, Had a quick look for you but can't seem to find the answer: http://docs.magento.com/m2/ce/user_guide/sales/point-of-purchase.html

Alternative; have a go at the forum in case someone more exp than us knows already. https://community.magento.com/t5/Core-Technology-Magento-2/ct-p/Magento-2

maderlock commented 8 years ago

@s00071609 Please could you raise this as a separate ticket? This ticket should remain just for the missing invoice bug.

s00071609 commented 8 years ago

@maderlock @alena-marchenko I havent reported anything regarding missing invoice bug but concern about paypal express checkout that provides no option for customers to create account.

Later if they do create an account, the order does not appear in account. Strange that orders are not associated by customer email. These are some of the basic must-have features in ecommerce.

Most surprising is that customers cannot create account if they choose to use PayPal checkout without entering details. There is no option throughout checkout process. At least there should be Create Account option in the end no matter how you checkout. If they later decide to create an account - the orders wont appear.

"The Create an Account form now opens as expected after checkout has been completed for a customer who is not logged in."

commcad commented 8 years ago

@s00071609 hmmm I think what @maderlock meant is your issue is irrelevant to this schema bug and may confuse developers & merchants shall you persist posting here. Your issue has nothing to do with MAGETWO-54787, bud.

I've kindy posted a few links a few posts above to help you better follow-up on your issue. If you are convinced that it is a bug, and not a feature, the general advice is to create a New Issue for Magento to be notified and action on.

Here is the link for that: https://github.com/magento/magento2/issues/new

NadiyaS commented 8 years ago

Hi, Bug with base_grand_total was fixed and delivered to develop branch. Issue is closed as resolved.

aianus commented 8 years ago

Which release will this fix be part of? @NadiyaS

nmallepally commented 8 years ago

I have a paypal error, we can't place the order. Magento 2.1 v CE.

paypal error 2 1

nigelcopley commented 8 years ago

workaround by @commcad confirmed as working

Would be great to have this fixed in next release - any ideas when?

nmallepally commented 8 years ago

It still says the same with payment action order but works for sale and authorization on when tested using real details, but all of them does not work on sandbox mode.

Nerogee commented 8 years ago

I still have the same issue with message in system.log main.CRITICAL: Exception message: Warning: Invalid argument supplied for foreach() in /var/www/public_html/test.com/vendor/magento/module-catalog/Model/Product.php on line 1910

romeof1980 commented 8 years ago

Thanks @commcad for posting the fix, works for us too with Magento 2.1.0

maderlock commented 8 years ago

Sounds like we need a patch release asap.

blizam commented 8 years ago

Can someone please clarify if I use the ALTER statement here to patch my 2.1.0 install... will that cause any issues when the next prod ver of mage is released/when I upgrade mage?

The same issue occurs on PayPal Express if you have it set to not skip the review page... which is necessary if you need to add carrier fetched shipping method/cost...

elenleonova commented 8 years ago

The issue has been fixed in 2.1.1

usertwelve commented 8 years ago

Upgraded to 2.1.1 and still getting this issue. The upgrade did not solved this issue for me. Paypal pay now is still sending me back to the review order page with error "We can't place order" even if it should have skip the review order page. Paypal should send me to the success page with option to create account. I am using Paypal Standard Payments.

NadiyaS commented 8 years ago

Hi @usertwelve , the cause of this bug was that DB table sales_invoice_grid did not have base_grand_total column. If you really still have the same problem you will have error message on Invoice grid page. To check it go to Sales > Invoices. If this grid opens correctly and you see all invoice data, then you have another cause of your problem and please create additional ticket for this if it have not been already created.

usertwelve commented 8 years ago

It's a new installation 2.1.0 and just updated to 2.1.1. Not sure what you mean by Invoice "grid" page but no I don't see errors in the sales/invoice page. Maybe it is because I don't have any invoices yet? Each time I try to make a purchase I end up with this "We can't place order" message. I've tried a few different set-up with Paypal and I get this message each single time.

blizam commented 8 years ago

If you switch to Authorize Only instead of Authorize and Capture, does it work? Are the payments actually going through on the PayPal side?

With the bug in 2.1.0 that was the case... but if setting it to just Authorize only still doesn't work then you've definitely got another issue

usertwelve commented 8 years ago

I am assuming you are referring to Authorize.net configuration (since there is no such authorize options with Paypal) but I am only accepting payments with Paypal. I am trying to configure either Paypal Website Payments Standard or Paypal Express Checkout as the only option for payments. (I am already using this setup with 2 other older Magento site with no problems.) Both Paypal options seems to work as supposed but when I clic "Pay now" in Paypal it redirect me to the order review page with the alert "We can't place the order". Even when I select yes to "Skip Order Review Step". No invoice is created and no payments.

romeof1980 commented 8 years ago

No, he is not referring to that. Look again and pay attention where in PayPal config you see a drop down menu with "Authorize" and "Authorize and Capture". Double check it if you can find it until you see it..

---- On Mon, 12 Sep 2016 19:07:31 +0200 notifications@github.com wrote ----

I am assuming you are referring to Authorize.net configuration (since there is no such authorize options with Paypal) but I am only accepting payments with Paypal. I am trying to configure either Paypal Website Payments Standard or Paypal Express Checkout as the only option for payments. (I am already using this setup with 2 other older Magento site with no problems.) Both Paypal options seems to work as supposed but when I clic "Pay now" in Paypal it redirect me to the order review page with the alert "We can't place the order". Even when I select yes to "Skip Order Review Step". No invoice is created and no payments.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

usertwelve commented 8 years ago

You're right this config is available in Paypal also but only with Paypal Payflow. Can't find it in Paypal Website Payments Standard nor in the Paypal Express checkout. By the way thanks for your help guys.

romeof1980 commented 8 years ago

Basic setting -> advanced settings -> billing agreement

Check then double check again It is indeed present

---- On Mon, 12 Sep 2016 20:16:26 +0200 notifications@github.com wrote ----

You're right this config is available in Paypal also but only with Paypal Payflow. Can't find it in Paypal Website Payments Standard nor in the Paypal Express checkout.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

usertwelve commented 8 years ago

I have set the Billing Agreement Signup to "Never" and the Paypal Billing Agreement Setting is disabled. There is an option "Payment Action" which I can choose either "Authorization" or "Sale". It is set to Authorization but I can't see why it is important since the whole option (Paypal Billing Agreement Settings) is disabled.

usertwelve commented 8 years ago

Sorry Guys looks like my problem is not related to this issues. I have tried again with an other very basic test product and it worked this time. It was related to the product itself.. Maybe because of the customizable option. Thanks for your help.

commcad commented 8 years ago

Still doesn't work with configurable products; especially those having both swatches + custom options. You will get that same Cannot place order error.

However, it works fine if you use a configurable product having either one. Can't have both unfortunately ;)

in 2.1.0 and 2.1.1 @usertwelve

neilrd commented 8 years ago

@commcad

I've got the same issue that you initially highlighted. I am pretty inexperienced with MySQL. However I have logged into the MySQL monitor via SSH as the root user. What are the exact commands I need to run to solve this problem - please explain step by step.

I copied and pasted this command:

MariaDB [storedB]>

ALTER TABLE sales_invoice_grid ADD base_grand_total decimal(12,4) AFTER grand_total;

but the following error was flagged:

screen shot 2016-09-14 at 00 00 23

Appreciate any support with this. Apologies for my lack of experience.

Kind Regards

commcad commented 8 years ago

Hey Neil

Change pwd and database name (magentodB) with yours

From the Command Line Terminal:

$ sudo mysql -u root -p $ (enter pwd) $ USE magentodB; $ ALTER TABLE sales_invoice_grid ADD base_grand_total decimal(12,4) AFTER grand_total; $ quit $ sudo service mysql restart

@neilrd

plauge commented 8 years ago

The problem is stil in Magento 2.1.1 if the product have a Custom Option fields. The base_grand_total is in the table.

Im getting an error like this:

Integrity constraint violation: 1062 Duplicate entry for key 'SALES_ORDER_INCREMENT_ID_STORE_ID', query was: INSERT INTOsales_order``

NadiyaS commented 8 years ago

Hi @plauge , the problem of current issue is not in sales_order. If you have another issue, please create new ticket with all necessary information and steps to reproduce.

shahankitb997 commented 7 years ago

Have same issue in Magento 2.1.2 for Some Orders