I personally experienced this issue dozen of times with many different projects. Sometimes it was a recurrent issue with every new store created on the same Magento instance, so after having to work with it several times I decided to put it down in here and share the knowledge with you.

Whenever you create a new website with a new store on a Magento instance, you need to specify a different *code* for the website and the store itself, otherwise you could experience some issues during the store generation like the one we are about to discuss.

There are many tables that are created automatically whenever a store is created.

We are going to talk about the sales_sequence_* tables.

Let’s say you created a new store which was assigned with the store_id 87. Magento will trigger automatically the creation of the following database tables:


And those tables are also defined within the following tables

The issue

You are trying to place an order using an online payment method like Payflow Pro (from Paypal), and whenever you place the order, Magento performs a call to the payment-information controller and it returns a 400 Bad Request error. But on the screen you only see the following message: An error occurred on the server. Please try to place the order again.

You can check on the code yourself to see the actual exception message and you might see this:

“Rolled back transaction has not been completed correctly”

The solution (MANUAL)

So if you created a website and a store using the same code, you might probably generate an issue within Magento and those sequence_*_87 tables might not be properly created, so you’ll need to do it manually.

Execute the following MySQL query to check what is the sequence_meta registry related to your store:

Grab the meta_id value, let’s say it’s 335, and use it to get the sequence profiles

The expected result should be at least 4 registries corresponding to the following entities: order, invoice, shipment and creditmemo.

But if you are missing some of them, you should create them manually.

Let’s assume you only have a profile for order. Then you need to create the tables for the three missing profiles:

Notice that the suffix for each sequence table is the store id.

Now you need to create those tables:

Flush your Magento cache and that should do it for you.

The solution (AUTO)

Add the following PHP script to your project root directory and change the variable $storeCode for the store you want to fix.

Execute your script from the command line tool by php -f your-script.php and that’ll do the trick.