# Vend202601\SalesApi

Sale operations

All URIs are relative to https://example.retail.lightspeed.app/api/2026-01, except if the operation defines another base path.

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**createSale()**](SalesApi.md#createSale) | **POST** /sales | Create a sale |
| [**getSaleByID()**](SalesApi.md#getSaleByID) | **GET** /sales/{sale_id} | Get a single sale |
| [**initReturnSale()**](SalesApi.md#initReturnSale) | **PUT** /sales/{sale_id}/actions/return | Return a sale |
| [**listSales()**](SalesApi.md#listSales) | **GET** /sales | List Sales |
| [**updateSale()**](SalesApi.md#updateSale) | **PUT** /sales/{sale_id} | Update a sale |


## `createSale()`

```php
createSale($sale_request): \Vend202601\Model\SaleCreateResponse
```

Create a sale

Create a sale. Returns the ID of the created sale. See [Sales 101](/docs/sales_101) for usage information.  **Note**: Promotions cannot be used with this endpoint.  🔒 Requires: `sales:write` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Vend202601\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend202601\Api\SalesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sale_request = new \Vend202601\Model\SaleRequest(); // \Vend202601\Model\SaleRequest | New sale object.

try {
    $result = $apiInstance->createSale($sale_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SalesApi->createSale: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **sale_request** | [**\Vend202601\Model\SaleRequest**](../Model/SaleRequest.md)| New sale object. | |

### Return type

[**\Vend202601\Model\SaleCreateResponse**](../Model/SaleCreateResponse.md)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: `application/json`
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `getSaleByID()`

```php
getSaleByID($sale_id): \Vend202601\Model\SaleResponse
```

Get a single sale

Returns a single sale with a given ID.  🔒 Requires: `sales:read` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Vend202601\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend202601\Api\SalesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sale_id = 'sale_id_example'; // string | A valid sale ID.

try {
    $result = $apiInstance->getSaleByID($sale_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SalesApi->getSaleByID: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **sale_id** | **string**| A valid sale ID. | |

### Return type

[**\Vend202601\Model\SaleResponse**](../Model/SaleResponse.md)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `initReturnSale()`

```php
initReturnSale($sale_id): \Vend202601\Model\SaleResponse
```

Return a sale

Initializes a return on a given sale ID and returns the SAVED return. See [the tutorial](/docs/sales_returns) for more information.  🔒 Requires: `sales:write` `users:read` scopes

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Vend202601\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend202601\Api\SalesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sale_id = 'sale_id_example'; // string | A valid sale ID.

try {
    $result = $apiInstance->initReturnSale($sale_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SalesApi->initReturnSale: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **sale_id** | **string**| A valid sale ID. | |

### Return type

[**\Vend202601\Model\SaleResponse**](../Model/SaleResponse.md)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `listSales()`

```php
listSales($after, $before, $page_size): \Vend202601\Model\SaleCollection
```

List Sales

Returns a paginated list of sales.  To search for sales, please have a look at our [Search endpoint](/reference/search-1) on what is supported.  🔒 Requires: `sales:read` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Vend202601\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend202601\Api\SalesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$after = 56; // int | The lower limit for the version numbers to be included in the response.
$before = 56; // int | The upper limit for the version numbers to be included in the response.
$page_size = 56; // int | The maximum number of items to be returned in the response.

try {
    $result = $apiInstance->listSales($after, $before, $page_size);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SalesApi->listSales: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **after** | **int**| The lower limit for the version numbers to be included in the response. | [optional] |
| **before** | **int**| The upper limit for the version numbers to be included in the response. | [optional] |
| **page_size** | **int**| The maximum number of items to be returned in the response. | [optional] |

### Return type

[**\Vend202601\Model\SaleCollection**](../Model/SaleCollection.md)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `updateSale()`

```php
updateSale($sale_id, $sale_update_request)
```

Update a sale

Update an existing sale by ID.  **Note**: Promotions cannot be used with this endpoint.  🔒 Requires: `sales:write` scope

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: bearerAuth
$config = Vend202601\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend202601\Api\SalesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sale_id = 'sale_id_example'; // string | A valid sale ID.
$sale_update_request = new \Vend202601\Model\SaleUpdateRequest(); // \Vend202601\Model\SaleUpdateRequest | Updated sale object.

try {
    $apiInstance->updateSale($sale_id, $sale_update_request);
} catch (Exception $e) {
    echo 'Exception when calling SalesApi->updateSale: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **sale_id** | **string**| A valid sale ID. | |
| **sale_update_request** | [**\Vend202601\Model\SaleUpdateRequest**](../Model/SaleUpdateRequest.md)| Updated sale object. | |

### Return type

void (empty response body)

### Authorization

[bearerAuth](../../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: `application/json`
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
