Magento2: Couldnot place order "An error occured on the server. Please try to place the order again"

Created on 8 Oct 2016  ·  176Comments  ·  Source: magento/magento2

I am unable to place the order in Magento 2.1.1.
I don't get specific log details to track the error.
The console log shows "Failed to load resource: the server responded with a status of 400 (Bad Request)" at
http://example.com/rest/default/V1/guest-carts/36b703a23e05b25a08da0e8ba5ab031f/payment-information

I have previously installed an extension to delete orders. But I removed it too and upgraded setup and cleared cache too.
But I can't place order now.

There are no table prefixes either. After setup upgrade, I runned "bin/magento setup:di:compile" command.

image

Please suggest

Checkout Clear Description Format is not valid bug report

Most helpful comment

@AirmanAJK Really nice response. I see that the areas where the error occurs, there is a generic exception thrown without even logging the real exception. The way to really see the exact exception is to add breakpoints. Setting up remote debugging in your IDE will really go a long way in troubleshooting the issue. I migrated from Magento 2.0.11 to Magento 2.1.5 and started experiencing the issue. In my case, it was an error about Region being a required field.
I set a breakpoint here: https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Checkout/Model/PaymentInformationManagement.php#L71 to see the exact error.

Turning off the setting from the admin that required state solved it for me.

What Magento2 seems to me is that the developers needed to meet the release deadline because management insisted that they had to, so developers had no choice but to release software was not ready for production. We were amongst the first shops to migration from Magento 1.8.x to Magento 2 - At the time, Magento 2.0.5. It was a horrible experience. Every single thing that could go wrong indeed went wrong. From wrong EAV attribute ids to customers not able to log out, to missing cart, just name it.
I am currently facing an issue with Magento assigning the value of my region field (string) to region_id (int) and as a result throwing return type errors. Setting breakpoints in the browser using chrome developer tools, I seem to see where the error is coming from. Without using debuggers to step through Magento code(in the browser and in your IDE) in developer mode, it is almost impossible to get to the root of the errors. Really bad Magento team.

All 176 comments

Hi there,

I am having the same issue, glad it's not isolated to me.

We upgraded to magento 2.1.1 and are facing checkout issues associated with he number of address lines a customer has.

If a customer has only 1 address line filled in and the default setting is 2 the error occurs.

If you set the value to 1 in the admin panel customers with 1 address line can then checkout but with existing customers who have filled in 2 lines the problem again happens.

I could really do with a fix asap.

Thanks in advance
Dan

Been stuck on this problem for awhile now.. cant seem to figure it out.. hopefully someone can...

Don't anybody have insight on it. I am really disappointed with magento 2.1. I don't think the 2.1 version is ready for production.

@prasannanwr please provide exact steps you do and specify payment and shipment methods you use. Is the problem present for Cash on Delivery payment method only or for others as well? Is customer registered or making order as guest?
Was it upgrade from some previous version or clear Magento install?

The shipping method is Free shipping and the payment method is Cash on delivery.
I have not tested on other payment methods. My requirement is cod now. The customer is making order as guest.

I have installed fresh magento 2.1.1. Before it was working well. But after when I runned system upgrade and compiled, I got this error I guess but not sure.

image

Hi Veloraven.

To replicate the same bug on our website and little more info please see below.

The same error as posted here is happening with us. We upgrade from 2.0.9 to 2.1.1.

We are also experiencing the same issues as documented here which is looks like this is repeated to:

https://github.com/magento/magento2/issues/4921

Within the admin panel set the address lines for customers to 2:

Stores > Configuration > Customer > Customer Configuration > Name and Address Options: Number of Lines in a Street Address make it 2

Then register a new customer but only fill in one address line.

When you go to place an order you get the error originally posted here in the last stage.

If you change the admin value to 1 (which was a temporary fix for 2.1) the error occurs with customers who have 2 address lines filled in.

Hope this helps.
Dan

Finally I figured out the problem. I have skipped City field on checkout because we don't need city on address.
Upon enabling the city field, it worked. I want to remove city on checkout. Are there any good way to do that?

Thanks

I'm having the same issue, but nothing has fixed it:
When I try to checkout:
{"message":"An error occurred on the server. Please try to place the order again.","trace":"#0 [internal function]: Magento\CheckoutModel\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder('3bc99aeaf443e17...', 'james.vreeken@t...', Object(Magento\QuoteModel\Quote\Payment), Object(Magento\QuoteModel\Quote\Address))\n#1 /Users/jvreeken/Sites/morganjewelers/vendor/magento/module-webapi/Controller/Rest.php(307): call_user_func_array(Array, Array)\n#2 /Users/jvreeken/Sites/morganjewelers/vendor/magento/module-webapi/Controller/Rest.php(216): Magento\Webapi\Controller\Rest->processApiRequest()\n#3 /Users/jvreeken/Sites/morganjewelers/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(37): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#4 /Users/jvreeken/Sites/morganjewelers/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#5 /Users/jvreeken/Sites/morganjewelers/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()\n#6 /Users/jvreeken/Sites/morganjewelers/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))\n#7 {main}"}

I am receiving the same error as well. I am disappointed with this software, this is the first choice of e commerce software I have tried, and I am debating to switch. I CAN say, that given the bugs in this version, there is no way I will get a license for EE. No way. Bugs on adding items into the catalog I had to circumvent myself. Now I cant checkout because I get an error. I have checked every log and they show nothing. All the fields are valid on checkout, it break, but still goes through. Im using live transactions, Im in production mode (Just switched lastnight)
Shipping&Handling is 0 (for local pickup & delivery). This software should have been well vetted before you release a buggy version, and cause problems for people with a customer base. Thank god I haven't launched yet.

Not to mention the install hung, but yet the log said it finished, front end would hang forever. But the installation went through.

I am facing the same issue in Magento 2.1.2.

We have the same issue Magento 2.1.2

I am having the same issue with Magento 2.1.2.

Preconditions

  1. Magento CE 2.1.2 without sample data installed.
  2. Configured USPS and FedEx Shipping Methods.
  3. Configured PayPal Payments Pro Payment Method.
  4. Imported products and categories from a previous shopping cart.
  5. Set mode to production.

Steps to Reproduce

  1. Navigate to storefront as a guest.
  2. Open an imported category.
  3. Click "Add to Cart" on an imported product.
  4. Open mini shopping cart and click "Go to Checkout".
  5. Complete Address and Shipping steps of checkout.
  6. Select "Credit Card" for a Payment option.
  7. Enter Credit Card details and click "Place Order".

Actual and Expected Results

Expected Results

To be sent to an order confirmation page and have the order show up in the 'Sales->Orders'.

Actual Results

I get an error that says, "An error occurred on the server. Please try to place the order again." with a trace:

#0 [internal function]: Magento\Checkout\Model\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder('****', '****', Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address))
#1 ****/vendor/magento/module-webapi/Controller/Rest.php(307): call_user_func_array(Array, Array)
#2 ****/vendor/magento/module-webapi/Controller/Rest.php(216): Magento\Webapi\Controller\Rest->processApiRequest()
#3 ****/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(37): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
#4 ****/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#5 ****/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#6 ****/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#7 {main}

Additional Information

I am also seeing HTTP 400 Bad Request errors on ****/rest/default/V1/guest-carts/****/payment-information

I'm running into this exact problem on magento 2.1.2

Using authorize.net direct post method.

I tried changing address line to 1 and it started working... not sure how many customers had addresses that are 2 lines... anyone find a fix for this?

Maybe someone can figure out a sql query that could concatenate addresses in the database that were using 2 lines?

I don't really know how to move forward from this... maybe ditch magento and go with shopify, foxy.io, hell, even woocommerce would be a step up at this point with all the issues magento2 has...

If anyone has any ideas on how to fix this I'm all ears!

Thanks!

I tried the same fix on our staging server changing the address lines to 1, but this didn't fix it on staging...

Staging is in production mode, and local in development... maybe that has something to do with it?

I also thought it might be https vs http using a sandbox key with authorize.net so I changed staging to not force https trying to get staging more in line with my dev environment and I've ruled that out... I'm going to try to put staging into dev mode and try again.

Here is a screenshot of the network tabs on local dev and staging showing it worked on my local environment, but not on staging which is in production mode:

https://www.dropbox.com/s/fb17g39mo3mu9ds/Screenshot%202016-10-20%2009.50.12.png?dl=0

Same Issue facing on Magento 2.1.2. any solution ?

Same for me :/ somehow glad to see it's not us, but damn, another critical bug? Where does it end...

Please check your sales_sequence_meta and sales_sequence_profile tables
They should be similar to these,
2016-10-25 19_50_07-magento2 nl _ localhost _ magento2_magento _ sales_sequence_profile _ phpmyadmin
sales_sequence_profile

2016-10-25 19_51_29-magento2 nl _ localhost _ magento2_magento _ sales_sequence_meta _ phpmyadmin 4
sales_sequence_meta

After I fixed these tables, it started to working.

And not to forget, if you already have some orders, please insert a record to sequence_order_1 table above the number of orders.
Ex : if you have 10 orders, insert a record with 11 or 12 as sequence_value

Same issue here, thought it was my payment code.. guess it's not! 2.1.2

It is more of db related issue, please check those tables mentioned.

@nuwaus Plus the store Id i'm checking out on is 3

screen shot 2016-11-02 at 16 31 59

screen shot 2016-11-02 at 16 32 23

Here is my error:

{"message":"An error occurred on the server. Please try to place the order again.","trace":"#0 \/Users
\/ccarnell\/Sites\/vax-uk2\/vendor\/magento\/framework\/Interception\/Interceptor.php(146): Magento\
\Checkout\\Model\\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder('83aea169274f681
...', 'ccarnell@tti-fc...', Object(Magento\\Quote\\Model\\Quote\\Payment), Object(Magento\\Quote\\Model
\\Quote\\Address\\Interceptor))\n#1 \/Users\/ccarnell\/Sites\/vax-uk2\/var\/generation\/Magento\/Checkout
\/Model\/GuestPaymentInformationManagement\/Interceptor.php(26): Magento\\Checkout\\Model\\GuestPaymentInformationManagement
\\Interceptor->___callPlugins('savePaymentInfo...', Array, Array)\n#2 [internal function]: Magento\\Checkout
\\Model\\GuestPaymentInformationManagement\\Interceptor->savePaymentInformationAndPlaceOrder('83aea169274f681
...', 'ccarnell@tti-fc...', Object(Magento\\Quote\\Model\\Quote\\Payment), Object(Magento\\Quote\\Model
\\Quote\\Address\\Interceptor))\n#3 \/Users\/ccarnell\/Sites\/vax-uk2\/vendor\/magento\/module-webapi
\/Controller\/Rest.php(307): call_user_func_array(Array, Array)\n#4 \/Users\/ccarnell\/Sites\/vax-uk2
\/vendor\/magento\/module-webapi\/Controller\/Rest.php(216): Magento\\Webapi\\Controller\\Rest->processApiRequest
()\n#5 \/Users\/ccarnell\/Sites\/vax-uk2\/vendor\/magento\/framework\/Interception\/Interceptor.php(146
): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#6 \
/Users\/ccarnell\/Sites\/vax-uk2\/var\/generation\/Magento\/Webapi\/Controller\/Rest\/Interceptor.php
(39): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callPlugins('dispatch', Array, Array)\n#7 \
/Users\/ccarnell\/Sites\/vax-uk2\/vendor\/magento\/framework\/App\/Http.php(135): Magento\\Webapi\\Controller
\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#8 \/Users\/ccarnell\
/Sites\/vax-uk2\/vendor\/magento\/framework\/App\/Bootstrap.php(258): Magento\\Framework\\App\\Http-
>launch()\n#9 \/Users\/ccarnell\/Sites\/vax-uk2\/pub\/index.php(37): Magento\\Framework\\App\\Bootstrap-
>run(Object(Magento\\Framework\\App\\Http))\n#10 {main}"}

@craigcarnell
Please check the AUTO_INCREMENT of your sequence_order_1 if it possible to delete your current orders please do as follow,

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `gift_message`;
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
TRUNCATE TABLE `quote_item_option`;
TRUNCATE TABLE `quote_payment`;
TRUNCATE TABLE `quote_shipping_rate`;
TRUNCATE TABLE `reporting_orders`;
TRUNCATE TABLE `sales_bestsellers_aggregated_daily`;
TRUNCATE TABLE `sales_bestsellers_aggregated_monthly`;
TRUNCATE TABLE `sales_bestsellers_aggregated_yearly`;
TRUNCATE TABLE `sales_creditmemo`;
TRUNCATE TABLE `sales_creditmemo_comment`;
TRUNCATE TABLE `sales_creditmemo_grid`;
TRUNCATE TABLE `sales_creditmemo_item`;
TRUNCATE TABLE `sales_invoice`;
TRUNCATE TABLE `sales_invoiced_aggregated`;
TRUNCATE TABLE `sales_invoiced_aggregated_order`;
TRUNCATE TABLE `sales_invoice_comment`;
TRUNCATE TABLE `sales_invoice_grid`;
TRUNCATE TABLE `sales_invoice_item`;
TRUNCATE TABLE `sales_order`;
TRUNCATE TABLE `sales_order_address`;
TRUNCATE TABLE `sales_order_aggregated_created`;
TRUNCATE TABLE `sales_order_aggregated_updated`;
TRUNCATE TABLE `sales_order_grid`;
TRUNCATE TABLE `sales_order_item`;
TRUNCATE TABLE `sales_order_payment`;
TRUNCATE TABLE `sales_order_status_history`;
TRUNCATE TABLE `sales_order_tax`;
TRUNCATE TABLE `sales_order_tax_item`;
TRUNCATE TABLE `sales_payment_transaction`;
TRUNCATE TABLE `sales_refunded_aggregated`;
TRUNCATE TABLE `sales_refunded_aggregated_order`;
TRUNCATE TABLE `sales_shipment`;
TRUNCATE TABLE `sales_shipment_comment`;
TRUNCATE TABLE `sales_shipment_grid`;
TRUNCATE TABLE `sales_shipment_item`;
TRUNCATE TABLE `sales_shipment_track`;
TRUNCATE TABLE `sales_shipping_aggregated`;
TRUNCATE TABLE `sales_shipping_aggregated_order`;
TRUNCATE TABLE `tax_order_aggregated_created`;
TRUNCATE TABLE `tax_order_aggregated_updated`;

ALTER TABLE `gift_message` AUTO_INCREMENT=1; 
ALTER TABLE `quote` AUTO_INCREMENT=1; 
ALTER TABLE `quote_address` AUTO_INCREMENT=1; 
ALTER TABLE `quote_address_item` AUTO_INCREMENT=1; 
ALTER TABLE `quote_id_mask` AUTO_INCREMENT=1; 
ALTER TABLE `quote_item` AUTO_INCREMENT=1; 
ALTER TABLE `quote_item_option` AUTO_INCREMENT=1; 
ALTER TABLE `quote_payment` AUTO_INCREMENT=1; 
ALTER TABLE `quote_shipping_rate` AUTO_INCREMENT=1; 
ALTER TABLE `reporting_orders` AUTO_INCREMENT=1; 
ALTER TABLE `sales_bestsellers_aggregated_daily` AUTO_INCREMENT=1; 
ALTER TABLE `sales_bestsellers_aggregated_monthly` AUTO_INCREMENT=1; 
ALTER TABLE `sales_bestsellers_aggregated_yearly` AUTO_INCREMENT=1; 
ALTER TABLE `sales_creditmemo` AUTO_INCREMENT=1; 
ALTER TABLE `sales_creditmemo_comment` AUTO_INCREMENT=1; 
ALTER TABLE `sales_creditmemo_grid` AUTO_INCREMENT=1; 
ALTER TABLE `sales_creditmemo_item` AUTO_INCREMENT=1; 
ALTER TABLE `sales_invoice` AUTO_INCREMENT=1; 
ALTER TABLE `sales_invoiced_aggregated` AUTO_INCREMENT=1; 
ALTER TABLE `sales_invoiced_aggregated_order` AUTO_INCREMENT=1; 
ALTER TABLE `sales_invoice_comment` AUTO_INCREMENT=1; 
ALTER TABLE `sales_invoice_grid` AUTO_INCREMENT=1; 
ALTER TABLE `sales_invoice_item` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_address` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_aggregated_created` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_aggregated_updated` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_grid` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_item` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_payment` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_status_history` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_tax` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_tax_item` AUTO_INCREMENT=1; 
ALTER TABLE `sales_payment_transaction` AUTO_INCREMENT=1; 
ALTER TABLE `sales_refunded_aggregated` AUTO_INCREMENT=1; 
ALTER TABLE `sales_refunded_aggregated_order` AUTO_INCREMENT=1; 
ALTER TABLE `sales_shipment` AUTO_INCREMENT=1; 
ALTER TABLE `sales_shipment_comment` AUTO_INCREMENT=1; 
ALTER TABLE `sales_shipment_grid` AUTO_INCREMENT=1; 
ALTER TABLE `sales_shipment_item` AUTO_INCREMENT=1; 
ALTER TABLE `sales_shipment_track` AUTO_INCREMENT=1; 
ALTER TABLE `sales_shipping_aggregated` AUTO_INCREMENT=1; 
ALTER TABLE `sales_shipping_aggregated_order` AUTO_INCREMENT=1; 
ALTER TABLE `tax_order_aggregated_created` AUTO_INCREMENT=1; 
ALTER TABLE `tax_order_aggregated_updated` AUTO_INCREMENT=1; 
SET FOREIGN_KEY_CHECKS = 1;

Doing this worked for me, make sure to disable any 3rd party extensions which effect on ordering process, such as modules for rewards points etc..

And make sure to backup your database as it is before doing truncate.

@nuwaus tried truncating my tables, increase the sequence, didn't work for me I'm afraid :( I'll have to try disabling modules.

@craigcarnell

Please try to place an order, then after you get the error message, go to sales_order table and see if it has inserted a new record. If that happen you can narrow down the issue.

Sometimes order places, but some other DB transaction after that can cause the issue because it happened to me as well after the order is placed I got an error when it trying to add records to rewards point table, it was a 3rd party module, so I had to truncate that table as well.

I eventually fixed this by tracing the problem all the way back to certificates used for the payment provider. I recreated new certificates and replaced the old ones, and I then saw that the key in app/etc/env.php was changed _after_ the installation. I changed it back to what it was before and the error resolved.

I setup a clean install of CE 2.1.2 continue development. I didn't have this issue with it, except now I do.? I tried setting address to 1

{"message":"An error occurred on the server. Please try to place the order again.","trace":"#0 [internal
 function]: Magento\\Checkout\\Model\\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder
('0208c70f22bf5c8...', 'ccarnell@tti-fc...', Object(Magento\\Quote\\Model\\Quote\\Payment), NULL)\n#1
 \/Users\/ccarnell\/Sites\/codesocial-uk2\/vendor\/magento\/module-webapi\/Controller\/Rest.php(307)
: call_user_func_array(Array, Array)\n#2 \/Users\/ccarnell\/Sites\/codesocial-uk2\/vendor\/magento\/module-webapi
\/Controller\/Rest.php(216): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n#3 \/Users\/ccarnell
\/Sites\/codesocial-uk2\/var\/generation\/Magento\/Webapi\/Controller\/Rest\/Interceptor.php(37): Magento
\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#4 \/Users\/ccarnell
\/Sites\/codesocial-uk2\/vendor\/magento\/framework\/App\/Http.php(135): Magento\\Webapi\\Controller
\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#5 \/Users\/ccarnell\
/Sites\/codesocial-uk2\/vendor\/magento\/framework\/App\/Bootstrap.php(258): Magento\\Framework\\App
\\Http->launch()\n#6 \/Users\/ccarnell\/Sites\/codesocial-uk2\/pub\/index.php(37): Magento\\Framework
\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n#7 {main}"}

I can confirm this bug in Magento 2.1.2.

Following what @kociiide said I configured customer addresses to have only 1 line. After this, NEW customers can place order, but existing not.

Looking for a fix...

Any update here? I'm having the same issue.

I have the same problem and trying to find a solution for several days now. My client is not amused and so Am I. This needs to be solved soon. When to expect the 2.1.3 version??? With al fixes?

In my Magento2.1.2 system I get the same error when placing an order:

400 (Bad Request)" at
http://example.com/rest/default/V1/guest-carts/36b703a23e05b25a08da0e8ba5ab031f/payment-information

Nothing is placed in sales_order. Also above mentioned tables are the same for me.
These are the tables I have in my database. Am I missing some tables?
sequence

I do not know if it is important but I migrated data from older 1.9 into Magento 2 (with the ubertheme module) only products and the category. Could that have caused some missing tables? How to trouble shoot that? Or any other workaround that solves this!

Hello everybody,

Hope find urgent fix for this,

i have the same issue on magento 2.1.2, I tried every fix possible described in many issues, but with no success.

Ditto. Same issue with 2.1.1 I get the same error message shown above when placing an order using Authorize.net. The payment gets processed via Authorize.net (testing on staging site). Changed address to 1 line and still didn't work.

Still did not find a solution. tried all things I red here.
Looking again into the d-base as mentioned above by @nuwaus I wondered about the shop-id In the table there is only id=0 and id=1 but I see my shop has id=2 ?
Should there than not be a third part in the sales_sequence_meta for the shop with id=2 ?

shopid

sequence_tabel

Or did I mess-up with my store settings I have this now:

stores_settings

and I have set one store somewhere in the config (could not find where) :)

I have the same problem with checkmo and banktransfer.

  • Magento 2.1.2
  • Store in French
  • Address without region in France
  • Street (2 lines)

I can force payment validation. To do this, in the "quote" table, I look for the line of this basket and I reset the "reserved_order_id" field to "NULL".

Same problem with Check / Money Order (only payment method)
Magento 2.1.1
PHP 7.0.13
MySql 5.6.34
Stores: German, Italian, Englisch
Street: 1 Line

Order is generated correctly, Order Confirmation Email is send. But customer is not redirected to the success page. Instead the error shows up (for just a few seconds)
An error occurred on the server. Please try to place the order again.

, the cart is empty and the customer is still on the checkout page. Of course the customer can't place the order again and is confused.

common @magento-admin This can't be true, your system does not support receiving payments at the moment. This should have been fixed right when the bug came in.

@veloraven When to expect a solution on this "crucial" subject? Many are struggling with this problem. If no solution is found than the system is not usable for running a commercial shop. Please dig into this and come up with a solution or a Magento2.1.3 upgrade fast.

Indeed, I am even wondering if we should still proceed with Magento 2. We know there are many bugs there, but having a bug like this since the 8th of October is simply not acceptable. Even for an open source application.

Still waiting for a solution!! Any results on this guys? One of you Magento developers willing to dig into this and provide us with a solution now!!!?
This is not good! 👎

Comment out the exception catcher in vendor/magento/module-checkout/Model/PaymentInformationManagement.php

Then try again, you will see an error show up in your logs in production mode!

For me it was an extension that used a plugin that was calling an undefined variable!

Comment out the TRY { } { catch} but not the
$orderId = $this->cartManagement->placeOrder($cartId);

This will expose the underlying error to a tee!

//try {
$orderId = $this->cartManagement->placeOrder($cartId);
/* } catch (\Exception $e) {
throw new CouldNotSaveException(
__('CNSE1: An error occurred on the server. Please try to place the order again.'.' '.$cartId.$sam.' '.$orderId),
$e
);
}
*/

@southerncomputer Thanks for the reply. I tried it with the code commented out and it returned a 500 internal Server error.

{"message":"SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '',
: INSERT INTO `` () VALUES ()",

See the full error here: http://pastebin.com/YYxTvGis

Is there an other file / place where to look for info on the error?

Magento\SalesSequence\Model\Sequence->getNextValue() is failing!

Are you using split databases EE feature? in vendor/magento/module-sales-sequence/Model/Sequence.php it should be able to access the sales_sequence tables:

see here: https://github.com/magento/magento2/issues/3066

select * from sales_sequence_meta;

+---------+-------------+----------+-----------------------+
| meta_id | entity_type | store_id | sequence_table |
+---------+-------------+----------+-----------------------+
| 1 | order | 0 | sequence_order_0 |
| 2 | invoice | 0 | sequence_invoice_0 |
| 3 | creditmemo | 0 | sequence_creditmemo_0 |
| 4 | shipment | 0 | sequence_shipment_0 |
| 5 | rma_item | 0 | sequence_rma_item_0 |
| 6 | order | 1 | sequence_order_1 |
| 7 | invoice | 1 | sequence_invoice_1 |
| 8 | creditmemo | 1 | sequence_creditmemo_1 |
| 9 | shipment | 1 | sequence_shipment_1 |
| 10 | rma_item | 1 | sequence_rma_item_1 |
| 11 | quote | 0 | sequence_quote_0 |
| 12 | quote | 1 | sequence_quote_1 |
+---------+-------------+----------+-----------------------+
12 rows in set (0.01 sec)

mysql> select * from sales_sequence_profile;
+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
| profile_id | meta_id | prefix | suffix | start_value | step | max_value | warning_value | is_active |
+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
| 1 | 1 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 2 | 2 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 3 | 3 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 4 | 4 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 5 | 5 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 6 | 6 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 7 | 7 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 8 | 8 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 9 | 9 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 10 | 10 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 11 | 11 | Q15. | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 12 | 12 | Q15. | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
12 rows in set (0.00 sec)

For each store there should be one set of tables and profiles! ignore the quote lines - those are custom for me!

@dreucifer thank you for the steps.
I tried 2.1.2 in production mode by the steps you described and placed order twice:
1) FedEx shipping with credit card payment
2) USPS shipping with credit card payment

Imported products and categories from a previous shopping cart.

Could you pleas clarify what you mean here?

Let's try to understand what we are doing in the different way. Did you use any other configuration changes?

@craigcarnell could you point steps to reproduce for that error?

@sjovanig we need steps to reproduce to fix it. Do you reproduce it on the clean Magento installation? What are configuration changes? Which payment and shipping methods you use?

@SerhiyShkolyarenko as mentioned above my store id = 2 but the strange thing is I only have 1 shop? So why is my store_id=2 ? Can I change the store id into 1 somehow? Or would it be better adding some rows to sales_sequence_meta and sales_sequence_profile?

| 11 | order | 2 | sequence_order_2 |
| 12 | invoice | 2 | sequence_invoice_2|
| 13 | creditmemo | 2 | sequence_creditmemo_2 |
| 14 | shipment | 2 | sequence_shipment_2 |
| 15 | rma_item | 2 | sequence_rma_item_2 |

But hwo would that be for the sales_sequence_profile than?
like this ? :
11 | 11 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |

2 everyone who reported 400 error on API request. Let's clarify how to reproduce. I added product to cart on frontend, then set shipping address and shipping method on frontend, then sent request to
guest-carts/f21a5febd9e9acf68cdb03bccc8caa99/payment-information with payload

{
  "email": "[email protected]",
  "paymentMethod": {
    "po_number": "string",
    "method": "checkmo",
    "additional_data": [
      "string"
    ],
    "extension_attributes": {
      "agreement_ids": []
    }
  },
  "billingAddress": {
    "region_code": "CA",
    "country_id": "US",
    "street": [
      "string"
    ],
    "company": "string",
    "telephone": "string",
    "postcode": "90323",
    "city": "string",
    "firstname": "string",
    "lastname": "string",
    "middlename": "string",
    "prefix": "string",
    "suffix": "string",
    "email": "[email protected]",
    "same_as_billing": 0,
    "extension_attributes": {}
  }
}

and order was placed successfully. Which payload should I use to reproduce the issue?

| 11 | order | 2 | sequence_order_2 |
| 12 | invoice | 2 | sequence_invoice_2|
| 13 | creditmemo | 2 | sequence_creditmemo_2 |
| 14 | shipment | 2 | sequence_shipment_2 |
| 15 | rma_item | 2 | sequence_rma_item_2 |
^^^^^^^^^^ YES ^^^^^^^^^^^^^^
But hwo would that be for the sales_sequence_profile than?
like this ? : [[[[[[YES!]]]]]]]]]]]]
11 | 11 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |

you would need to create the tables as well as do above!

Getting some progress now, but ended up with a new error:

{"message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '000000000-2' for key
 'SALES_ORDER_INCREMENT_ID_STORE_ID', query was: INSERT INTO `sales_order` 

When I lookinto sales_order store_id says: 2 ?
So why this error?

In addition to @SerhiyShkolyarenko advise I also added a new record for:

sequence_creditmemo_2, sequence_invoice_2, sequence_order_2, sequence_shipment_2

Could that be the reason Of this error?

When I clear the sales_order record than I can place an order and it seems to work. Than placing an new order I get again the error:


:"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '000000000-2' for key
 'SALES_ORDER_INCREMENT_ID_STORE_ID', query was: INSERT INTO `sales_order` 

This is how the new created order number looks like:
order0000

In the sequence_order_2 table all the values are 0 ? Is that ok?

@jvreeken I looked at the screenshot

https://www.dropbox.com/s/fb17g39mo3mu9ds/Screenshot%202016-10-20%2009.50.12.png?dl=0

and seen a custom theme there and payment method code md_authorizecim which is not part of Magento CE. Is the issue is reproducible for you on clean Magento instance without custom modules and themes?

Could this be the problem?:

eav_entity

So do I also need to create an entity for store id=2 here to get rid of the "duplicate entry error?

Any idea how to solve this issue? I'm getting a bit lost now! Have the feeling that I'm close but do not know how to get there :)

@hocomadvies describe sequence_order_1;
+----------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------------+------+-----+---------+----------------+
| sequence_value | int(10) unsigned | NO | PRI | NULL | auto_increment |
+----------------+------------------+------+-----+---------+----------------+
1 row in set (0.00 sec)

is this how you created sequence_order_2 ? what do you see in sequence_order_0 ,1 and 2?

Ok, that may help :) my sequence_order_2 has no auto_increment added.

I now added it like this:

CREATE TABLE IF NOT EXISTS `sequence_order_2` (
  `sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

So I also added this for the other tables:
sequence_invoice_2
sequence_shipment_2
sequence_creditmemo_2

And now it all seems to work.

@schasiepen do you have any exception logs in var/log or var/report?

@SerhiyShkolyarenko: At first no errors in log files and no reports. But when I uncomment try/catch in PaymentInformationManagement funtion savePaymentInformationAndPlaceOrder(), I get this error message:
Report ID: webapi-5840685d21343; Message: No such entity with orderId = 2
sequence_order_1 has 231 entries Autoincrement is 232.

The funny thing is that all orders are generated, Emails are send.
I noticed:
the table eav_entity_store is empty,
tables sequence_order_0, sequence_order_2 and sequence_order_3 (I added _2 and _3) are empty. We have 3 store views (1: german, 2: italian, 3: english).
Since "Share Customer Accounts" is set to "Global", and all customers are created in store 1, I guess it is correct that only sequence_order_1 is used?

Any help/hint is very,very welcome.

Any update on this issue? Does somebody know, which SQL Query would be responsible for the error
"webapi-5840685d21343; Message: No such entity with orderId = 2" ?
I have to admit: I'm completly lost!

@schasiepen do you have the other sequence tables for invoice/shipments/creditmemo's? and meta tables (see my higher up post for list of tables!) sales_sequence_profile && sales_sequence_meta along with the tables for sequence_invoice/shipment/creditmemo?

Any update on this Magento???

The tables for store 3 were all missing for me.

I am getting this same issue. I am using PayPal Payments Pro/Payflow and the credit cards are authorized instead of completing a sale. I am hoping for a solution to this. I was excited for the new Magento version but am having lots of issues with it.

I have version 2.1.1 and had tried setting the address to only 1 field and that did not help either.

@hubaig @craigcarnell @schasiepen It might help you guys finding a solution by investigating your dbase tables and have a look if they are similar as mentioned by above topics. Seems that its al about missing tables in the database somehow. Be sure to make a back-up from your database before changing anything :) Best way to access the database in this case is through phpMyadmin.
I ran into more or less the same problems and it helped me to get it working again.

Thanks heaps everyone here. It's pretty annoying Magento does not log those errors.. The way around I found was overwriting the CouldNotSaveException class.

In your Custom Module di.xml (e.g. //etc/di.xml) add the line below:

<preference for="Magento\Framework\Exception\CouldNotSaveException" type="<NAMESPACE>\<PACKAGE>\Exception\CouldNotSaveException" />

Then create the file and add the content below:

<?php

namespace <NAMESPACE>\<PACKAGE>\Exception;

use Magento\Framework\Phrase;
use Magento\Framework\Exception\AbstractAggregateException;

class CouldNotSaveException extends AbstractAggregateException
{
    /**
     * CouldNotSaveException constructor.
     * @param Phrase $phrase
     * @param \Exception|null $cause
     */
    public function __construct(Phrase $phrase, \Exception $cause = null)
    {
        $this->originalPhrase = $phrase;
        parent::__construct($phrase, $cause);

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $logger = $objectManager->create('\Psr\Log\LoggerInterface');
        $logger->debug($cause->getMessage());
    }
}

Then again. It's not the final solution, but help us to track the errors when they happen.

CHeers,

Renato.

@hocomadvies I checked both of the tables and they look fine. I migrated from Magento 1.9 to 2.1, could that be a cause of this? I also have m2epro installed and am not sure if that is causing any issues. I see that the Auto Increment items are there. I am not able to modify any tables now because clients have already made orders using Paypal express checkout.

@hubaig in my case the problem was that the store id was not matching with the database tables. After adding them (see above) it works for me. So you have to dig into the error messages and find out where the problem is caused. I updated from 1.9 to 2.1 and think that caused the problems I had.
Look if the new orders are added, look which shop id youre using and see if that is in these tables:
sequence_creditmemo_ , sequence_invoice_ , sequence_order_ , sequence_shipment_ if not than you have to add them to the database (so sequence_order_0,sequence_order_2, sequence_order_3 etc for the shop id you need.

@hocomadvies the store I am using, it's id is 1 and I see that all of the tables for it are there are they auto increment is setup fine. I did notice one thing. I have another store in there with an id 2 but the tables do not exist for it. This store is not serving any traffic in the front end but I have it hooked up to Amazon and eBay with m2epro. Only store with id 1 is trying to use PayPal flow. Not sure if that is the problem. I can try adding tables for store 2 and try again.

Adding these three tables for store id 2 did not help. Still getting declined errors. I see users have added ways to see exceptions. Is there a way someone can give detailed info on how to debug this, I am fairly new to magento 2 and am having trouble getting the exceptions to try troubleshooting this further. I am hosting this on CentOS 6 with cPanel.

I'm still having the problem on my staging environment with v2.1.3 ... it works fine on my local... I don't get it...

I had the same problem. As soon as I commented out the try/catch block mentioned by @southerncomputer (https://github.com/magento/magento2/issues/6929#issuecomment-263965185), the error message became more precise: "Could not start transaction because there are multiple line items with the same SKU." Has something to do with the Saferpay payment module in my case.

We ran into the same problem as @southerncomputer with a demo shop of ours. In our case the sequence tables for store id 2 were missing, so we added them by running these SQL statements on our database and now we can proceed again through the checkout:

INSERT INTO `sales_sequence_meta`
       (`entity_type`, `store_id`, `sequence_table`)
VALUES ('order', 2, 'sequence_order_2'),
       ('invoice', 2, 'sequence_invoice_2'),
       ('creditmemo', 2, 'sequence_creditmemo_2'),
       ('shipment', 2, 'sequence_shipment_2');

CREATE TABLE `sequence_order_2` (
  `sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`sequence_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `sequence_invoice_2` (
  `sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`sequence_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `sequence_creditmemo_2` (
  `sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`sequence_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `sequence_shipment_2` (
  `sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`sequence_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

@veloraven people on this thread are having different and unrelated problems with different payment methods. The main issue here is that whatever is going on under the hood is not correctly reported on the front-end. Magento's CheckoutModel\PaymentInformationManagement->savePaymentInformationAndPlaceOrder should be able to capture exceptions thrown by the underlying payment methods and display the correct error to the front-end. At the moment, any request to the Web API is simply thrown back to the customer as a generic 500 error message.

Furthermore, Magento does not provide any way to the payment method to correctly set the error when the API request is made. In other methods such as assignData(), throwing an exception works, however in authorize() and capture() requests, the Web API fails to catch thrown exceptions.

@snez: The first issue you are mentioning is being tracked (and already fixed on the develop branch) over here I think: https://github.com/magento/magento2/issues/6246

Having the same error at check out.

2.1.1, dev server, paypal pro, migration from 1.9

no orders getting placed in database...

Looks like the store ID is 1 based on the admin > store > all stores , and when you hover over the link i see a "1" so I assume store id is 1

See attached, does it matter if my meta_id order is not lined up with the other tables?, seems like the above examples the tables were sorted in correct order as mine are every other store ID from 0 to 1

screenshot 2017-01-03 22 54 07

Really sorry for my ignorance but I'm getting the same issue here. I'm so new to this that I don't even know how you guys are checking the database. What program are you using to verify the database columns? My server is on Ubuntu and I'm very new to linux.

@mattlaltman well you could install phpmyadmin on the server and have a look into the tables there. But before doing that first make a copy of your database :)

@muhupower Hi if I am right the sequence is the key to look at here. If you look at sales_sequence_profile you can see that it goes through the order process step by step. starting by 1 . So your table should look the same as some of the examples above.

Thanks hocomadvies, I tried editing the table to make it look similar to above this.

493d537e-9aed-11e6-9fa2-54ec68fbd6c4

but I am getting an error

screenshot 2017-01-06 20 55 18

I'm still not able to solve the problem. I created all the missing tables, checked the sales_sequence_meta and -profile tables and added missing entries. No good.
It would help a lot knowing the sql queries behind the order placement. Is there a way to catch all of them?
Also in our installation the table eav_entity_store is completly empty? Is this table used at all??

Any help is very, very welcome.

@muhupower These two need to match as well!

select * from sales_sequence_meta;

+---------+-------------+----------+-----------------------+
| meta_id | entity_type | store_id | sequence_table |
+---------+-------------+----------+-----------------------+
| 1 | order | 0 | sequence_order_0 |
| 2 | invoice | 0 | sequence_invoice_0 |
| 3 | creditmemo | 0 | sequence_creditmemo_0 |
| 4 | shipment | 0 | sequence_shipment_0 |
| 5 | rma_item | 0 | sequence_rma_item_0 |
| 6 | order | 1 | sequence_order_1 |
| 7 | invoice | 1 | sequence_invoice_1 |
| 8 | creditmemo | 1 | sequence_creditmemo_1 |
| 9 | shipment | 1 | sequence_shipment_1 |
| 10 | rma_item | 1 | sequence_rma_item_1 |
+---------+-------------+----------+-----------------------+
10 rows in set (0.00 sec)

mysql> select * from sales_sequence_profile;
+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
| profile_id | meta_id | prefix | suffix | start_value | step | max_value | warning_value | is_active |
+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
| 1 | 1 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 2 | 2 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 3 | 3 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 4 | 4 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 5 | 5 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 6 | 6 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 7 | 7 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 8 | 8 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 9 | 9 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 10 | 10 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 |
|+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+

eav_entity_store is old and is used by some custom modules like cart2quote!

southerncomputer, but I cant make edits to the meta_id to change the order, i get an error

mysql> SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'xxxx' AND REFERENCED_TABLE_NAME = 'sales_sequence_meta';
+------------------------+-------------+------------------------------------------------------------+-----------------------+------------------------+
| TABLE_NAME | COLUMN_NAME | CONSTRAINT_NAME | REFERENCED_TABLE_NAME | REFERENCED_COLUMN_NAME |
+------------------------+-------------+------------------------------------------------------------+-----------------------+------------------------+
| sales_sequence_profile | meta_id | SALES_SEQUENCE_PROFILE_META_ID_SALES_SEQUENCE_META_META_ID | sales_sequence_meta | meta_id |
+------------------------+-------------+------------------------------------------------------------+-----------------------+------------------------+

you see how there is an order to changing these two tables?

i see, but i have no idea how to do it lol.... can you help? there is no PM feature on gitub.. owen at messtudios dot com is my email

what do your sales_sequence_profile and _meta look like now? you have to add the rows to sales_sequence_profile before adding them to sales_sequence_meta and make sure the meta_id jives between them

screenshot 2017-01-10 09 58 12
screenshot 2017-01-10 09 59 12

try delete * from sales_sequence_profile - changing the order of your sales_sequence_meta to match everyone else then rebuild sales_sequence_meta with the same values! Not sure if the order matters that much!

mysql> select * from store;
+----------+---------+------------+----------+-------------------+------------+-----------+
| store_id | code | website_id | group_id | name | sort_order | is_active |
+----------+---------+------------+----------+-------------------+------------+-----------+
| 0 | admin | 0 | 0 | Admin | 0 | 1 |
| 1 | default | 1 | 1 | Default Storesite | 0 | 1 |
+----------+---------+------------+----------+-------------------+------------+-----------+
2 rows in set (0.00 sec)

you have only 2 stores right?

no there is only 1 store, we migrated from 1.9

what does your select * from store show?

screenshot 2017-01-10 10 17 40

mysql> describe sequence_order_1;
+----------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------------+------+-----+---------+----------------+
| sequence_value | int(10) unsigned | NO | PRI | NULL | auto_increment |
+----------------+------------------+------+-----+---------+----------------+
1 row in set (0.00 sec)

mysql>
show index from sequence_order_1;
+------------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+------------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| sequence_order_1 | 0 | PRIMARY | 1 | sequence_value | A | 426 | NULL | NULL | | BTREE | | |
+------------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

when you made sequence_order_1 did you set it up exactly as described above? It doesn't sound like this is your problem!

I never set it up, this was already in the system once we migrated it. So what i have is correct then?

also your keys for meta/profile:
mysql> show index from sales_sequence_profile;
+------------------------+------------+----------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+------------------------+------------+----------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| sales_sequence_profile | 0 | PRIMARY | 1 | profile_id | A | 10 | NULL | NULL | | BTREE | | |
| sales_sequence_profile | 0 | SALES_SEQUENCE_PROFILE_META_ID_PREFIX_SUFFIX | 1 | meta_id | A | 10 | NULL | NULL | | BTREE | | |
| sales_sequence_profile | 0 | SALES_SEQUENCE_PROFILE_META_ID_PREFIX_SUFFIX | 2 | prefix | A | 10 | NULL | NULL | YES | BTREE | | |
| sales_sequence_profile | 0 | SALES_SEQUENCE_PROFILE_META_ID_PREFIX_SUFFIX | 3 | suffix | A | 10 | NULL | NULL | YES | BTREE | | |
+------------------------+------------+----------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
4 rows in set (0.00 sec)

mysql> show index from sales_sequence_meta;
+---------------------+------------+------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------------------+------------+------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| sales_sequence_meta | 0 | PRIMARY | 1 | meta_id | A | 10 | NULL | NULL | | BTREE | | |
| sales_sequence_meta | 0 | SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID | 1 | entity_type | A | 10 | NULL | NULL | | BTREE | | |
| sales_sequence_meta | 0 | SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID | 2 | store_id | A | 10 | NULL | NULL | | BTREE | | |
+---------------------+------------+------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

@muhupower I would say so. What error are you getting when you comment out the code I mentioned originally?

Comment out the exception catcher in vendor/magento/module-checkout/Model/PaymentInformationManagement.php

Then try again, you will see an error show up in your logs in production mode!

For me it was an extension that used a plugin that was calling an undefined variable!

Comment out the TRY { } { catch} but not the
$orderId = $this->cartManagement->placeOrder($cartId);

This will expose the underlying error to a tee!

// try {
$orderId = $this->cartManagement->placeOrder($cartId);
/* } catch (\Exception $e) {
throw new CouldNotSaveException(
__('CNSE1: An error occurred on the server. Please try to place the order again.'.' '.$cartId.$sam.' '.$orderId),
$e
);
}
*/

comment out // TRY and /* the exception*/ code and run it in development mode and see what error you are getting!

Nothing Happens...

I even changed the output of the last letter to says . Please try to place the order agains. with an s at the end, and the error still comes up without the s.

Its like this isn't the correct file or something.

Thanks for you help so far.

screenshot 2017-01-10 11 01 35
screenshot 2017-01-10 11 01 50
screenshot 2017-01-10 11 02 02

are you recompiling and flushing cache/restarting php-fpm/varnish after making those changes?

I made a shell script i run from public_html for production mode:

!/bin/bash

touch pub/static/deployed_version.txt
php bin/magento deploy:mode:set production
php bin/magento cache:clean
chown -R scw:scw * &
service varnish restart &
service php-fpm restart &
service nginx restart &

or for development mode:

!/bin/bash

php bin/magento deploy:mode:set developer
php bin/magento cache:clean
chown -R scw:scw * &
service varnish restart &
service php-fpm restart &
service nginx restart &

hah.. how long is this supposed to take? looks like its stuck on "starting compilation", and the site is down.

screenshot 2017-01-10 11 21 24

Takes a few minutes depending on your speed. I have 50 cores and it still takes a few minutes! since it is single threaded php!

@southerncomputer when I comment out the code, where should I see the exception?

Thanks for all your help... turns out my client fixed it, we were paying with paypal, accepting cc on the website... and it was an internal setting paypal had to change in order to get this to work!

@muhupower
can you please share what setting this is?

This is so frustrating. I have not been able to accept any payments on my website for a month now.

I tried commeting out try/catch in vendor/magento/module-checkout/Model/PaymentInformationManagement.php but when I do it does not return any exception.

Any help would be appreciated.

@hubaig, this might help: https://github.com/magento/magento2/issues/6246#issuecomment-258830520
Maybe it helps if you apply the changes they did to the PaymentInformationManagement.php and GuestPaymentInformationManagement.php in that commit. It should then log the actual problem in the exception.log file.

@hostep Thank you for the reply. I copied the two files and still do not get any exception in var/log/exception.log

Just a little background - I am using Magento ver. 2.1.1, using porto theme and migrated from 1.9.x.

@hubaig I think it might be important to note what type of payment method you are using during checkout... The odd thing was for me is that we used paypal offsite and onsite processing... the one that directed to their paypal.com payments page worked, but we were getting this error while trying to process cc on the actual website. In our case as it turns out the paypal tech support agent was able to configure settings on his end to let it go through.... So if you are having this issue, we though it was magento's fault for a while, and in the end it turned out being a setting in paypal

@muhupower do you know what setting they enabled?

Using @southerncomputer solution works for me.

In my case, store number 3 was broken so:

  1. Added missing sales sequence meta
  2. Created missing tables sequence_order_3, sequence_invoice_3, sequence_creditmemo_3, sequence_shipment_3
  3. Added missing entries to sales_sequence_profile to match with sales_sequence_meta

INSERT INTO sales_sequence_meta
(entity_type, store_id, sequence_table)
VALUES ('order', 3, 'sequence_order_3'),
('invoice', 3, 'sequence_invoice_3'),
('creditmemo', 3, 'sequence_creditmemo_3'),
('shipment', 3, 'sequence_shipment_3');

CREATE TABLE sequence_order_3 (
sequence_value int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (sequence_value)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE sequence_invoice_3 (
sequence_value int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (sequence_value)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE sequence_creditmemo_3 (
sequence_value int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (sequence_value)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE sequence_shipment_3 (
sequence_value int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (sequence_value)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO sales_sequence_profile (profile_id, meta_id, prefix, suffix, start_value, step, max_value, warning_value, is_active)
VALUES
(13, 13, 3, NULL, 1, 1, 4294967295, 4294966295, 1),
(14, 14, 3, NULL, 1, 1, 4294967295, 4294966295, 1),
(15, 15, 3, NULL, 1, 1, 4294967295, 4294966295, 1),
(16, 16, 3, NULL, 1, 1, 4294967295, 4294966295, 1);

The main store that I am using has the ID of 1, all of my products are using that store. Here is the screenshot of my tables. Do you guys see anything wrong here?

SELECT * FROM sales_sequence_meta

image

SELECT * FROM sales_sequence_profile

image

All of the tables exist:
image

Even here is the store table:

SELECT * FROM store

image

@nuwaus thank you for the answer, finally there were three storeids in my stores table, and table sales_sequence_meta and sales_sequence_profile only contain the data for the 2 store ids so added a record for the third store id and created tables manually with the same name and it solves my problem

Ran into exactly the same vague error as everyone. Went through all the steps everyone suggested and nothing. I would get no other error to show up anywhere.

I use Website Payments Pro (Canada), so finally I figured I'd see if I get some error codes via the manager.paypal portal. Looked at the transaction log and lo and behold Invalid Merchant Credentials galore. I though I supplied the correct ones but I guess not. tomorrow I'll double check with Paypal what they have to be and see if this helps, fixes the issue. [Need to wait till monday for integration support]

See also related:

8254

7977

Ok spoke with Paypal over the last two days, traced the issue to Magento and not Paypal.

Preconditions
Ubuntu 16.04
Nginx 1.10.0
PHP 7.0.13 (CLI and FPM)
MariaDB-10.1.21
Varnish-4.1.1
Redis-cli 3.0.6
Magento 2.1.3 - Single Store

Set Payment Method in Stores->Configuration->Sales->Payment Methods->Paypal Payflow Pro (Canada) (Includes Express Checkout) (Or Websites Payments Pro)

Give all required configuration information like Email, Partner etc.

Steps to reproduce

Add ANY product in cart

Go to Checkout page

Check out as guest or registered user

Provide Shipping information and choose any available shipping method.

Choose credit card payment method

Then click place order

Expected result

Order processed and confirmed

Actual result

Error message: "An error occured on the server. Please try to place the order again."

Analysis

Paypal Manager report shows:

  • Transaction as a 10501 error. "Error 10501 Invalid Configuration – This transaction cannot be processed due to an invalid merchant configuration."
  • Wrong currency being sent to paypal USD instead of CAD
  • Zero cart amount being sent to paypal

Magento Debug shows (Anonymized Buyer Data) :

[2017-02-07 01:03:44] main.DEBUG: array (
'request' =>
array (
'user' => '*',
'vendor' => 'frankjones',
'partner' => 'PayPalCa',
'pwd' => '
',
'verbosity' => 'HIGH',
'BUTTONSOURCE' => 'Magento_Cart_Community',
'tender' => 'C',
'trxtype' => 'A',
'amt' => 0,
'createsecuretoken' => 'Y',
'securetokenid' => '804bbfbd34e7c38e767y5ced4b1a6a68',
'returnurl' => 'https://website.com/paypal/transparent/response/',
'errorurl' => 'https://website.com/paypal/transparent/response/',
'cancelurl' => 'https://website.com/paypal/transparent/cancel/',
'disablereceipt' => 'TRUE',
'silenttran' => 'TRUE',
'firstname' => 'Mark',
'lastname' => 'Rogers',
'street' => '101 Yonge Street',
'city' => 'Toronto',
'state' => 'ON',
'zip' => 'M1A7G6',
'country' => 'CA',
'email' => NULL,
'shiptofirstname' => 'Mark',
'shiptolastname' => 'Rogers',
'shiptostreet' => '101 Yonge Street',
'shiptocity' => 'Toronto',
'shiptostate' => 'ON',
'shiptozip' => 'M1A7G6',
'shiptocountry' => 'CA',
),
'result' =>
array (
'result' => '0',
'securetoken' => 'XmOcHxPoCI8Wd3kC1g4VY2wL2',
'securetokenid' => '804bbfbd34e7c38e767y5ced4b1a6a68',
'respmsg' => 'Approved',
'result_code' => '0',
),
) {"is_exception":false} []
[2017-02-07 01:03:47] main.DEBUG: array (
'STATE' => 'ON',
'ACCT' => '
',
'ZIPTOSHIP' => 'M1A7G6',
'BILLTOLASTNAME' => 'Rogers',
'BILLTONAME' => 'Mark Rogers',
'SHIPTOCITY' => 'Toronto',
'LASTNAME' => 'Rogers',
'PNREF' => 'BT0PF45153E0',
'ADDRESSTOSHIP' => '101 Yonge Street',
'SHIPTOZIP' => 'M1A7G6',
'BILLTOFIRSTNAME' => 'Mark',
'AMT' => '0.00',
'SHIPTOCOUNTRY' => 'CA',
'TRANSTIME' => '2017-02-06 17:03:45',
'NAMETOSHIP' => 'Mark Rogers',
'ZIP' => 'M1A7G6',
'BILLTOCOUNTRY' => 'CA',
'EXPDATE' => '
*
',
'STATETOSHIP' => 'ON',
'RESPMSG' => 'Invalid merchant information: 10501-This transaction cannot be processed due to an invalid merchant configuration.',
'COUNTRY' => 'CA',
'BILLTOZIP' => 'M1A7G6',
'SHIPTOSTREET' => '101 Yonge Street',
'SHIPTOSTATE' => 'ON',
'BILLTOCITY' => 'Toronto',
'BILLTOSTATE' => 'ON',
'CARDTYPE' => '0',
'FIRSTNAME' => 'Mark',
'AVSDATA' => 'XXN',
'CITYTOSHIP' => 'Toronto',
'SECURETOKEN' => 'XmOcHxPoCI8Wd3kC1g4VY2wL2',
'SECURETOKENID' => '804bbfbd34e7c38e767y5ced4b1a6a68',
'CITY' => 'Toronto',
'NAME' => 'Mark Rogers',
'HOSTCODE' => '10501',
'COUNTRYTOSHIP' => 'CA',
'BILLTOSTREET' => '101 Yonge Street',
'RESULT' => '5',
'ADDRESS' => '101 Yonge Street',
) {"is_exception":false} []

Further Considerations

The same error occurs no matter what we do with the CCV settings either in Paypal or Magento.
Switching to Payflow link (something we are not signed up for but we did it just to test), does send the correct currency but throws the same error ultimately.

Conclusion

Having the ability to take payments is the essence of a shopping cart. We switched over to Magento 2 and wondered for a few weeks why our sales dropped off like crazy. Just a trickle came through. (People can check out using Paypal Checkout Express). Given the amount of people using paypal as their go to payment processor, makes this and other paypal issues some of the most pressing and important to solve on an expedited basis if possible. Some of the other bugs we can live with but not being able to take payments does make the Magento 2 proposition difficult to continue with.

@gooki
It appears your having the same issue as me. PayPal Payments Pro is not sending the proper currency to charge the customer in when doing the API call.

I can also confirm that my M2 installation passes an "AMT" of 0 as well. It charges the card afterwards (albeit in USD) so I don't see this being an issue in itself.

There shouldn't be any special config that is different from PayPal Payments Pro and PayFlow Link so I'm not sure why you're experiencing issues (unless there's a typo but I'm assuming you tried retyping everything a few times).

It may be the way the api is configured for PayPalCA, it may be taking the default settings for Paypal Payments PRO (American one) and applying them to Website Payments PRO (The Canadian Iteration). So it's passing the wrong information to Paypal ie. USD, and because it's sending USD instead of CAD the total transaction value is then zero because no CAD is being sent but USD? It's all conjecture but it may be the case. Thoughts?

@gooki: Magento 2.1.4 just got released and the release notes says something about fixing wrong currency being send to paypal, so maybe it's worth trying upgrading and testing if your issue is fixed by the update?

@hostep thanks for the suggestion will do and report back
@supanatral maybe you can upgrade to 2.1.4 too and let us know if it helped

Tested with 2.1.4 and unfortunately no dice.
USD still being sent to paypal, zero amount, and instead of Sale its sending Authorization.
Tested with both Website Payments Pro and Payflow Pro

Paypal Report:
Transaction Result Details
Transaction ID:
BU0PF3D82422
Result Code: 5
PayPal Transaction ID:
Timestamp: Feb 08, 2017 14:19:49 PM
Response Message: Invalid merchant information
Transaction Type: Authorization
Authorization Code: 111111
Tender Type: Visa
AVS Street Match:
Credit Card Number: 4344
AVS Postal Code Match :
Credit Card Expiration: 12 / 2017
International AVS Indicator:
Amount: 0.00 USD
Card Security Code Match:
Tax Amount: 0.00 USD
ABA #:
Shipping/Freight Amount: 0.00 USD
Cust Ref #:
Duty Amount: 0.00 USD
Recurring: No
Original Amount: 0.00 USD
Payment Advice Code:

Transaction Status
Transaction State: 1
Date To Settle: Feb 08, 2017 11:19:49 AM
Date Settled:
Response Code: 10501
Error Code:
Auth Resp Text:

This is so frustrating. I am not sure what to do. I am using Pay-flow Canadian version and nothing I do works. I don't even know what alternate method to use.

@hubaig many people have this problem for different reasons. Paste your exception here and I'll let you know how to debug it. The exception can be found by inspecting the AJAX request from your browser's network tab in the debugger and should look similar to https://github.com/magento/magento2/issues/6929#issuecomment-252723067

I'm using magento 2.1.4 and I have tried everything on this page.. but still I'm getting 400 on {magento_root}/rest/default/V1/carts/mine/payment-information.

Other things that I've tried were adding products which can be shipped ( i.e, not downloadable and have weight). This was done to make sure to have shipping tab on checkout page. The object being posted seems to be missing shipping address and other uninitialised fields in billing address.

POST payload :
{"cartId":"1","billingAddress":{"customerAddressId":"1","countryId":"NL","regionId":"0","regionCode":null,"region":null,"customerId":"1","street":["wz857","streetline2"],"telephone":"9205920833","postcode":"3011 za","city":"amsterdam","firstname":"P","lastname":"P","saveInAddressBook":null},"paymentMethod":{"method":"paypalngp","po_number":null,"additional_data":null}}

P.S: I'm working on custom payment module, which worked perfectly on 2.1.3, without using REST API directly.

I hate to add the pointless "I'm having this issue too" comment but; I have tested this on my end and I'm getting the same result as @gooki.

The when placing an order, the API call doesn't send PayPal the currency code.

I checked the differences between 2.1.3 and 2.1.4 and the only file that is different and refers to currency is "vendor/magento/module-paypal/Test/Unit/Model/Payflow/TransparentTest.php"

Maybe this is a silly question but does anyone know which file calls the PayPal API? (vendor/magento/module-paypal/Model/Api/PayflowNvp.php ???) I'm hoping there is a way that we can hard code it to send the currency, at least until Magento fixes this bug...

@supanatral, see this commit which is included 2.1.4: https://github.com/magento/magento2/commit/1c7f70d751f3cb2bcd2e076e97b900a3fc3912cc
This is where the currency should be set correctly. (I'm not familiar with the Paypal code in Magento, so if you have other questions regarding this, I probably won't be able to answer them).

Maybe it is also a good idea for everyone who has a different issue in here, to create a brand new issue, because this thread is starting to fill up with a lot of different issues mixed together. The Magento support people probably will have a hard time figuring out what this thread is all about. If you create separate issues then it will be more clear for the support people what the exact issue is about and they might be able to help you quicker.

Good call @hostep. I will start posting more information to issue #7977

If anyone else is having the issue of charging in USD funds than I would invite them to join us over there.

Im having issues with Briantree and receiving the same error and now "record does not exist" message.

How to reproduce:

place item in cart and go thru the checkout process
enter credit card and "place order"

should have order go thru but get this error on the screen shot.

Im using 2.1.3 in a development file not in production yet. Its been 4 months trying to resolve this and nothing. Im not the one doing the trouble shooting (hired a few people to do it)

Spoke to the people at brain tree and this is what they wrote:

What I can tell you is that the reason you are receiving the error is because a payment method nonce is not being populated in the API call to Braintree, which is something Magento is responsible for generating. Since we are not Magento ourselves, I have no ability to assist you with issues on the Magento side of things.

Hi Freddy,

Thanks for following up. I was able to locate a request from January 24 (the day of your screenshot) in our server logs. Here is the request:

Parameters: {"transaction"=>{"type"=>"sale", "customer"=>{"first_name"=>"freddy", "last_name"=>"pineda", "company"=>nil, "phone"=>"1234567890", "email"=>"[email protected]"}, "amount"=>"106.53", "payment_method_nonce"=>nil, "order_id"=>"000000025", "channel"=>"Magento2_Cart_Community_BT", "billing"=>{"first_name"=>"freddy", "last_name"=>"pineda", "company"=>nil, "street_address"=>"1470 SE 18th Terrace", "extended_address"=>nil, "locality"=>"Homestead", "region"=>"FL", "postal_code"=>"33035", "country_code_alpha2"=>"US"}, "shipping"=>{"first_name"=>"fred", "last_name"=>"pineda", "company"=>nil, "street_address"=>"1470 SE 18th Terrace", "extended_address"=>nil, "locality"=>"Homestead", "region"=>"FL", "postal_code"=>"33035", "country_code_alpha2"=>"US"}, "options"=>{"store_in_vault_on_success"=>true, "submit_for_settlement"=>true}}, "merchant_id"=>"x2v3v33wk5pykk4n"}

and here is the error it caused:

[VALIDATION ERRORS] 91508 (Cannot determine payment method.), 81706 (CVV is required.)
This error was caused because, as you see in the above log, payment_method_nonce​ is nil​. A payment method nonce is a string returned by the client SDK to represent a payment method. In your case, it likely indicates that you have not entered any card information in your checkout form. I'd suggest reviewing your inputs and attempting another test with a valid card.

I CAN ASSURE IM ENTeRING THE CORRECT INFORMATION ON THE CREDIT CARD SPACE.

also tried reaching out to my web host and this is what they sent:

Unfortunately we were not able to determine the exact reason for the issue. For some reason the application is returning:

POST https://www.freezerworkwear.com/development/rest/supermarket_en/V1/guest-carts/29940bfffa2007be4f5551fd0f6c7019/payment-information 400 (Bad Request)

screen shot 2017-01-24 at 11 35 29 pm

i use Magento ver. 2.1.5 and experimented the error for many week on a dummy install with nothing else than magento, no template, no add on. (an error occurred on the server. please try to place the order again).
No solution for this problem on Braintree or Authorize.net Thinking to return to 1.9. V1.9 work perfectly.
What is an e-commerce solution without payment........!!!@!@#@!@#. BAD MOVE TO v2 of MAGENTO. THINKING ABOUT CHANGE SOLUTION E-COMMERCE>

hello,

if you change the number of line addres 2 -> 1

you can execute this :

UPDATE customer_address_entity SET street=REPLACE(street,'\n',', ')

for me it's work...

Thanks for the help.

I made the change I receive 2 error messages.

One of magento


Attention Sorry, but something went wrong. Please contact the seller.


and one by email


Authorize.Net Developer Center Merchant,

Your script timed out while we were trying to post transaction results to it.
Transaction ID: 0
Transaction Result: This transaction has been approved.

The following message was displayed to the customer:;


But the transaction complete !!!

do you have an idea

Thank a lot.

On 01/03/17 05:06 PM, puples wrote:

hello,

if you change the number of line addres 2 -> 1

you can execute this :

UPDATE customer_address_entity SET street=REPLACE(street,'\n',', ')

for me it's work...


You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/magento/magento2/issues/6929#issuecomment-283486303, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASVyfQn3lc_OLumL59IS7OJrpM0VvBUKks5rhev1gaJpZM4KRqIJ.

I encountered this issue due to the database field quote.reserved_order_id being an already existing order. The database constraint caused the insert statement to fail. This was immediately following a bad paypal order attempt, so perhaps the reserved id was updated in the quote, but the sales_sequence increment ID was not. I was only able to resolve this by manually deleting the reserved_quote_id from the database.

To make matters worse, these exceptions are not logged in the DB (WTF?), so if this happens to customers in production, you simply won't know.

The problem is that the order was made using the reserved_order_id in attempt #1 quote, so now when you retry PayPal, it will try to use that reserved_order_id as the sales_order.increment_id and fail!

What I did was check the sales_order table to see if the increment_id existed before submitting the quote (to become an order), if it exists, empty reserved_order_id and if $orderData exists, unset increment_id. This will force the quote to use a new reserved_order_id to create a new order and succeed. Now PayPal knowing the original reserved_order_id or the new one - that is for you to work out!

Around here's what you'll ned to tweak:
one page.php
adminorder/Create.php
module-paypal-express..checkout.php
etc..

    $order = $this->quoteManagement->submit($quote, $orderData);

psst. does anyone know a fix that stops apostrophe's from killing the order submit (in shipping address?)

I'd recommend a plugin of "beforeReserveOrderId" in "Magento\QuoteModel\Quote".

This way, it's not an invasive fix, and it's not dependent on any particular order method and will always ensure no bad reserved quote IDs are used. Here's my plugin code to do just that:

public function beforeReserveOrderId(\Magento\Quote\Model\Quote $quote) {
    $reservedOrderId = $quote->getReservedOrderId();

    if($reservedOrderId) {
        $order = $this->orderFactory->create()->loadByIncrementIdAndStoreId($reservedOrderId, $quote->getStoreId());
        if($order->getId()) {
            $quote->setReservedOrderId(null);
        }
    }

    return null;
}

As for apostrophe's in shipping addresses causing problems, I did a quick test and didn't have an issue (I used "123' Main Street". Can you explain in more detail what you're encountering?

Yeah that seems more elegant. We have about 50+ concurrent admins creating/editing quotes and orders - so the plugin method wasn't as elegant since you may need to force constraint depending on the job at hand!

Say if the company had a single apostrophe in the customer_address_entity copied to quote_address and you made an ADMIN order in the backend, the ship method and totals would go to zero - upon clicking on a shipping method it would say no quotes available for this order! and kaput!

Hi, I hope someone can help me. I have inherited a Magento 2 from another developer. We have had issues from the get go. I highest priority of the issues is some of our customers are able to place an order and others receive errors. Some errors are "An error occurred on the server. Please try to place your order again", and other errors to do with the server, and zip code. We recently upgraded from 2.1.0 to 2.1.5. The issues were occurring prior to the upgrade and still continuing after the upgrade. I am open to any solutions. The owner of the company is wanting to dump Magento all together. I need to try to save it if all possible. Thanks in advance.

Candyjo - I've had issues with the checkout as well. My ordeal began in August 2016 and I decided to dump Magneto 2 in late January. After getting 4 different developers to try to help, no one has found the answer. Not even the developer of the check out module.....So after much wasted time and $$$ I dumped altogether and updated my Zen Cart.

So for the time M2 will be on the shelf for the near future.

Good luck with you project.

I'm having the same issues with Magento 2.1.1. After following everything on this guide, I'm not able to find a fix. I have a feeling it's something with either Varnish or permission settings. Everytime I contact my hosting company, they were able to fix it, but after a customer goes online to purchase a product, it would fail again. And if you fail once, it will not let you use PayPal as that button becomes disabled.

My site is here - http://bit.ly/2nI8Qpt

(magento 2.1.5)

Me too could not place an order, with the same symptoms that everybody here, so I tried to make an order using the BACKOFFICE ADMIN login, and found out the exact problem (within the detailed error message that the backoffice provides, contrary to the frontend).

So, my advise, is try to place an order in the backoffice and check the errors (on screen).

Has anyone hound a solution to this. We are at the point of reverting back to Magento 1.9.x
I am on 2.1.5 and every 4th or 5th order gives the "An error occurred on the server. Please try to place the order again" - This is obviously a bug

@riprod have you tried my solution (2 posts above?)

Are you referring to testing an order in the back end ? I can't do that because it says "No Payment Methods available". Not sure why

strange! Yes that was the only way i tracked the problem to a plugin.

The error message at checkout occurs essentially as a "catch all" for some part of the order creation process throwing in exception. Because there are many moving parts in order creation (plugins, events, etc), the straightforward way to figure out exactly why the order is failing is to restore a backup of the website to a development environment and debug the code. This is how I found out that my problem was using a reserved_order_id that already existed as an order. The actual exception thrown mentioned a duplicate key database constraint being violated.

My error was occurring at "vendor\magento\module-quoteModel\QuoteManagement.php" at the line $order = $this->orderManagement->place($order);

That statement is wrapped in a try-catch block. Adding a breakpoint in the catch block will allow you to see the detailed error message. If your error is not occurring at this line, you can search the entire code base for the phrase "Please try to place the order again.". There are only 4 occurrences right now that are candidates for being the error message you are seeing. Add breakpoints at all of them and see what gets hit. From there, you have to follow the code until the error occurs.

The tricky part here is making sure the problem is reproducible on the dev environment to do proper debugging. You will likely need to log in as the particular customer encountering the issue which may require some password field manipulation/resetting in the dev version. Overall, I realize that this solution is not available to everyone since it requires a Magento developer with experience to be able to navigate and debug the code, but due to the error being so general and NOT EVEN BEING LOGGED, this is likely to be the only reliable method of squashing whatever bug may be occurring.

Also, please make sure your issue is not because of a reserved_order_id on the quote matching an already existing sales order. You'll have to look at the database fields in tables quote and sales_order. If any reserved_order_id in an ACTIVE quote matches the increment_id of a sales_order (both within the same store), the customer who owns that quote will get the dreaded error message you are seeing when Magento tries to create an order using an increment_id that has already been used.

@AirmanAJK Really nice response. I see that the areas where the error occurs, there is a generic exception thrown without even logging the real exception. The way to really see the exact exception is to add breakpoints. Setting up remote debugging in your IDE will really go a long way in troubleshooting the issue. I migrated from Magento 2.0.11 to Magento 2.1.5 and started experiencing the issue. In my case, it was an error about Region being a required field.
I set a breakpoint here: https://github.com/magento/magento2/blob/2.1.5/app/code/Magento/Checkout/Model/PaymentInformationManagement.php#L71 to see the exact error.

Turning off the setting from the admin that required state solved it for me.

What Magento2 seems to me is that the developers needed to meet the release deadline because management insisted that they had to, so developers had no choice but to release software was not ready for production. We were amongst the first shops to migration from Magento 1.8.x to Magento 2 - At the time, Magento 2.0.5. It was a horrible experience. Every single thing that could go wrong indeed went wrong. From wrong EAV attribute ids to customers not able to log out, to missing cart, just name it.
I am currently facing an issue with Magento assigning the value of my region field (string) to region_id (int) and as a result throwing return type errors. Setting breakpoints in the browser using chrome developer tools, I seem to see where the error is coming from. Without using debuggers to step through Magento code(in the browser and in your IDE) in developer mode, it is almost impossible to get to the root of the errors. Really bad Magento team.

HI All, I have the same error :
An error occurred on the server. Please try to place the order again.

And I catched it on the log as :
INVALID_REQUEST: Field [order.avsDetails.billToFirstname] was not in charset [ISO-8859-1]

I used Arabic words in the inputs.

So any body can help.

We're having the same issue. We have no 3rd party modules. It happens in Porto theme and Luma. Authorize.net shows successful transactions, and the orders show as pending in the backend, but the user sees an error. Any solution yet?

error
settings

We have had the same issue with our site.
Magento 2.1.4
Payment Method: Authorize.net
Process:
Customer status: immaterial
Place any item in cart.
proceed to checkout
enter address/shipping method
continue to payment page
enter payment information
Place Order

Expected Result:
Order success page
Receive transaction email with new order number

Actual Result:
page blinks and all data remains on page
no indication of success page
no order verification emails received by customer
Authorize.net receives payment and proceeds to process
Order is created in Admin
*Red error box appeared briefly during one attempt stating "An Error Occurred on the Server. Please try again."

Payments were processed through Authorize.net, the order was created in Admin, but Magento2 was not proceeding with payment success page or transaction emails. We had a breakthrough when we created an order through Admin and received the error "The transaction was declined because the response hash validation failed." We did not set up the md-5 hash function between Authorize.net and Magento on the recommendation of a rep at Authorize.net.

Once we set up the md-5 hash on Authorize.net and in Magento Admin, orders processed normally. Say a prayer that this fix sticks!

Thanks for all the clues.

What is the location in Magento to add the MD5 hash code? I'm not finding it...

Thanks in advance....

It is located in the Magento Admin. Go to: Stores>Configuration>Sales>Payment Methods>Authorize.net Direct Post>Merchant MD5.

You must also save the same code on Authorize.net. It can be anything up to 20 characters.

Gambi52 - Many thanks... the issue is I'm using CIM and the plugin does not have the field... They are adding it, but feel this will not solve the issue.. I'm very green to Magento... so sorry for the newbie questions / comments...

May I ask, can someone translate this to English for me?

"{"message":"An error occurred on the server. Please try to place the order again.","trace":"#0 /home/digidwo/public_html/app/code/Amasty/Checkout/Model/GuestPaymentInformationManagement.php(47): Magento\Checkout\Model\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder('f03644e07e13fad...', 'bhills_4300@mai...', Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address\Interceptor))\n#1 [internal function]: Amasty\Checkout\Model\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder('f03644e07e13fad...', 'bhills_4300@mai...', Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address\Interceptor), Array)\n#2 /home/digidwo/public_html/vendor/magento/module-webapi/Controller/Rest.php(307): call_user_func_array(Array, Array)\n#3 /home/digidwo/public_html/vendor/magento/module-webapi/Controller/Rest.php(216): Magento\Webapi\Controller\Rest->processApiRequest()\n#4 /home/digidwo/public_html/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(37): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#5 /home/digidwo/public_html/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#6 /home/digidwo/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()\n#7 /home/digidwo/public_html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))\n#8 {main}"}"

@brvoltz you need to patch your code to track the actual error occurring or look in var/log/*.log for a better error message! see @hostep or my recommendations from earlier posts in this thread!

@southerncomputer - as I'm very green to this side.. What would take to have you make the changes, so we can log what is going on? What is interesting is I have no issues with placing a credit card order from the admin side... only the front end...

try this patch and let me know what error it throws afterwards!
https://github.com/southerncomputer/magento2/commit/79e8317e8e87b998d15f4b54fbeefce0901e4dc0

@brvoltz if you apply the patch that @southerncomputer posted then you will get a more specific error which you will be able to debug. Magento 2 is essentially masking the true cause of the problem in that method.

Many thanks for the help... what is now very interesting, I changed my purchased theme back to the default (Luma) cleared the cache and then processed a credit card, no errors... Then I changed back to the purchased theme and cleared the cache and processed a credit card... NO Errors... Go figure... LOL

Now to figure out how to trim the logs after this....

Hi,

Until now this are the measures that we took and seams to significantly improve the transaction decline rate. After applying all 3 solutions, we didn't receive any reports of other users not being able to checkout using Braintree on our Magento 2.1 store.

Hope this helps:
https://support.weltpixel.com/hc/en-us/articles/115007753688-How-we-solved-Braintree-Magento-2-checkout-issues-with-our-Magento-2-1-store

Regards,
WeltPixel Team

Well this really interesting... the site was working and now it has stopped... and giving the error, but not a thing in the logs.. nothing.. empty... I thought it was because of paypal, but I disabled it, still there, I moved back to the Luma theme, still there... I'm completely lost on this one....

Completely flush your cache (ie redis-cli -p 6379 flushall , redis-cli -p 6380 flushall,php bin/magento cache:clean, service php-fpm restart) then make a new login and try to checkout, you may have an quote with an already used reserved_order_id ! Of course if you applied the patch it would have thrown an exception or so!

Sorry but I would not know how to run the flush...

and it does not matter which payment method I use.. it does for all of them...

Ok... not logged in, and as "Guest" it works...

so can I delete my account and create it again?

You don't know how to flush your cache on the command line? This is Magento Community Edition. We're all here to help each other, but this is not the enterprise edition. You need to learn how to develop in this framework or consult with someone who does. You aren't going to get a simple "click here" solution to this problem. I bet you have a duplicate reserved order ID like the comment above suggests.

@AirmanAJK - I'm very sorry for asking how to Find the root cause / fix something here as the support from the plugins are so busy pointing fingers. I did not know this group was not for CE installations. What is funny is the support for the plugins pointed me here. The same with google search.
Others have so kind to offer suggestions, I take these back to one person and ask him to try or do it... and give me the results. (it has taken no less then 40 different "Consultants" to find someone that is not a charlatan.)

On the flush - I was simply stating fact not asking for you to do it or explain it.

I'm trying to get to the bottom of why this system is having so many problems. and I'm learning the Magento world has a lot of "self proclaimed experts" that simply are after a $ with no Knowledge of the system. The word I would use is "Fleecing". (to your point about consultants)

Southern had it right it was the user ID... Still have no idea how to "clean up" for that user (it is my test ID)....

@AirmanAJK I just run setReserverOrderId() on my quotes on the last step of one-step-checkout since I like the actual OrderId to sync to the OrderId on CC provider. If i waste a few order #'s not a big deal. Customers enjoy having accurate orderId on their CC statements too!

I assume reservedOrderId is invalid rather than trusting it is unused as between the backend users modifying quotes/orders/cloning quotes/re-orders, the reservedOrderId is seriously broken.

@brvoltz: mysql : update quote set reserved_order_id=NULL ;
should clean up that user's problem for now!

Comment try, catch to see error
/vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php/
/vendor/magento/module-checkout/Model/PaymentInformationManagement.php

public function savePaymentInformationAndPlaceOrder(
$cartId,
Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
$this->savePaymentInformation($cartId, $paymentMethod, $billingAddress);
//try {
$orderId = $this->cartManagement->placeOrder($cartId);
/} catch (\Exception $e) {
//var_dump($e);
throw new CouldNotSaveException(
__('An error occurred on the server. Please try to place the order again.'),
$e
);
}
/
return $orderId;
}

I had the same problem as well and I found the reason.

In my case, I only got the problems on my test server, locally no issues at all.

The reason is that I used an other database user on my test server, I changed my env.php but still was running into the error when I tried to make an order.

After logging the database I saw that some queries were trying to use my old user, I created a database dump and saw that some triggers are using the old user.

So be sure that your development, production, staging are using the same db user.

Maybe not all problems described here are related to my issue, but I hope that I can help at least some of you.

so........ disappointed. Magento 2 to me a disaster. I really regret switch to magento 2. two significant issues in payment. we hit both: 1. Paypal Express could not intitialize. 2 This issue. this is directly related to payment. related to revenue!

I confirm. Magento 2 is a disaster, too slow, scheduling is bad, payment problematic. I'm staying at magento 1 waiting to choose another platform. They made (magento team) of a success a nightmare

same for me, i regret too

I am facing the same issue, upgrade to 2.1.8 was also not the solution. Busy with this for 3 weeks. I am now at the point to pull the plug on M2. The one issue after the other, this is no fun at all.

I was also facing the same issue, even upgraded to 2.1.8 That was also not the solution. I began to disable modules. I disabled my debugging tool Commercebug and put it in production mode and transactions started to execute. Then when I un-did this to validate the observation. It still continued to work in production mode and dev mode. I will report back if I have other observations to add. Scratching my head.

I can confirm this happens some times in 2.1.7 - very bad!

" I am now at the point to pull the plug on M2" @Bobstar040 totally understand - same here. One issues is solved the other issue pops up....

Not productive at all!

I spent about 20K on an issue similar to this...I am NOT exaggerating. The bug I was experiencing was the spinning wheel of death at checkout. The bug was finally fixed back several versions ago...

This is not the place to be negative...I know...I also know that Magento staff cares...but your upper management needs to understand real problems. This is the most important problem you have...checkout has to work. Everything else must take a back seat...good managers prioritize.

Our issue is resolved now, checked all plugins which use api and disable or remove them. No proper debug logs or errors where generated by magento on this. Good luck with these issues, i know its very frustrating.

@Bobstar040 for you which module was problem?

@puples for me it was the Belco.io plugin, but it can be any plugin which requires api credentials to get customer data in my opinion.

I just found out that the problem (at least in my case) was related to the guest checkout email address. If there was an order before with a specific address and you use this address to checkout, Magento suggests to log in or leave the customer to optionally continue without login. When the customer does not log in, the error appears.

When using a complete new email address, unknown to Magento, checkout works as guest.

I have the same issue, but the other way around. No third party extensions.

  • Checkout as a guest using the default 'Check/Money Order' payment method, and everything works as normal.
  • Log into my account, then checkout using the same payment method and I get "An error occured on the server."

@veloraven @magento-team can you pls come around with an answer on this bug.
I am not shure how you see this but if the checkout is not 100% perfect running the whole magento2 system can not be used. And by 100% i mean 100% not 99,8!

Can you pls let us know what you plan to do to solve this issue?

Update: Our team @outeredge have found the issue.

In our case, the 'Street Address' was saved in the database as two lines, for example:

Unit 2
The Street

But Magento will only accept a 1 line in the Street Address. After removing the multiple lines, the issue has resolved itself.

This still leaves the question of how we managed to get multiple lines in there in the first place. Perhaps an earlier version of Magento 2 allowed this, and the newer version is not backward compatible?

I would try disabling persistent modules and clear out the quote table to see if it is running cleaner!

I discovered another issue that can cause the same problem while doing sandbox testing. In the Braintree configuration in the Admin Panel, under 'Basic Braintree Settings' it asks for the Merchant ID, and under Advanced Braintree Settings it asks for the Merchant Account ID.

Going through the form quickly I didn't realize they are not the same thing, and entered my Merchant ID in the Merchant Account ID field. This will produce the same error:

cart error

If you make the same mistake I did /var/log/debug.log will NOT show anything useful:

debug

To clarify so someone else doesn't make the same mistake:

  • The merchant ID is a unique identifier for your entire gateway account. This value is required to connect your integration to Braintree, along with the rest of your API keys.
  • The merchant account ID is a unique identifier for a specific merchant account, and is used to specify which merchant account to use when creating a transaction. The merchant account ID can be found in the Braintree Control Panel (Sandbox or Production) by navigating to Settings > Processing > Merchant Accounts.
  • If you only have one merchant account, it is not necessary to specify a merchant account ID.

My issue was happening because my development database dump was setting the DEFINER attribute on the triggers to a user that did not exist on the production database. There is a part of the magento cloud docs at the bottom that may be helpful. You basically need to run mysqldump and tell it to not set that DEFINER user. Once I did this, I was able to checkout again! Here is the code snippet I neededmysqldump -h <database host> --user=<database user name> --password=<password> --single-transaction main | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | gzip > /tmp/database_no-definer.sql.gz

You can read more here: http://devdocs.magento.com/guides/v2.0/cloud/live/stage-prod-migrate.html#troubleshooting-the-database-migration

Also, to the best of my knowledge, I am not using cloud Magento, but this still pertained to me. Hope this helps someone!

The issue has been fixed in MAGETWO-63651, MAGETWO-67290, MAGETWO-63650, MAGETWO-63637 and delivered

If you have any other issues, please, create new issue
Thank you

Was this page helpful?
0 / 5 - 0 ratings