Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paypal Order total mismatch - Price rounding issue #24233

Open
Priya-V-Panchal opened this issue Aug 22, 2019 · 36 comments
Open

Paypal Order total mismatch - Price rounding issue #24233

Priya-V-Panchal opened this issue Aug 22, 2019 · 36 comments
Labels
Area: Payments Component: Paypal Component: Tax Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: ready for dev Reported on 2.3.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@Priya-V-Panchal
Copy link

Priya-V-Panchal commented Aug 22, 2019

Preconditions (*)

  1. Magento 2.3.1 EE
  2. Paypal Express checkout enabled
  3. Tax Enabled

Steps to reproduce (*)

  1. Admin - Stores - Settings - Configuration - General - Currency Setup - Set the currency options to Japanese Yen and Save
  2. Add a new product with price 11.5120
  3. Add to cart that product from the front
  4. Go to checkout and fill up address details including Country, State and Postal code So that tax would be applied (In my case, tax amount is 1.0935 and shipping amount is 7.95)
  5. Place order with PayPal express checkout

Expected result (*)

  1. The order should be placed

Actual result (*)

  1. Below Error message is getting displayed on UI with 400 Status Code:

image
image

Note: User is able to place Order using "Check/Money Order" but difference in Grand Total is observed in Checkout page and Order Information page
image

image

@m2-assistant
Copy link

m2-assistant bot commented Aug 22, 2019

Hi @Priya-V-Panchal. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@Priya-V-Panchal do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Aug 22, 2019
@engcom-Charlie engcom-Charlie self-assigned this Aug 22, 2019
@m2-assistant
Copy link

m2-assistant bot commented Aug 22, 2019

Hi @engcom-Charlie. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Charlie engcom-Charlie added Component: Paypal Component: Tax Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Aug 23, 2019
@engcom-Charlie
Copy link
Contributor

engcom-Charlie commented Aug 23, 2019

Hello @Priya-V-Panchal
I can't reproduce this issue on fresh Magento 2.3-develop & 2.3.2.

Manual testing scenario:

  1. Add a new product with price 11.5120
  2. Add to cart that product from the front
  3. Go to checkout and fill up address details including Country, State and Postal code So that tax would be applied (In my case, tax amount is 0.95 and shipping amount is 5.00)
    image <-- There is good calculation
  4. Place order with PayPal express checkout

Actualt result:
Order placed.

So i have to close it. If you can reproduce this issue on 2.3-develop branch please
inform me.
Thanks for you report!

@Priya-V-Panchal
Copy link
Author

Hi @engcom-Charlie ,

Thanks for looking into it. As per my comment, to reproduce this issue can you please check with the exact amount which I specified in the question?

You will replicate the issue.

This issue is related to price rounding and it gives minor difference in total like 0.01 so it would only occur with summation of some specified float price.

@ghost ghost unassigned engcom-Charlie Aug 23, 2019
@engcom-Charlie
Copy link
Contributor

engcom-Charlie commented Aug 23, 2019

@Priya-V-Panchal can you provide your Tax rate percent?
Mine:
image

@Priya-V-Panchal
Copy link
Author

Priya-V-Panchal commented Aug 23, 2019

HI @engcom-Charlie ,

My rate percent is 9.5000 &
Tax Amount is 1.0935

@engcom-Charlie
Copy link
Contributor

@Priya-V-Panchal
Good calculation again:
image

@Priya-V-Panchal
Copy link
Author

@engcom-Charlie ,
Could you please give me your quote item details from quote_item table?

@engcom-Charlie
Copy link
Contributor

@Priya-V-Panchal ofc:
image

@Priya-V-Panchal
Copy link
Author

Hi @engcom-Charlie

Please check my quote item detail. In my case, Tax amount and row total both are slightly different which causes the issue.

Screenshot from 2019-08-26 14-26-05

@engcom-Charlie
Copy link
Contributor

engcom-Charlie commented Aug 27, 2019

@Priya-V-Panchal Row total both and tax amount are different because when we create a product in Magento 2.3-develop, the price is validated by js-validator to 11.51:
image

@engcom-Charlie engcom-Charlie self-assigned this Aug 27, 2019
@Priya-V-Panchal
Copy link
Author

In my case, it is taking value up to 4 decimals trailing without zero. Like row total 11.5120 and tax is 1.0935
I am using Magento Enterprice version, does it make any difference in getting this type of float value?

@engcom-Charlie
Copy link
Contributor

@Priya-V-Panchal okay, i will try on EE version.

@Priya-V-Panchal
Copy link
Author

Thanks @engcom-Charlie
Let me know about your findings

@sdzhepa sdzhepa self-assigned this Aug 27, 2019
@m2-assistant
Copy link

m2-assistant bot commented Aug 27, 2019

Hi @sdzhepa. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@sdzhepa
Copy link
Contributor

sdzhepa commented Aug 27, 2019

Hello @Priya-V-Panchal

Thank you for reporting and collaboration!

Unfortunately, we are not able to reproduce this issue by provided steps either on Open Sorce(CE) or Commerce(EE) versions of Magento.

I am closing this issue, but I would strongly recommend report this problem to the Support portal associated with your Commerce account.

Current repository and issue tracker aimed at Magento Open Source version only and the main focus is community contribution/collaboration. It described in Issue reporting guidelines and it is a part of the issue report template:

Verify, that the issue you are about to report does not relate to the Magento Commerce. GitHub is intended for Magento Open Source users to report on issues related to Open Source only. There are no account management services associated with GitHub. You can report Commerce-related issues in one of two ways:

  • You can use the Support portal associated with your account
  • If you are a Partner reporting on behalf of a merchant, use the Partner portal.

@sdzhepa sdzhepa closed this as completed Aug 27, 2019
@ArchanaMohan1
Copy link

@engcom-Charlie - We are facing the above issue as well.Below are the details.Do look into this.

Preconditions

Magento 2.3.1 CE
Paypal Express checkout enabled
Tax Enabled

Steps to reproduce

Add a fews products to the cart from the frontend.
Go to checkout and fill up address details including Country, State and Postal code So that tax would be applied.
Place order with PayPal express checkout

Expected result
The order should be placed

Actual result
It gives "The totals of the cart item amounts do not match order amounts." error.
PayPal is considering rounded price value of Subtotal and tax in its API. As you understand, this does not match the Magento rounding method.

Please look into this.

@charleskj
Copy link

The issue still there in 2.3.1 version

'SHIPPINGAMT' => '8.33',
 'ITEMAMT' => '44.17',
 'TAXAMT' => '12.49',
'AMT' => '65.00',

SHIPPINGAMT + ITEMAMT + TAXAMT = AMT
8.33 + 44.17 + 12.49 = 65
64.99 = 65.00

Paypal Debug Log

[2019-11-19 10:31:02] main.DEBUG: array (
  'url' => 'https://api-3t.paypal.com/nvp',
  'DoExpressCheckoutPayment' => 
  array (
    'TOKEN' => '*********',
    'PAYERID' => '**************',
    'PAYMENTACTION' => 'Sale',
    'AMT' => '65.00',
    'CURRENCYCODE' => 'EUR',
    'BUTTONSOURCE' => 'Magento_Cart_Community',
    'NOTIFYURL' => 'https://www.flowerbx.com/de/paypal/ipn',
    'RETURNFMFDETAILS' => 1,
    'SHIPPINGAMT' => '8.33',
    'ITEMAMT' => '44.17',
    'TAXAMT' => '12.49',
    'BUSINESS' => 'Frau',
    'EMAIL' => '**************,
    'FIRSTNAME' => '*****',
    'LASTNAME' => '******',
    'MIDDLENAME' => NULL,
    'SALUTATION' => NULL,
    'SUFFIX' => NULL,
    'COUNTRYCODE' => 'DE',
    'STATE' => '***',
    'CITY' => '*******',
    'STREET' => '*******',
    'ZIP' => '******',
    'PHONENUM' => '*******',
    'SHIPTOCOUNTRYCODE' => 'DE',
    'SHIPTOSTATE' => '****',
    'SHIPTOCITY' => '******',
    'SHIPTOSTREET' => '*******',
    'SHIPTOZIP' => '*******',
    'SHIPTOPHONENUM' => '********',
    'SHIPTOSTREET2' => '',
    'STREET2' => '',
    'SHIPTONAME' => '*********',
    'ADDROVERRIDE' => 1,
    'METHOD' => 'DoExpressCheckoutPayment',
    'VERSION' => '72.0',
    'USER' => '****',
    'PWD' => '****',
    'SIGNATURE' => '****',
  ),
  'response' => 
  array (
    'TOKEN' => '********',
    'SUCCESSPAGEREDIRECTREQUESTED' => 'false',
    'TIMESTAMP' => '*******',
    'CORRELATIONID' => '*******',
    'ACK' => 'Failure',
    'VERSION' => '72.0',
    'BUILD' => '******',
    'L_ERRORCODE0' => '10413',
    'L_SHORTMESSAGE0' => 'Transaction refused because of an invalid argument. See additional error messages for details.',
    'L_LONGMESSAGE0' => 'The totals of the cart item amounts do not match order amounts.',
    'L_SEVERITYCODE0' => 'Error',
  ),

@engcom-November engcom-November self-assigned this Aug 19, 2021
@m2-assistant
Copy link

m2-assistant bot commented Aug 19, 2021

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

engcom-November commented Aug 19, 2021

Verified the issue on Magento 2.4-develop branch and the issue is reproducible with Japanese Currency setup.
Steps to reproduce:

  1. Admin - Stores - Settings - Configuration - General - Currency Setup - Set the currency options to Japanese Yen and Save
  2. Stores - Tax zones and Rates - Create Tax rate of 9.5%
  3. Stores - Tax Rules - Add New Tax Rule - Apply tax rate and Save
  4. Create a Simple Product from Admin with Price Ex: 11.5120 (any Decimal value) and Save
  5. Reindex and Clear Cache
  6. Front-end - Login as Customer - Add this product to cart and proceed to Checkout
  7. Make Payment using PayPal Express Checkout
    Issue: Payment is failing with 400 Status code and below error message is getting displayed on UI

24233-1

24233-2

Exception log:
[2021-08-19 11:14:52] main.CRITICAL: PayPal gateway has rejected request. Currency does not support decimal precision (#10004: Transaction refused because of an invalid argument. See additional error messages for details). {"exception":"[object] (Magento\Framework\Exception\LocalizedException(code: 0): PayPal gateway has rejected request. Currency does not support decimal precision (#10004: Transaction refused because of an invalid argument. See additional error messages for details). at /var/www/html/magento2.4/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php:121)"} []

Note: User is able to place Order using "Check/Money Order" but difference in Grand Total is observed in Checkout page and Order Information page
24233-3
24233-4

@engcom-November engcom-November added Reported on 2.3.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Aug 19, 2021
@m2-community-project m2-community-project bot removed the Issue: needs update Additional information is require, waiting for response label Aug 19, 2021
@github-jira-sync-bot
Copy link

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

@engcom-November engcom-November added Area: Payments and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Aug 19, 2021
@engcom-November engcom-November added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Aug 19, 2021
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-687 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Aug 19, 2021

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@ansonliam
Copy link

ansonliam commented Aug 31, 2021

There is another situation that creating the bug where a coupon code is placed.

Preconditions (*)

Magento 2.4.1 CE
Paypal Express checkout enabled
Tax Enabled

Steps to reproduce (*)

  1. Admin - Stores - Settings - Configuration - General - Currency Setup - Set the currency options to Australian and Save
  2. Tax is 10%
  3. Add a new product with price 549
  4. Add a new product with price 119
  5. Add a new product with price 677
  6. Create a shipping item of 49.
  7. Create a Cart Price Rule of 5% for the whole cart.
  8. Add to cart of three items above from the frontend,
  9. Go to checkout and fill up address details including Country, State and Postal code So that tax would be applied (In my case, The cart total before tax is $1326.75. Discount amount is $-67.25. shipping amount is $49 and Tax amount is $120.61)
  10. Place order with PayPal express checkout

Expected result (*)

The order should be placed

Actual result (*)

Below Error message is getting displayed on UI.
The request amount is $1326.75 but the total of Shipping ($44.54), items ($1155.48) and tax ($126.72) is $1326.74 which has 1 cent difference

image

(
  'url' => 'https://api-3t.sandbox.paypal.com/nvp',
  'SetExpressCheckout' => 
  array (
    'PAYMENTACTION' => 'Sale',
    'AMT' => '1326.75',
    'CURRENCYCODE' => 'AUD',
    'RETURNURL' => 'https://example-domain.com.au/paypal/express/return/',
    'CANCELURL' => 'https://example-domain.com.au/paypal/express/cancel/',
    'INVNUM' => '000013320',
    'SOLUTIONTYPE' => 'Sole',
    'GIROPAYCANCELURL' => 'https://example-domain.com.au/paypal/express/cancel/',
    'GIROPAYSUCCESSURL' => 'https://example-domain.com.au/checkout/onepage/success/',
    'BANKTXNPENDINGURL' => 'https://example-domain.com.au/checkout/onepage/success/',
    'SHIPPINGAMT' => '44.54',
    'ITEMAMT' => '1155.48',
    'TAXAMT' => '126.72',
    'BUSINESS' => NULL,
    'NOTETEXT' => NULL,
    'EMAIL' => 'xxx@xxx.com',
    'FIRSTNAME' => 'xxx',
    'LASTNAME' => 'xxx',
    'MIDDLENAME' => NULL,
    'SALUTATION' => NULL,
    'SUFFIX' => NULL,
    'COUNTRYCODE' => 'AU',
    'STATE' => 'VIC',
    'CITY' => '123',
    'STREET' => '123',
    'ZIP' => '3000',
    'PHONENUM' => '0123123123',
    'SHIPTOCOUNTRYCODE' => 'AU',
    'SHIPTOSTATE' => 'VIC',
    'SHIPTOCITY' => '123',
    'SHIPTOSTREET' => '123',
    'SHIPTOZIP' => '3000',
    'SHIPTOPHONENUM' => '0123123123',
    'SHIPTOSTREET2' => '',
    'STREET2' => '',
    'SHIPTONAME' => 'xxxx',
    'ADDROVERRIDE' => 1,
    'METHOD' => 'SetExpressCheckout',
    'VERSION' => '72.0',
    'USER' => '****',
    'PWD' => '****',
    'SIGNATURE' => '****',
    'BUTTONSOURCE' => 'Magento_2_Community',
  )

@ansonliam
Copy link

same issue of #33651

@github-jira-sync-bot github-jira-sync-bot added the Priority: P3 May be fixed according to the position in the backlog. label Aug 31, 2021
@engcom-Hotel engcom-Hotel moved this to Ready for Development in Low Priority Backlog Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Payments Component: Paypal Component: Tax Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: ready for dev Reported on 2.3.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Status: Ready for Development
Development

No branches or pull requests