# Inputs / Sales

# Sales

**Object**
## SaleActionInput

> <p>The value below corresponds to the type of action that was taken:</p>
> <ul>
> <li>Product / customer scan: the barcode scanned</li>
> <li>Product / customer search: the string searched</li>
> <li>Product / customer key: the key's rules</li>
> <li>Quantity override: the new quantity</li>
> <li>Increment / decrement quantity: the amount incremented / decrement</li>
> <li>Remove product: "keyboard" or "trash"</li>
> <li>Remove customer: an empty string</li>
> <li>Add / remove payment: the index of the payment method</li>
> </ul>

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| action | [SaleActionEnum!](/documentation/Enums/Sale-Action-Enum#SaleActionEnum) | The action that was taken |  |
| timestamp | [DateTime!](/documentation/Types/Date-Time#DateTime) | The time the action was taken |  |
| value | *String!* | The value related to the action | Maximum Length: 160 |
| affecting | [ID!](/documentation/Types/UUID#UUID) | The ID of the object affected by this action |  |
| user | [ID!](/documentation/Types/UUID#UUID) | The user who performed the action |  |



**Object**
## SaleDiscountInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| amount | *Float* | The amount that the sale was discounted by | Minimum: 0Maximum: 10,000 |
| reason | *String* | The reason the discount was applied |  |



**Object**
## SaleGiftCardInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| id | *String* | The local ID of the gift card (you can put your ID here) |  |
| code | *String!* | The code used to identify the gift card (must be unique between active cards) | Minimum Length: 1Maximum Length: 60 |
| expiry | [Date](/documentation/Types/Date#Date) | The expiry for the gift card (if null this is calculated on Shopfront) |  |
| source | *String* | The enterprise that owns this gift card or `internal` (if not specified, `internal` will be used) |  |



**Object**
## SaleInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| id | *String* | The local ID of the sale (you can set this to your ID) |  |
| linkedTo | [ID](/documentation/Types/UUID#UUID) | The sale this is linked to (e.g. for when a sale is being returned) |  |
| register | [ID!](/documentation/Types/UUID#UUID) | The register that the sale was completed on |  |
| user | [ID!](/documentation/Types/UUID#UUID) | The user who completed the sale |  |
| customer | [ID](/documentation/Types/UUID#UUID) | The customer who purchased the goods |  |
| status | [SaleStatusEnum!](/documentation/Enums/Sale-Status-Enum#SaleStatusEnum) | The status of the sale |  |
| invoiceId | *String* | The ID of the invoice (typically this is called an "Invoice Number") | Minimum Length: 1Maximum Length: 40 |
| note | *String* | Any public notes to add to the sale |  |
| internalNote | *String* | Any internal notes to add to the customer |  |
| orderReference | *String* | The order reference of this sale | Minimum Length: 1Maximum Length: 160 |
| discount | [SaleDiscountInput](/documentation/Inputs/Sales#SaleDiscountInput) | The discount applied to the sale |  |
| change | *Float* | The amount of change that was provided to the customer | Minimum: 0Maximum: 10,000 |
| refundReason | *String* | The reason for the refund (may be required depending upon Vendor settings), only valid when an item has negative quantity on the sale |  |
| metaData | [JSON](/documentation/Types/JSON#JSON) | Customisable unstructured meta data related to the sale |  |
| createdAt | [DateTime](/documentation/Types/Date-Time#DateTime) | The time the sale was created |  |
| items | [[SaleItemInput!]!](/documentation/Inputs/Sales#SaleItemInput) | The items that are on the sale |  |
| payments | [[SalePaymentInput!]!](/documentation/Inputs/Sales#SalePaymentInput) | The payments that are applied to the sale |  |
| actions | [[SaleActionInput!]](/documentation/Inputs/Sales#SaleActionInput) | The actions that occurred during the sale |  |



**Object**
## SaleItemInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| user | [ID](/documentation/Types/UUID#UUID) | The user who sold the item (defaults to the sale's user) |  |
| note | *String* | Any publicly visible notes about the item |  |
| total | *Float!* | The total price for the item | Minimum: -10,000,000,000Maximum: 10,000,000,000 |
| product | [SaleProductInput](/documentation/Inputs/Sales#SaleProductInput) | The product that was sold (not valid when giftCard or surcharge is set) |  |
| giftCard | [SaleGiftCardInput](/documentation/Inputs/Sales#SaleGiftCardInput) | The gift card that was sold (not valid when product or surcharge is set) |  |
| surcharge | [SaleSurchargeInput](/documentation/Inputs/Sales#SaleSurchargeInput) | The surcharge that was added to the sale (not valid when product or giftCard is set) |  |
| metaData | [JSON](/documentation/Types/JSON#JSON) | Any miscellaneous data related to the item (you can put what you want here) |  |



**Object**
## SalePaymentInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| method | *String!* | The payment method used (either the ID of the payment method or the string "loyalty") |  |
| subtype | *String* | The "subtype" of the payment (e.g. VISA / MASTERCARD for EFTPOS) | Minimum Length: 0Maximum Length: 160 |
| amount | *Float!* | The amount that was paid on the payment method (excluding cash out) | Minimum: -10,000,000,000Maximum: 10,000,000,000 |
| rounding | *Float* | The amount that was rounded | Minimum: -1,000,000Maximum: 1,000,000 |
| cashout | *Float* | The amount that was withdrawn with the payment | Minimum: 0Maximum: 1,000,000 |
| status | [PaymentStatusEnum](/documentation/Enums/Payment-Status-Enum#PaymentStatusEnum) | The status of the payment method (defaults to COMPLETED) |  |
| register | [ID](/documentation/Types/UUID#UUID) | The register that the payment occurred on (defaults to the sale's register) |  |
| processTime | [DateTime](/documentation/Types/Date-Time#DateTime) | The time that the payment took place (defaults to the sale's created time) |  |
| cancelledAt | [DateTime](/documentation/Types/Date-Time#DateTime) | The time that the payment was cancelled (defaults to the `processTime` if this payment is cancelled) |  |
| metaData | [JSON](/documentation/Types/JSON#JSON) | Any miscellaneous data related to the payment (you can put what you want here) |  |
| receipt | *String* | The preformatted receipt for this payment method (e.g. the receipt from an EFTPOS terminal) |  |



**Object**
## SalePaymentUpdateInput

| Fields | Type | Description |
| --- | --- | --- |
| id | *Int!* | The ID of the payment method line to update |
| method | [ID](/documentation/Types/UUID#UUID) | The ID of the payment method used |
| register | [ID](/documentation/Types/UUID#UUID) | The register that the payment occurred on (defaults to the sale's register) |
| processTime | [DateTime](/documentation/Types/Date-Time#DateTime) | The time that the payment took place (defaults to the sale's created time) |
| metaData | [JSON](/documentation/Types/JSON#JSON) | Any miscellaneous data related to the payment (you can put what you want here) |



**Object**
## SaleProductContainsInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the product |  |
| quantity | *Float!* | The quantity sold (in items) | Minimum: -100,000,000Maximum: 100,000,000 |
| contains | [[SaleProductContainsInput]](/documentation/Inputs/Sales#SaleProductContainsInput) | The products this product contains |  |
| price | *Float* | The amount that this component adjusted the price of the parent package | Minimum: -1,000,000Maximum: 1,000,000 |



**Object**
## SaleProductInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the product |  |
| quantity | *Float!* | The quantity sold (in items) | Minimum: -100,000,000Maximum: 100,000,000 |
| contains | [[SaleProductContainsInput]](/documentation/Inputs/Sales#SaleProductContainsInput) | The products this product contains |  |
| promotions | [[SalePromotionInput]](/documentation/Inputs/Sales#SalePromotionInput) | The promotions applied to this product |  |
| taxRate | [ID](/documentation/Types/UUID#UUID) | The tax rate for the item (if none of `taxRate`, `taxRatePercentage` or `taxAmount` are specified the Product's `taxRate` is used). Only one of `taxRate`, `taxRatePercentage` or `taxAmount` can be provided |  |
| taxAmount | *Float* | The total value of tax paid on this item. Tax rates will be automatically matched and if they don't exist will be created. Tax rates are rounded to the nearest 0.25%, if further control is needed, specify one of `taxRate` or `taxRatePercentage` instead. Only one of `taxRate`, `taxRatePercentage` or `taxAmount` can be provided | Minimum: -10,000,000,000Maximum: 10,000,000,000 |
| taxRatePercentage | *Float* | The percentage rate of tax to pay (from 0%), existing tax rates in Shopfront will be automatically matched and created if they don't exist. Only one of `taxRate`, `taxRatePercentage` or `taxAmount` can be provided | Minimum: 0Maximum: 1,000 |
| cost | *Float* | The cost for the product (any rebates will be subtracted from this) (defaults to the current cost) | Minimum: -10,000,000,000Maximum: 10,000,000,000 |
| caseQuantity | *Float* | The case quantity at the time of sale (defaults to the current case quantity) | Minimum: 1Maximum: 9,999 |
| discount | [SaleDiscountInput](/documentation/Inputs/Sales#SaleDiscountInput) | The discount applied to this item |  |
| loyaltyValue | *Float* | The loyalty value of the item (in points) | Minimum: -10,000Maximum: 10,000 |



**Object**
## SalePromotionInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the promotion that was applied to the product |  |
| rebateAmount | *Float* | The total dollar value of the rebate applied | Minimum: 0Maximum: 10,000 |
| rebateQuantity | *Float* | How many times the rebate was applied to the product | Minimum: 0Maximum: 10,000 |
| savings | *Float* | The total dollar value of the promotional savings for the product | Minimum: -10,000Maximum: 10,000 |
| quantity | *Float* | How many times the promotion was applied to the product | Minimum: 0Maximum: 10,000 |



**Object**
## SaleSearchInput

| Fields | Type | Description | Validation |
| --- | --- | --- | --- |
| clientId | *String!* | The client ID of the sale |  |
| invoiceId | *String* | The invoice id (number) of the sale | Minimum Length: 1Maximum Length: 40 |



**Object**
## SaleSurchargeInput

| Fields | Type | Description |
| --- | --- | --- |
| taxRate | [ID](/documentation/Types/UUID#UUID) | The tax rate for the surcharge |