# Vend\SalesApi

Sale operations

All URIs are relative to https://example.retail.lightspeed.app/api/2026-07, 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) | **POST** /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): \Vend\Model\SaleCreateResponse
```

Create a sale

Create a sale and return the created sale in the response body. See [Sales 101](/docs/sales_101) for usage information.  Migrating from `v0.9`? See the [migration guide](/docs/sales_migration_guide).  🔒 Requires: `sales:write` scope

### Example

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


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


$apiInstance = new Vend\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 \Vend\Model\SaleRequest(); // \Vend\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** | [**\Vend\Model\SaleRequest**](../Model/SaleRequest.md)| New sale object. | |

### Return type

[**\Vend\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): \Vend\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 (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\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

[**\Vend\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): \Vend\Model\SaleResponse
```

Return a sale

Initializes a return for an existing closed sale and returns the newly created SAVED return sale. Use this endpoint to start the return workflow before adding refund payments or finalizing the returned items. 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 (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\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

[**\Vend\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): \Vend\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 (JWT) authorization: bearerAuth
$config = Vend\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Vend\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

[**\Vend\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): \Vend\Model\SaleCreateResponse
```

Update a sale

Update an existing sale by ID.  🔒 Requires: `sales:write` scope

### Example

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


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


$apiInstance = new Vend\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 \Vend\Model\SaleUpdateRequest(); // \Vend\Model\SaleUpdateRequest | Updated sale object.

try {
    $result = $apiInstance->updateSale($sale_id, $sale_update_request);
    print_r($result);
} 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** | [**\Vend\Model\SaleUpdateRequest**](../Model/SaleUpdateRequest.md)| Updated sale object. | |

### Return type

[**\Vend\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)
