MobiariDocs
Admin APIOrders

Change an order's status

PATCH
/stores/{store_id}/orders/{order_id}/status

Moves the order by hand. Allowed moves (also in the order's allowed_status_transitions):

FromTo
draftpending, paid, cancelled
pendingpaid, fulfilled, cancelled
paidfulfilled, cancelled, refunded
fulfilledcancelled, refunded
cancelled, refundednothing (terminal)

Setting the current status again is a no-op that returns the order, so a retried call is safe. Any other move answers 409 invalid_status_transition with details.from, details.to and details.allowed.

Side effects: cancelled and refunded release reserved stock and cancel open production; fulfilled consumes component reservations and schedules the review request. refunded here only records that money went back outside the platform; to refund through the gateway use POST .../refund. paid does not change payment_status. Shipping is not a status: it follows the shipments. Emits the orders.updated webhook and the matching orders.paid / orders.fulfilled / orders.cancelled / orders.refunded event.

Needs orders.cancel to cancel, orders.refund to mark refunded, orders.manage_payments to mark paid, orders.fulfill to fulfil, and orders.edit otherwise.

Authorization

bearer_auth
AuthorizationBearer <token>

Authorization: Bearer <token>. Either a session access token from POST /auth/login (refresh it with POST /auth/refresh) or a store API token (mobi_st_…). A store API token works only for the store it was issued in, and can do at most what its issuing user can there, narrowed to the scopes it was issued with.

In: header

Path Parameters

store_id*string

Store id

Formatuuid
order_id*string

Order id

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/stores/497f6eca-6276-4993-bfeb-53cbbbba6f08/orders/497f6eca-6276-4993-bfeb-53cbbbba6f08/status" \  -H "Content-Type: application/json" \  -d '{    "status": "draft"  }'
{
  "allowed_status_transitions": [
    "draft"
  ],
  "cancelled_at": "2019-08-24T14:15:22Z",
  "created_at": "2019-08-24T14:15:22Z",
  "currency": "string",
  "customer_document": "string",
  "customer_email": "string",
  "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
  "customer_name": "string",
  "customer_phone": "string",
  "danfe_url": "string",
  "discount_cents": 0,
  "freight_external_order_code": "string",
  "freight_provider_code": "string",
  "freight_quote_id": "7c41832f-da8e-4574-aa21-0a7c4fbcbe9e",
  "freight_snapshot_json": {},
  "freight_status": "string",
  "fulfillment_method": "string",
  "fulfillment_status": null,
  "has_nfe": true,
  "has_pending_builds": true,
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "is_test": true,
  "items": [
    {
      "build_quantity": 0,
      "build_status": "string",
      "expected_ready_at": "2019-08-24T14:15:22Z",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "image_url": "string",
      "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe",
      "product_id": "0d012afa-f885-4e65-aeca-37e27701e2d1",
      "quantity": 0,
      "reserved_quantity": 0,
      "shipped_quantity": 0,
      "sku": "string",
      "title": "string",
      "total_cents": 0,
      "unit_price_cents": 0,
      "variant_id": "8a2d415d-59aa-4132-bef3-011f97c4a0f6"
    }
  ],
  "next_build_ready_at": "2019-08-24T14:15:22Z",
  "nf_value_cents": 0,
  "nfe_key": "string",
  "nfe_number": "string",
  "notes": "string",
  "number": "string",
  "payer_document": "string",
  "payment_expires_at": "2019-08-24T14:15:22Z",
  "payment_intent_status": null,
  "payment_method": "string",
  "payment_provider_code": "string",
  "payment_status": null,
  "pickup_location_id": "5eb4dd60-b565-4dc0-8014-f7a790828fbb",
  "pickup_location_snapshot_json": {},
  "placed_at": "2019-08-24T14:15:22Z",
  "refundable_cents": 0,
  "refunded_cents": 0,
  "refunds": [
    {
      "amount_cents": 0,
      "created_at": "2019-08-24T14:15:22Z",
      "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
      "currency": "string",
      "external_id": "string",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe",
      "payment_intent_id": "7e322e88-5311-4979-b283-b9a687137f41",
      "provider_code": "string",
      "reason": "string"
    }
  ],
  "sales_channel_id": "77111faa-6b1b-4b6a-8288-d59a136e22da",
  "shipments": [
    {
      "carrier_name": "string",
      "cdf_price_id": 0,
      "cdf_quotation_code": "string",
      "cost_cents": 0,
      "created_at": "2019-08-24T14:15:22Z",
      "delivered_at": "2019-08-24T14:15:22Z",
      "freight_external_order_code": "string",
      "freight_payer": "string",
      "freight_provider_code": "string",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "items": [
        {
          "order_item_id": "c3e40b5c-b9ae-413a-b96e-5aa0514f5ae6",
          "ordered_quantity": 0,
          "quantity": 0,
          "sku": "string",
          "title": "string"
        }
      ],
      "notes": "string",
      "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe",
      "shipped_at": "2019-08-24T14:15:22Z",
      "status": "draft",
      "store_id": "7fe87115-950c-4ae8-bd7e-970406bc9ac0",
      "tracking_code": "string",
      "tracking_events": [
        {
          "comment": "string",
          "datetime": "string",
          "event": "string",
          "occurred_at": "2019-08-24T14:15:22Z"
        }
      ],
      "tracking_json": {},
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "shipping_cents": 0,
  "shipping_contact": null,
  "shipping_option": null,
  "status": "draft",
  "store_id": "7fe87115-950c-4ae8-bd7e-970406bc9ac0",
  "subtotal_cents": 0,
  "tax_cents": 0,
  "total_cents": 0,
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}