PayPal Checkout Problem when adding Taxcategorie

thumbnail
Jamie Sammons, modified 6 Years ago. New Member Posts: 17 Join Date: 3/11/08 Recent Posts
PayPal checkout works fine when the product has no taxcategorie, but the following error appears when I add a taxcategorie to a product:

2019-04-09 15:02:37.172 ERROR [ajp-nio-8009-exec-15][HttpConnection:153] Response code: 400     Error response: {"name":"VALIDATION_ERROR","details":[{"field":"transactions[0].amount","issue":"Transaction amount details (subtotal, tax, shipping) must add up to specified amount total"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"xxxxxxxxx"}
2019-04-09 15:02:37.177 WARN  [ajp-nio-8009-exec-15][PortalImpl:6899] response-code: 400        details: name: VALIDATION_ERROR message: Invalid request - see details  details: [{_  "field": "transactions[0].amount",_  "issue": "Transaction amount details (subtotal, tax, shipping) must add up to specified amount total"_}]     debug-id: xxxxxxxxxx information-link: https://developer.paypal.com/docs/api/payments/#errors [Sanitized]
response-code: 400      details: name: VALIDATION_ERROR message: Invalid request - see details  details: [{_  "field": "transactions[0].amount",_  "issue": "Transaction amount details (subtotal, tax, shipping) must add up to specified amount total"_}]     debug-id: c3d4f7d8eef88 information-link: https://developer.paypal.com/docs/api/payments/#errors [Sanitized]
        at com.paypal.base.rest.PayPalRESTException.createFromHttpErrorException(PayPalRESTException.java:72)
        at com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:431)
        at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:295)
        at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:228)
        at com.paypal.api.payments.Payment.create(Payment.java:149)
        at 

I have testet it with the latest Liferay Commerce Bundle Liferay Portal CE 7.1 GA3 and Liferay Commerce 1.1.3 (Bundled with Tomcat)
Do I have a mistake in my configuration or is this a known bug.

Any help is appreciate.

Kind regards

​​​​​​​Dieter
thumbnail
Dieter Metzler, modified 6 Years ago. New Member Posts: 17 Join Date: 3/11/08 Recent Posts
Today I have downloaded and installed the new Liferay Commerce Version 1.1.4 (Liferay Portal CE 7.1 GA3 and Liferay Commerce 1.1.4 (Bundled with Tomcat)) and hoped the Bug was resolved, but sadly still the same error in the new Version.

Do someone knows a useful workaround to use Liferay Commerce with Paypal and taxes?

Thanks in advance for guidance.
thumbnail
Corbin Murakami, modified 6 Years ago. Junior Member Posts: 31 Join Date: 12/5/14 Recent Posts
Hi Dieter, thanks for reporting. We're looking into it: https://issues.liferay.com/browse/EMP-26
thumbnail
Sipin Verma, modified 6 Years ago. Junior Member Posts: 29 Join Date: 12/14/10 Recent Posts
I have a downloaded source code of liferay commerce in which I see below method code in
commerce-payment-method-paypal/src/main/java/com/liferay/commerce/payment/method/paypal/internal/PayPalCommercePaymentMethod.java

private Amount _getAmount(
        CommerceOrder commerceOrder, CommerceCurrency commerceCurrency) {

        Amount amount = new Amount();

        amount.setCurrency(StringUtil.toUpperCase(commerceCurrency.getCode()));

        Details details = new Details();

        details.setShipping(
            _payPalDecimalFormat.format(commerceOrder.getShippingAmount()));
        details.setSubtotal(
            _payPalDecimalFormat.format(commerceOrder.getSubtotal()));

        amount.setDetails(details);

        amount.setTotal(_payPalDecimalFormat.format(commerceOrder.getTotal()));

        return amount;
    }

Here we can see that only shipping info and subtotal is set in the Details object which is being set in the Transaction object (_getTransactions method). Hence the code to set the Tax amount is not written.

I checked the latest code on GitHub & found that the code has been updated in _getAmount method but Tax is still not taken care:

https://github.com/liferay/com-liferay-commerce/blob/7.1.x/commerce-payment-method-paypal/src/main/java/com/liferay/commerce/payment/method/paypal/internal/PayPalCommercePaymentMethod.java

private Amount _getAmount(CommerceOrder commerceOrder)
        throws PortalException {

        Amount amount = new Amount();

        CommerceCurrency commerceCurrency = commerceOrder.getCommerceCurrency();

        amount.setCurrency(StringUtil.toUpperCase(commerceCurrency.getCode()));

        amount.setTotal(_payPalDecimalFormat.format(commerceOrder.getTotal()));

        return amount;
    }

This is a big issue. Incomplete code is released. For me none of the PayPal transactions are successful.
thumbnail
Sipin Verma, modified 6 Years ago. Junior Member Posts: 29 Join Date: 12/14/10 Recent Posts
For me the PayPal transaction is not successful even if no Tax is configured for the products.
Still it gives me the same error that you reported.
thumbnail
Corbin Murakami, modified 6 Years ago. Junior Member Posts: 31 Join Date: 12/5/14 Recent Posts
I've updated the ticket with the additional information. Feel free to add yourself as a watcher to see progress.
thumbnail
Amos Fong, modified 6 Years ago. Junior Member Posts: 29 Join Date: 12/14/10 Recent Posts
Dieter MetzlerPayPal checkout works fine when the product has no taxcategorie, but the following error appears when I add a taxcategorie to a product:

2019-04-09 15:02:37.172 ERROR [ajp-nio-8009-exec-15][HttpConnection:153] Response code: 400     Error response: {"name":"VALIDATION_ERROR","details":[{"field":"transactions[0].amount","issue":"Transaction amount details (subtotal, tax, shipping) must add up to specified amount total"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"xxxxxxxxx"}
2019-04-09 15:02:37.177 WARN  [ajp-nio-8009-exec-15][PortalImpl:6899] response-code: 400        details: name: VALIDATION_ERROR message: Invalid request - see details  details: [{_  "field": "transactions[0].amount",_  "issue": "Transaction amount details (subtotal, tax, shipping) must add up to specified amount total"_}]     debug-id: xxxxxxxxxx information-link: https://developer.paypal.com/docs/api/payments/#errors [Sanitized]
response-code: 400      details: name: VALIDATION_ERROR message: Invalid request - see details  details: [{_  "field": "transactions[0].amount",_  "issue": "Transaction amount details (subtotal, tax, shipping) must add up to specified amount total"_}]     debug-id: c3d4f7d8eef88 information-link: https://developer.paypal.com/docs/api/payments/#errors [Sanitized]
        at com.paypal.base.rest.PayPalRESTException.createFromHttpErrorException(PayPalRESTException.java:72)
        at com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:431)
        at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:295)
        at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:228)
        at com.paypal.api.payments.Payment.create(Payment.java:149)
        at 

I have testet it with the latest Liferay Commerce Bundle Liferay Portal CE 7.1 GA3 and Liferay Commerce 1.1.3 (Bundled with Tomcat)
Do I have a mistake in my configuration or is this a known bug.

Any help is appreciate.

Kind regards

​​​​​​​Dieter
Dieter,
For me the PayPal transaction is not successful even if no Tax is configured for the products.
Still it gives me the same error that you reported.

Can you brief me about your Tax configurations?
​​​​​​​Thanks in Advance