Sandbox order created via API not visible in sandbox dashboard

I am using the Orders API to create an order (with a SHIPMENT fulfillment), then the Payments API to create a payment (autocomplete=false) associated with that newly created order. Some time later, I am then using the Payments API to complete payment, and then use the Orders API to update the shipping note and update the SHIPMENT fulfillment state to COMPLETED.

I would expect the order to be visible in the Sandbox seller dashboard (using ‘all orders’ filter), however it is not listed. Interestingly I have notifications (bell icon) that there are new orders, but they are not listed on the orders page.

I have seen the topic Created Order in Sandbox, however I am sure that I have both a fulfillment and that the payment has been completed.

Here is the order data:

{
  "id": "P5iQsvTnEgO2jYd4whIVikkWHjRZY",
  "location_id": "TVBH5MQC1VVYY",
  "line_items": [
    {
      "uid": "total",
      "quantity": "1",
      "name": "Order Total",
      "base_price_money": {
        "amount": 3999,
        "currency": "USD"
      },
      "gross_sales_money": {
        "amount": 3999,
        "currency": "USD"
      },
      "total_tax_money": {
        "amount": 0,
        "currency": "USD"
      },
      "total_discount_money": {
        "amount": 0,
        "currency": "USD"
      },
      "total_money": {
        "amount": 3999,
        "currency": "USD"
      },
      "variation_total_price_money": {
        "amount": 3999,
        "currency": "USD"
      }
    }
  ],
  "fulfillments": [
    {
      "uid": "shipment-fulfillment",
      "type": "SHIPMENT",
      "state": "COMPLETED",
      "shipment_details": {
        "recipient": {
          "customer_id": "1NMBQMBMTGTKSCXPNHGX2J8QR8",
          "display_name": "[email protected]",
          "email_address": "[email protected]"
        },
        "shipping_note": "Order orderUSD01, Invoice InvUSD01",
        "placed_at": "2021-01-04T17:17:37.973Z",
        "packaged_at": "2021-01-04T17:17:53.261Z",
        "shipped_at": "2021-01-04T17:17:53.261Z",
        "in_progress_at": "2021-01-04T17:17:53.261Z"
      }
    }
  ],
  "metadata": {
    "Order": "orderUSD01",
    "Invoice": "InvUSD01"
  },
  "created_at": "2021-01-04T16:48:54.396Z",
  "updated_at": "2021-01-04T17:17:53.262Z",
  "state": "OPEN",
  "version": 6,
  "reference_id": "44e48f1c-5b0d-462d-b5c1-9bf780fee4ab",
  "total_tax_money": {
    "amount": 0,
    "currency": "USD"
  },
  "total_discount_money": {
    "amount": 0,
    "currency": "USD"
  },
  "total_tip_money": {
    "amount": 0,
    "currency": "USD"
  },
  "total_money": {
    "amount": 3999,
    "currency": "USD"
  },
  "tenders": [
    {
      "id": "bhSuDtyypbLOPiGEiOdyBVorUXWZY",
      "location_id": "TVBH5MQC1VVYY",
      "transaction_id": "P5iQsvTnEgO2jYd4whIVikkWHjRZY",
      "created_at": "2021-01-04T16:48:54Z",
      "amount_money": {
        "amount": 3999,
        "currency": "USD"
      },
      "type": "CARD",
      "card_details": {
        "status": "CAPTURED",
        "card": {
          "card_brand": "VISA",
          "last_4": "1111",
          "fingerprint": "sq-1-GS92d4pOeYFco5QzXONkUmR3V-7SPORIkmRIBDr0g1oCgaa6MOcQn446j9eB-kNK8g"
        },
        "entry_method": "ON_FILE"
      },
      "payment_id": "bhSuDtyypbLOPiGEiOdyBVorUXWZY"
    }
  ],
  "total_service_charge_money": {
    "amount": 0,
    "currency": "USD"
  },
  "net_amounts": {
    "total_money": {
      "amount": 3999,
      "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": "Sandbox for sq0idp-VxTfvNjI-9UhHj7qoHsZDQ"
  },
  "customer_id": "1NMBQMBMTGTKSCXPNHGX2J8QR8"
},

Interestingly, further testing/iterations have shown that if I do not set the SHIPMENT fulfillment state to COMPLETED (leave it as PREPARED) it does appear in the dashboard. However, I then have to manually mark it as shipped to complete the order. How can I achieve the same thing via the API?

Hi @mark welcome to the forums!

That is currently a known state that is not supported in the dashboard. An order cannot be OPEN while the fulfillment is COMPLETED. If you update the order and mark the root order as COMPLETED, it should show up in the dashboard.

The dashboard does show OPEN orders with OPEN fulfillments which is why your latter one works. It also shows COMPLETED orders with COMPLETED fulfillments, but not OPEN orders with COMPLETED fulfillments. When using the dashboard to complete an order fulfillment, it would normally automatically mark the root order as COMPLETED as well.

Thanks @sjosey.

So what I need to do is to update the order state to COMPLETED at the same time I update the fulfilment state. I think I had misunderstood and thought it would auto-complete the order when all fulfilments were completed.

Yep, that’s correct. If the fulfillment was handled by the dashboard or POS then it would be auto-completed when the fulfillment was completed, but if you’re doing it via the API you will need to manually do it.