Open order doesn't change its state

I faced with strange behavior from Orders API.

I’ve got the OPEN Order without total_money field. The Order has completed payment.

I don’t understand why Order is still OPEN. Is it partially paid? If yes, so what the total amount of Order? If it is fully paid why it is OPEN?

We cannot process such Order because it has unpredictable state. We need to see money flows. It is important to reconciliation process.

Order:
{
“id”: “VnBjH9A2o96D3z2QDDDBbxMF”,
“location_id”: “FES3781XXYA9C”,
“created_at”: “2019-09-25T19:00:38.000Z”,
“updated_at”: “2019-09-25T19:00:38.000Z”,
“state”: “OPEN”,
“tenders”: [
{
“id”: “nAAhj7NMoX4MRHo8b4qAksMF”,
“location_id”: “FES3781XXYA9C”,
“transaction_id”: “VnBjH9A2o96D3z2QDDDBbxMF”,
“created_at”: “2019-09-25T19:00:38Z”,
“amount_money”: {
“amount”: 28250,
“currency”: “CAD”
},
“type”: “CARD”,
“card_details”: {
“status”: “CAPTURED”,
“card”: {
“card_brand”: “VISA”
},
“entry_method”: “KEYED”
},
“tip_money”: {
“amount”: 0,
“currency”: “CAD”
}
}
]
}

Related V2Payment:
{
“payment”: {
“id”: “nAAhj7NMoX4MRHo8b4qAksMF”,
“created_at”: “2019-09-25T19:00:38.803Z”,
“updated_at”: “2019-09-25T19:00:42.027Z”,
“amount_money”: {
“amount”: 28250,
“currency”: “CAD”
},
“status”: “COMPLETED”,
“source_type”: “CARD”,
“card_details”: {
“status”: “CAPTURED”,
“card”: {
“card_brand”: “VISA”,
“card_type”: “CREDIT”,
“prepaid_type”: “NOT_PREPAID”
},
“entry_method”: “KEYED”,
“cvv_status”: “CVV_ACCEPTED”,
“avs_status”: “AVS_NOT_CHECKED”,
},
“location_id”: “FES3781XXYA9C”,
“order_id”: “VnBjH9A2o96D3z2QDDDBbxMF”,
“processing_fee”: [
{
“effective_at”: “2019-09-25T21:00:39.000Z”,
“type”: “INITIAL”,
“amount_money”: {
“amount”: 849,
“currency”: “CAD”
}
}
],
“total_money”: {
“amount”: 28250,
“currency”: “CAD”
},
“employee_id”: “FES3781XXYA9C”,
“receipt_number”: “nAAh”,
“receipt_url”: “https://squareup.com/receipt/preview/nAAhj7NMoX4MRHo8b4qAksMF
}
}

Looking this order up it appears to be a partially paid invoice. Unfortunately there’s not a great way to figure that out via the Orders API. Basically, if there’s no total_money field along with a captured tender, that typically means it’s a partial payment. Invoices won’t show anything about the total_money until they’re completely paid for.

Now i have OPEN Order with total_money field populated.
What should i think about such Orders?

Order:
{
“orders”: [
{
“id”: “3WstHuuYMdAmHHvnfl6uB241mZ9YY”,
“location_id”: “FRH4FB607AQJN”,
“line_items”: [
{
“uid”: “JFf3LPXkzcGkuQPwGSa6qD”,
“quantity”: “1”,
“name”: “Lobster Boil for 2”,
“variation_name”: “Yes, I acknowledge the Lobster Boil is only available on Fri/Sat/Sun, Mild”,
“base_price_money”: {
“amount”: 6500,
“currency”: “USD”
},
“gross_sales_money”: {
“amount”: 6500,
“currency”: “USD”
},
“total_tax_money”: {
“amount”: 504,
“currency”: “USD”
},
“total_discount_money”: {
“amount”: 0,
“currency”: “USD”
},
“total_money”: {
“amount”: 7004,
“currency”: “USD”
},
“variation_total_price_money”: {
“amount”: 6500,
“currency”: “USD”
},
“applied_taxes”: [
{
“uid”: “gF5mnUGmVxMsHzO9XidCzB”,
“tax_uid”: “3459553_tax”,
“applied_money”: {
“amount”: 504,
“currency”: “USD”
}
}
]
},
{
“uid”: “Ys9j3kt70fLCvYwYoGALrB”,
“quantity”: “1”,
“name”: “Half Dozen Premium Oyster”,
“base_price_money”: {
“amount”: 1800,
“currency”: “USD”
},
“gross_sales_money”: {
“amount”: 1800,
“currency”: “USD”
},
“total_tax_money”: {
“amount”: 140,
“currency”: “USD”
},
“total_discount_money”: {
“amount”: 0,
“currency”: “USD”
},
“total_money”: {
“amount”: 1940,
“currency”: “USD”
},
“variation_total_price_money”: {
“amount”: 1800,
“currency”: “USD”
},
“applied_taxes”: [
{
“uid”: “fcfuGukmYMIslKmQqzcKAB”,
“tax_uid”: “3459554_tax”,
“applied_money”: {
“amount”: 140,
“currency”: “USD”
}
}
]
}
],
“taxes”: [
{
“uid”: “3459553_tax”,
“name”: “Sales Tax”,
“percentage”: “7.7500”,
“type”: “ADDITIVE”,
“applied_money”: {
“amount”: 504,
“currency”: “USD”
},
“scope”: “LINE_ITEM”
},
{
“uid”: “3459554_tax”,
“name”: “Sales Tax”,
“percentage”: “7.7500”,
“type”: “ADDITIVE”,
“applied_money”: {
“amount”: 140,
“currency”: “USD”
},
“scope”: “LINE_ITEM”
},
{
“uid”: “bentobox_service_fee”,
“name”: “Sales Tax”,
“percentage”: “7.7500”,
“type”: “ADDITIVE”,
“applied_money”: {
“amount”: 8,
“currency”: “USD”
},
“scope”: “LINE_ITEM”
}
],
“created_at”: “2020-06-29T02:13:16.380Z”,
“updated_at”: “2020-06-29T02:13:16.380Z”,
“state”: “OPEN”,
“version”: 1,
“reference_id”: “12094449”,
“total_tax_money”: {
“amount”: 652,
“currency”: “USD”
},
“total_discount_money”: {
“amount”: 0,
“currency”: “USD”
},
“total_tip_money”: {
“amount”: 0,
“currency”: “USD”
},
“total_money”: {
“amount”: 9051,
“currency”: “USD”
},
“service_charges”: [
{
“uid”: “DpEsELhggKhlLRC7ZMWMtD”,
“name”: “BentoBox Service Fee”,
“amount_money”: {
“amount”: 99,
“currency”: “USD”
},
“applied_money”: {
“amount”: 99,
“currency”: “USD”
},
“calculation_phase”: “SUBTOTAL_PHASE”,
“taxable”: true,
“total_money”: {
“amount”: 107,
“currency”: “USD”
},
“total_tax_money”: {
“amount”: 8,
“currency”: “USD”
},
“applied_taxes”: [
{
“uid”: “Jqi4UBWngmB6XPEoEycx6”,
“tax_uid”: “bentobox_service_fee”,
“applied_money”: {
“amount”: 8,
“currency”: “USD”
}
}
]
}
],
“total_service_charge_money”: {
“amount”: 99,
“currency”: “USD”
},
“net_amounts”: {
“total_money”: {
“amount”: 9051,
“currency”: “USD”
},
“tax_money”: {
“amount”: 652,
“currency”: “USD”
},
“discount_money”: {
“amount”: 0,
“currency”: “USD”
},
“tip_money”: {
“amount”: 0,
“currency”: “USD”
},
“service_charge_money”: {
“amount”: 99,
“currency”: “USD”
}
},
“source”: {
“name”: “BentoBox”
}
}
]
}

That’s just a regular, unpaid order (since there’s no tenders). As soon as you create an order via the Order API, it will be OPEN and have a total_money (so you know how much the order is).

Ok, Now i have interesting order again :slight_smile:

It has total_money, tenders, line_items. Seems like it prepared to be finalized with PAID, but the state still OPEN
What about it?

{
  "orders": [
    {
      "id": "YpcQHlhwHrW98LKgxSpvTGHez3TZY",
      "location_id": "6MSV4HGMN9W10",
      "line_items": [
        {
          "uid": "6blhosTrEbG5V9PS1OsLB",
          "quantity": "2",
          "name": "8 Frame Screened Inner Cover",
          "base_price_money": {
            "amount": 1390,
            "currency": "USD"
          },
          "gross_sales_money": {
            "amount": 2780,
            "currency": "USD"
          },
          "total_tax_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_discount_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_money": {
            "amount": 2780,
            "currency": "USD"
          },
          "variation_total_price_money": {
            "amount": 2780,
            "currency": "USD"
          }
        },
        {
          "uid": "UC4NDK0tfTLuT1FfeXoXEC",
          "quantity": "1",
          "name": "Shipping, Handling Fee",
          "variation_name": "UPS Ground",
          "base_price_money": {
            "amount": 1718,
            "currency": "USD"
          },
          "gross_sales_money": {
            "amount": 1718,
            "currency": "USD"
          },
          "total_tax_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_discount_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_money": {
            "amount": 1718,
            "currency": "USD"
          },
          "variation_total_price_money": {
            "amount": 1718,
            "currency": "USD"
          }
        }
      ],
      "fulfillments": [],
      "created_at": "2020-07-15T13:36:01.733Z",
      "updated_at": "2020-07-15T13:36:02.794Z",
      "state": "OPEN",
      "version": 4,
      "reference_id": "142696848",
      "total_tax_money": {
        "amount": 0,
        "currency": "USD"
      },
      "total_discount_money": {
        "amount": 0,
        "currency": "USD"
      },
      "total_tip_money": {
        "amount": 0,
        "currency": "USD"
      },
      "total_money": {
        "amount": 4498,
        "currency": "USD"
      },
      "tenders": [
        {
          "id": "FughaKkEzO3jL7jEiqywviAmnIDZY",
          "location_id": "6MSV4HGMN9W10",
          "transaction_id": "YpcQHlhwHrW98LKgxSpvTGHez3TZY",
          "created_at": "2020-07-15T13:36:02Z",
          "note": "Online Order #142696848",
          "amount_money": {
            "amount": 4498,
            "currency": "USD"
          },
          "type": "CARD",
          "card_details": {
            "status": "CAPTURED",
            "card": {
              "card_brand": "MASTERCARD",
              "last_4": "2183",
              "fingerprint": "sq-1-SvIIsu3n61JuXoSYQV5T6vU0SFrZE1uJjVsUgnlWeGGUep3Ae254yaNMclXhfE-tTA"
            },
            "entry_method": "KEYED"
          },
          "payment_id": "FughaKkEzO3jL7jEiqywviAmnIDZY"
        }
      ],
      "total_service_charge_money": {
        "amount": 0,
        "currency": "USD"
      },
      "net_amounts": {
        "total_money": {
          "amount": 4498,
          "currency": "USD"
        },
        "tax_money": {
          "amount": 0,
          "currency": "USD"
        },
        "discount_money": {
          "amount": 0,
          "currency": "USD"
        },
        "tip_money": {
          "amount": 0,
          "currency": "USD"
        },
        "service_charge_money": {
          "amount": 0,
          "currency": "USD"
        }
      },
      "source": {
        "name": "Ecwid"
      }
    }
  ]
}

So this looks like an order that was handled solely through the API rather than a first-party product (like Dashboard/Invoices/POS). When creating an order via the API (CreateOrder) and paying for the order (CreatePayment), if you’re not going to mark it as complete via the Dashboard/POS, then you need to manually call UpdateOrder to mark it as COMPLETED. Otherwise, it will remain open forever.

In the case where you push to Dashboard/POS, when you interact with the order on either of these, it will update its state; however the order above looks like it never was interacted with on another product.