x

The payment total does not match the order total. It does.

First off, I created an order and doing an order search, the string below shows the order details from the response.

 

Next, I used the API Explorers for Payments->CreatePayment:

 

I put in my sandbox Access Token at the top.

Here's my Request String:

curl https://connect.squareup.com/v2/payments \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Square-Version: 2020-01-22' \
  -H 'Authorization: Bearer <My_Token>' \
  -d '{
    "source_id": "cnon:CBASEBbXLsTfPIy04J18kMjfbRo",
    "idempotency_key": "5e42534d06257",
    "location_id": "DWK1VQ391ZARF",
    "order_id": "fQZM8ekWkcAo7fRRBvUj2G2pY5EZY",
    "amount_money": {
      "amount": 3649,
      "currency": "USD"
    }
  }'

Here is the Order Details:

{
      "id": "fQZM8ekWkcAo7fRRBvUj2G2pY5EZY",
      "location_id": "DWK1VQ391ZARF",
      "line_items": [
        {
          "uid": "iLVwmNInonSV2Twc9G84fD",
          "catalog_object_id": "B57CGCIAGUTLBQMAMEEI5WBC",
          "quantity": "1",
          "name": "Athletic Heather Pullover Hooded Sweatshirt",
          "variation_name": "X-Large",
          "base_price_money": {
            "amount": 2699,
            "currency": "USD"
          },
          "taxes": [
            {
              "uid": "f9euLpXOOEWKd2bV7AgOdD",
              "name": "Sales Tax",
              "percentage": "9.0",
              "type": "ADDITIVE",
              "applied_money": {
                "amount": 243,
                "currency": "USD"
              },
              "scope": "LINE_ITEM"
            }
          ],
          "gross_sales_money": {
            "amount": 2699,
            "currency": "USD"
          },
          "total_tax_money": {
            "amount": 243,
            "currency": "USD"
          },
          "total_discount_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_money": {
            "amount": 2942,
            "currency": "USD"
          },
          "variation_total_price_money": {
            "amount": 2699,
            "currency": "USD"
          },
          "applied_taxes": [
            {
              "uid": "f9euLpXOOEWKd2bV7AgOdD",
              "tax_uid": "f9euLpXOOEWKd2bV7AgOdD",
              "applied_money": {
                "amount": 243,
                "currency": "USD"
              }
            }
          ]
        },
        {
          "uid": "dQS0tXEW46ERhQlLdPAxgC",
          "catalog_object_id": "PY7V64HVFKSE6O7SW6RBQZ7U",
          "quantity": "1",
          "name": "2nd Amendment",
          "variation_name": "Small Print",
          "base_price_money": {
            "amount": 300,
            "currency": "USD"
          },
          "taxes": [
            {
              "uid": "RAD93NhnUa9E6XBy7NYWG",
              "name": "Sales Tax",
              "percentage": "9.0",
              "type": "ADDITIVE",
              "applied_money": {
                "amount": 27,
                "currency": "USD"
              },
              "scope": "LINE_ITEM"
            }
          ],
          "gross_sales_money": {
            "amount": 300,
            "currency": "USD"
          },
          "total_tax_money": {
            "amount": 27,
            "currency": "USD"
          },
          "total_discount_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_money": {
            "amount": 327,
            "currency": "USD"
          },
          "variation_total_price_money": {
            "amount": 300,
            "currency": "USD"
          },
          "applied_taxes": [
            {
              "uid": "RAD93NhnUa9E6XBy7NYWG",
              "tax_uid": "RAD93NhnUa9E6XBy7NYWG",
              "applied_money": {
                "amount": 27,
                "currency": "USD"
              }
            }
          ]
        },
        {
          "uid": "w3HK68X6MEpXHIxQDyTZ5",
          "quantity": "1",
          "name": "Shipping",
          "base_price_money": {
            "amount": 380,
            "currency": "USD"
          },
          "gross_sales_money": {
            "amount": 380,
            "currency": "USD"
          },
          "total_tax_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_discount_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_money": {
            "amount": 380,
            "currency": "USD"
          },
          "variation_total_price_money": {
            "amount": 380,
            "currency": "USD"
          }
        }
      ],
      "taxes": [
        {
          "uid": "IFLJKtYmIiEvXTLZ5FLaJD",
          "name": "Sales Tax",
          "percentage": "9.0",
          "type": "ADDITIVE",
          "applied_money": {
            "amount": 0,
            "currency": "USD"
          },
          "scope": "LINE_ITEM"
        },
        {
          "uid": "RAD93NhnUa9E6XBy7NYWG",
          "name": "Sales Tax",
          "percentage": "9.0",
          "type": "ADDITIVE",
          "applied_money": {
            "amount": 27,
            "currency": "USD"
          },
          "scope": "LINE_ITEM"
        },
        {
          "uid": "f9euLpXOOEWKd2bV7AgOdD",
          "name": "Sales Tax",
          "percentage": "9.0",
          "type": "ADDITIVE",
          "applied_money": {
            "amount": 243,
            "currency": "USD"
          },
          "scope": "LINE_ITEM"
        }
      ],
      "created_at": "2020-02-11T07:46:54.962Z",
      "updated_at": "2020-02-11T07:46:54.962Z",
      "state": "OPEN",
      "version": 1,
      "total_tax_money": {
        "amount": 270,
        "currency": "USD"
      },
      "total_discount_money": {
        "amount": 0,
        "currency": "USD"
      },
      "total_tip_money": {
        "amount": 0,
        "currency": "USD"
      },
      "total_money": {
        "amount": 3649,
        "currency": "USD"
      },
      "total_service_charge_money": {
        "amount": 0,
        "currency": "USD"
      },
      "net_amounts": {
        "total_money": {
          "amount": 3649,
          "currency": "USD"
        },
        "tax_money": {
          "amount": 270,
          "currency": "USD"
        },
        "discount_money": {
          "amount": 0,
          "currency": "USD"
        },
        "tip_money": {
          "amount": 0,
          "currency": "USD"
        },
        "service_charge_money": {
          "amount": 0,
          "currency": "USD"
        }
      }

Please note the order_id and location_id both match what's in the order details. What also matches is the amount entered in the create payment request and the total_money in the order details: 3649.

 

So then why do I get the following response for the Create Payment request?

cache-control: no-cache
content-length: 136
content-type: application/json
date: Tue, 11 Feb 2020 07:48:48 GMT
square-version: 2020-01-22


{ "errors": [ { "code": "BAD_REQUEST", "detail": "The payment total does not match the order total.", "category": "INVALID_REQUEST_ERROR" } ] }

Using Square API v2.

1,360 Views
Message 1 of 3
Report
2 REPLIES 2

FYI. It was a fake access code being shown above, but I changed it to <My_Token> anyways.

1,325 Views
Message 2 of 3
Report
Alumni

Hey @13chris - looks you asked this question in Stack Overflow which a member of our API Team chatted with you about your issue.

 

Since you guys started a convo there, please reference that thread for further assistance.

 

Justin
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
1,301 Views
Message 3 of 3
Report