Update Sale

This endpoint is used to updates Sales. Please note, updates with the same contents are ignored and all items in a sale must be of an identical currency.

Request
Security:
header Parameters
Authorization
required
string
Default: Bearer {$$.env.access_token}
Request Body schema: application/json
version
required
number

Represents the last read version of the sale returned by the GET request. If this version is out of date, the request will fail with a 412. Get the latest sale and merge it with the values from this request, then retry with the latest version.

status
string
Default: "CLOSED"

An enum describing the status of the sale. Once the sale has been closed, it cannot be reopened.

Enum: "CLOSED" "OPEN"
closedZonedDateTime
string <date-time>

The time the sale was closed on the POS. closedZonedDateTime is required when the status is CLOSED otherwise optional. The format of the date time is the notation as defined by RFC 3339, section 5.6.

object

Details about the staff member from the POS

object

The section within the venue where the sale took place.

object

Optional information about the table where in the venue the sale took place.

Array of objects (Line Item)

Provide existing & new item to be applied to the sale. The update will do a complete array replacement so any items not provided in this request will be removed.

Array of objects (Money Positive Amount With Description)

Provide existing & new discounts to be applied to the sale. The update will do a complete array replacement so any discounts not provided in this request will be removed.

Array of objects (Money Positive Amount With Description)

Provide existing & new surcharges to be applied to the sale. The update will do a complete array replacement so any surcharges not provided in this request will be removed.

object

The total amount (in cents) of tax collected for this sale by the merchant. This must be updated when the total changes.

Array of objects

Provide all existing & new payments to be applied to the sale. Existing payments cannot be removed.

object

The total (in cents) of this sale. This must be updated when items, discounts or surcharges are added. It is expected to calculate to: sum(items[].total) - discounts + surcharges

Responses
200

If the Sale was successfully updated on the server you will receive a 200 OK and the updated Sale with a new version.

412

The provided version is outdated. This indicates that another process has made updates to the same Sale. Get the latest sale object and retry with the latest version.

patch/sales/{saleId}
Request samples
application/json
{
  • "version": 0,
  • "status": "CLOSED",
  • "closedZonedDateTime": "2018-05-02T08:28:13+10:00",
  • "staff": {
    },
  • "section": {
    },
  • "table": {
    },
  • "items": [
    ],
  • "discounts": [
    ],
  • "surcharges": [
    ],
  • "tax": {
    },
  • "payments": [
    ],
  • "total": {
    }
}
Response samples
application/json
{
  • "id": "string",
  • "version": 0,
  • "locationId": "string",
  • "origin": {
    },
  • "source": {
    },
  • "type": "SALE",
  • "status": "CLOSED",
  • "openedZonedDateTime": "2018-05-02T08:28:13+10:00",
  • "closedZonedDateTime": "2018-05-02T08:28:13+10:00",
  • "parentSaleId": "string",
  • "customer": {
    },
  • "register": {
    },
  • "staff": {
    },
  • "section": {
    },
  • "table": {
    },
  • "bookingId": "string",
  • "items": [
    ],
  • "discounts": [
    ],
  • "surcharges": [
    ],
  • "tax": {
    },
  • "payments": [
    ],
  • "total": {
    },
  • "subtotal": {
    }
}
Copyright © Tyro Payments 2019-2024. All right reserved.