$vendorsApi = $client->getVendorsApi();
VendorsApi
- Bulk Create Vendors
- Bulk Retrieve Vendors
- Bulk Update Vendors
- Create Vendor
- Search Vendors
- Retrieve Vendor
- Update Vendor
Creates one or more Vendor objects to represent suppliers to a seller.
function bulkCreateVendors(BulkCreateVendorsRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
BulkCreateVendorsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type BulkCreateVendorsResponse
.
$body = BulkCreateVendorsRequestBuilder::init(
[
'key0' => VendorBuilder::init()->build(),
'key1' => VendorBuilder::init()->build()
]
)->build();
$apiResponse = $vendorsApi->bulkCreateVendors($body);
if ($apiResponse->isSuccess()) {
$bulkCreateVendorsResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Retrieves one or more vendors of specified Vendor IDs.
function bulkRetrieveVendors(BulkRetrieveVendorsRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
BulkRetrieveVendorsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type BulkRetrieveVendorsResponse
.
$body = BulkRetrieveVendorsRequestBuilder::init()
->vendorIds(
[
'INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4'
]
)
->build();
$apiResponse = $vendorsApi->bulkRetrieveVendors($body);
if ($apiResponse->isSuccess()) {
$bulkRetrieveVendorsResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Updates one or more of existing Vendor objects as suppliers to a seller.
function bulkUpdateVendors(BulkUpdateVendorsRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
BulkUpdateVendorsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type BulkUpdateVendorsResponse
.
$body = BulkUpdateVendorsRequestBuilder::init(
[
'key0' => UpdateVendorRequestBuilder::init(
VendorBuilder::init()->build()
)->build(),
'key1' => UpdateVendorRequestBuilder::init(
VendorBuilder::init()->build()
)->build()
]
)->build();
$apiResponse = $vendorsApi->bulkUpdateVendors($body);
if ($apiResponse->isSuccess()) {
$bulkUpdateVendorsResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Creates a single Vendor object to represent a supplier to a seller.
function createVendor(CreateVendorRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateVendorRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type CreateVendorResponse
.
$body = CreateVendorRequestBuilder::init(
'idempotency_key2'
)->build();
$apiResponse = $vendorsApi->createVendor($body);
if ($apiResponse->isSuccess()) {
$createVendorResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Searches for vendors using a filter against supported Vendor properties and a supported sorter.
function searchVendors(SearchVendorsRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
SearchVendorsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type SearchVendorsResponse
.
$body = SearchVendorsRequestBuilder::init()->build();
$apiResponse = $vendorsApi->searchVendors($body);
if ($apiResponse->isSuccess()) {
$searchVendorsResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Retrieves the vendor of a specified Vendor ID.
function retrieveVendor(string $vendorId): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
vendorId |
string |
Template, Required | ID of the Vendor to retrieve. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type RetrieveVendorResponse
.
$vendorId = 'vendor_id8';
$apiResponse = $vendorsApi->retrieveVendor($vendorId);
if ($apiResponse->isSuccess()) {
$retrieveVendorResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Updates an existing Vendor object as a supplier to a seller.
function updateVendor(UpdateVendorRequest $body, string $vendorId): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
UpdateVendorRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
vendorId |
string |
Template, Required | - |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type UpdateVendorResponse
.
$body = UpdateVendorRequestBuilder::init(
VendorBuilder::init()
->id('INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4')
->name('Jack\'s Chicken Shack')
->version(1)
->status(VendorStatus::ACTIVE)
->build()
)
->idempotencyKey('8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe')
->build();
$vendorId = 'vendor_id8';
$apiResponse = $vendorsApi->updateVendor(
$body,
$vendorId
);
if ($apiResponse->isSuccess()) {
$updateVendorResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());