paypal / PayPal-NET-SDK

.NET SDK for PayPal's RESTful APIs
https://developer.paypal.com
Other
536 stars 462 forks source link

UNPROCESSABLE_ENTITY- Error #441

Open gautia opened 4 years ago

gautia commented 4 years ago

Issue description

There is a total mismatch in the total calculations. The discount amount is excluded in the total calculations. Please see the below sandbox request,

Request:

    {
      "amount": {
        "currency_code": "USD",
        "value": "435.39",
        "breakdown": {
          "item_total": {
            "currency_code": "USD",
            "value": "395.81"
          },
          "shipping": {
            "currency_code": "USD",
            "value": "0.0"
          },
          "handling": {
            "currency_code": "USD",
            "value": "0"
          },
          "tax_total": {
            "currency_code": "USD",
            "value": "39.58"
          },
          "shipping_discount": {
            "currency_code": "USD",
            "value": "0"
          },
          "discount": {
            "currency_code": "USD",
            "value": "6.55"
          }
        }
      },

Response:

{
    "debug_id": "b092a0ed849a1",
    "details": [
        {
            "description": "Should equal item_total + tax_total + shipping + handling + insurance - shipping_discount - discount.",
            "field": "/purchase_units/0/amount/value",
            "issue": "AMOUNT_MISMATCH",
            "value": "xxxxxx"
        }
    ],
    "links": [
        {
            "href": "https://developer.paypal.com/docs/api/orders/v2/#error-AMOUNT_MISMATCH",
            "method": "GET",
            "rel": "information_link"
        }
    ],
    "message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
    "name": "UNPROCESSABLE_ENTITY"
}