Magento2: order not being canceled

Created on 19 May 2016  路  10Comments  路  Source: magento/magento2

Steps to reproduce

  1. go to https://www.bariatricadvantage.eu
  2. log-in to the account by using email: [email protected] and pwd: testtest
  3. Add a Product to the cart.
    3.Try checking out using Paypal

    Expected result

  4. You should be able to checkout

    Actual result

  5. Error message appears: "PayPal gateway has rejected request. Payment has already been made for this invoiceID (#10412: Duplicate invoice)".

2016-05-19_16h30_54

  1. Error log:
    {{2016-05-02 13:07:21 main.CRITICAL: exception 'Zend_Db_Statement_Exception' with message 'Report ID: webapi-572751096f303; Message: SQLSTATE23000: Integrity constraint violation: 1062 Duplicate entry 'BAWS-000000039-6' for key 'SALES_ORDER_INCREMENT_ID_STORE_ID', query was: INSERT INTO sales_order (state, status, protect_code, shipping_description, is_virtual, store_id, customer_id, base_discount_amount, base_grand_total, base_shipping_amount, base_shipping_tax_amount, base_subtotal, base_tax_amount, base_to_global_rate, base_to_order_rate, discount_amount, grand_total, shipping_amount, shipping_tax_amount, store_to_base_rate, store_to_order_rate, subtotal, tax_amount, total_qty_ordered, customer_is_guest, customer_note_notify, customer_group_id, quote_id, base_shipping_discount_amount, base_subtotal_incl_tax, base_total_due, shipping_discount_amount, subtotal_incl_tax, total_due, weight, increment_id, applied_rule_ids, base_currency_code, customer_email, customer_firstname, customer_lastname, customer_middlename, discount_description, global_currency_code, order_currency_code, remote_ip, shipping_method, store_currency_code, store_name, total_item_count, discount_tax_compensation_amount, base_discount_tax_compensation_amount, shipping_discount_tax_compensation_amount, base_shipping_discount_tax_compensation_amnt, discount_tax_compensation_invoiced, base_discount_tax_compensation_invoiced, discount_tax_compensation_refunded, base_discount_tax_compensation_refunded, shipping_incl_tax, base_shipping_incl_tax, gift_message_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' in /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/lib/internal/Magento/Framework/Webapi/ErrorProcessor.ph...
    Stack trace:
    #0 /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/lib/internal/Magento/Framework/Webapi/ErrorProcessor.ph...: Magento\Framework\Webapi\ErrorProcessor->_critical(Object(Zend_Db_Statement_Exception))
    #1 /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/app/code/Magento/Webapi/Controller/Rest.php(163): Magento\Framework\Webapi\ErrorProcessor->maskException(Object(Zend_Db_Statement_Exception))
    #2 /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/var/generation/Magento/Webapi/Controller/Rest/Intercept...: Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
    #3 /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/lib/internal/Magento/Framework/App/Http.php(115): Magento\Webapi\Controller\RestInterceptor->dispatch(Object(Magento\Framework\App\Request\Http))
    #4 internal function: Magento\Framework\App\Http->launch()
    #5 /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/lib/internal/Magento/Framework/Interception/Interceptor...: call_user_func_array(Array, Array)
    #6 /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/var/generation/Magento/Framework/App/Http/Interceptor.p...: Magento\Framework\App\HttpInterceptor->___callPlugins('launch', Array, Array)
    #7 /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/lib/internal/Magento/Framework/App/Bootstrap.php(258): Magento\Framework\App\HttpInterceptor->launch()
    #8 /var/www/www.bariatricadvantage.eu/2.0.2-355-g24e5c4a/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\HttpInterceptor))
    #9
    {main}

[] []}}
screen shot 2016-05-02 at 15 24 28

Payment Ready for Work bug report

All 10 comments

Hi @SidneyBilliet

This can be resolved by setting "No, allow multiple payments per invoice ID" option in your PayPal account.

Hi @SidneyBilliet

Is this issue still reproducible after adjusting PayPal account settings?

@alena-marchenko , Hi Alena, the problem was fixed after adjsuting the paypal setting. However we would like to understand why Magento sent the same invoice number several times. Do you have an answer to that question, please?

Hi, @alena-marchenko
I faced the same issue when set the payment action to order. IPN (type = Order Created) from paypal which i assume it's the instruction for order creation but failed. This cause the order ID or invoice ID is captured in Paypal but not created in Magento due to unknown reason. So that invoice ID will continue be used to send request to paypal but rejected.
Maybe changing the setting in paypal can get pass this issue, but i don't think it's desired since it will cause management trouble.

Hi @SidneyBilliet

This issue can occur in case when you use/used your PayPal account on different Magento instances, so there has been already created transaction with such invoice id on PayPal side.

@alena-marchenko Hi, I'm a colleague of @SidneyBilliet and I have to tell that the issue still isn't resolved. This because the problem is not related to PayPal on it's own.

This ticket also describes the problem: #4474

So the steps to reproduce:

  • Place order and try to pay with paypal (or other method)
  • Cancel the payment
  • Try again to pay, this will throw an error.

When you're a guest user you can simply remove your cookies to try again, but when you're logged in with your account the ID is related to your account and the only solution is to remove the quote in the db.

Hi @SidneyBilliet , @stevenvdp, @Nerogee

We've created MAGETWO-54412 internal ticket regarding this issue

Hi @alena-marchenko, do you have any updates on this issue?
Thanks in advance!

Hi @SidneyBilliet

The fix is delivered to develop branch. Closing the issue.

SALES_ORDER_INCREMENT_ID_STORE_ID in db you need to update your order incremented id. that issue is occuring due to the incremented id already used by paypal.

internally incremented id is used in payap order unique id, if it already used in paypal then you will get such issue.

Was this page helpful?
0 / 5 - 0 ratings