Skip to content

Latest commit

 

History

History
110 lines (74 loc) · 4.72 KB

OrdersApi.md

File metadata and controls

110 lines (74 loc) · 4.72 KB

SquareConnect\OrdersApi

All URIs are relative to https://connect.squareup.com

Method HTTP request Description
batchRetrieveOrders POST /v2/locations/{location_id}/orders/batch-retrieve BatchRetrieveOrders
createOrder POST /v2/locations/{location_id}/orders CreateOrder

batchRetrieveOrders

\SquareConnect\Model\BatchRetrieveOrdersResponse batchRetrieveOrders($location_id, $body)

BatchRetrieveOrders

Retrieves a set of Orders by their IDs. If a given Order ID does not exist, the ID is ignored instead of generating an error.

Example

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

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new SquareConnect\Api\OrdersApi();
$location_id = "location_id_example"; // string | The ID of the orders' associated location.
$body = new \SquareConnect\Model\BatchRetrieveOrdersRequest(); // \SquareConnect\Model\BatchRetrieveOrdersRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $api_instance->batchRetrieveOrders($location_id, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling OrdersApi->batchRetrieveOrders: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
location_id string The ID of the orders' associated location.
body \SquareConnect\Model\BatchRetrieveOrdersRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\BatchRetrieveOrdersResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createOrder

\SquareConnect\Model\CreateOrderResponse createOrder($location_id, $body)

CreateOrder

Creates an Order that can then be referenced as order_id in a request to the Charge endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order's id in the order_id field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the Orders API Overview.

Example

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

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new SquareConnect\Api\OrdersApi();
$location_id = "location_id_example"; // string | The ID of the business location to associate the order with.
$body = new \SquareConnect\Model\CreateOrderRequest(); // \SquareConnect\Model\CreateOrderRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $api_instance->createOrder($location_id, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling OrdersApi->createOrder: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
location_id string The ID of the business location to associate the order with.
body \SquareConnect\Model\CreateOrderRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\CreateOrderResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]