Square.Connect.Api.OrdersApi
October 23, 2019 ยท View on GitHub
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 |
| PayOrder | POST /v2/orders/{order_id}/pay | PayOrder |
| SearchOrders | POST /v2/orders/search | SearchOrders |
| UpdateOrder | PUT /v2/locations/{location_id}/orders/{order_id} | UpdateOrder |
BatchRetrieveOrders
BatchRetrieveOrdersResponse BatchRetrieveOrders (string locationId, BatchRetrieveOrdersRequest 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
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class BatchRetrieveOrdersExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi();
var locationId = locationId_example; // string | The ID of the orders' associated location.
var body = new BatchRetrieveOrdersRequest(); // BatchRetrieveOrdersRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// BatchRetrieveOrders
BatchRetrieveOrdersResponse result = apiInstance.BatchRetrieveOrders(locationId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling OrdersApi.BatchRetrieveOrders: " + e.Message );
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| locationId | string | The ID of the orders' associated location. | |
| body | BatchRetrieveOrdersRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Return type
Authorization
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
CreateOrderResponse CreateOrder (string locationId, CreateOrderRequest body)
CreateOrder
Creates a new Order which can include information on products for purchase and settings to apply to the purchase. To pay for a created order, please refer to the Pay for Orders guide. You can modify open orders using the UpdateOrder endpoint. To learn more about the Orders API, see the Orders API Overview.
Example
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class CreateOrderExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi();
var locationId = locationId_example; // string | The ID of the business location to associate the order with.
var body = new CreateOrderRequest(); // CreateOrderRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// CreateOrder
CreateOrderResponse result = apiInstance.CreateOrder(locationId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling OrdersApi.CreateOrder: " + e.Message );
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| locationId | string | The ID of the business location to associate the order with. | |
| body | CreateOrderRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PayOrder
Note: This endpoint is in beta.
PayOrderResponse PayOrder (string orderId, PayOrderRequest body)
PayOrder
Pay for an order using one or more approved payments, or settle an order with a total of 0. The total of the payment_ids listed in the request must be equal to the order total. Orders with a total amount of 0 can be marked as paid by specifying an empty array of payment_ids in the request. To be used with PayOrder, a payment must: - Reference the order by specifying the order_id when creating the payment. Any approved payments that reference the same order_id not specified in the payment_ids will be canceled. - Be approved with delayed capture. Using a delayed capture payment with PayOrder will complete the approved payment. Learn how to pay for orders with a single payment using the Payments API.
Example
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class PayOrderExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi();
var orderId = orderId_example; // string | The ID of the order being paid.
var body = new PayOrderRequest(); // PayOrderRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// PayOrder
PayOrderResponse result = apiInstance.PayOrder(orderId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling OrdersApi.PayOrder: " + e.Message );
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| orderId | string | The ID of the order being paid. | |
| body | PayOrderRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SearchOrders
SearchOrdersResponse SearchOrders (SearchOrdersRequest body)
SearchOrders
Search all orders for one or more locations. Orders include all sales, returns, and exchanges regardless of how or when they entered the Square Ecosystem (e.g. Point of Sale, Invoices, Connect APIs, etc). SearchOrders requests need to specify which locations to search and define a SearchOrdersQuery object which controls how to sort or filter the results. Your SearchOrdersQuery can: Set filter criteria. Set sort order. Determine whether to return results as complete Order objects, or as OrderEntry objects. Note that details for orders processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline orders have a created_at value that reflects the time the order was created, not the time it was subsequently transmitted to Square.
Example
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class SearchOrdersExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi();
var body = new SearchOrdersRequest(); // SearchOrdersRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// SearchOrders
SearchOrdersResponse result = apiInstance.SearchOrders(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling OrdersApi.SearchOrders: " + e.Message );
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| body | SearchOrdersRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdateOrder
Note: This endpoint is in beta.
UpdateOrderResponse UpdateOrder (string locationId, string orderId, UpdateOrderRequest body)
UpdateOrder
Updates an open Order by adding, replacing, or deleting fields. Orders with a COMPLETED or CANCELED state cannot be updated. An UpdateOrder request requires the following: - The order_id in the endpoint path, identifying the order to update. - The latest version of the order to update. - The sparse order containing only the fields to update and the version the update is being applied to. - If deleting fields, the dot notation paths identifying fields to clear. To pay for an order, please refer to the Pay for Orders guide. To learn more about the Orders API, see the Orders API Overview.
Example
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class UpdateOrderExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new OrdersApi();
var locationId = locationId_example; // string | The ID of the order's associated location.
var orderId = orderId_example; // string | The ID of the order to update.
var body = new UpdateOrderRequest(); // UpdateOrderRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// UpdateOrder
UpdateOrderResponse result = apiInstance.UpdateOrder(locationId, orderId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling OrdersApi.UpdateOrder: " + e.Message );
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| locationId | string | The ID of the order's associated location. | |
| orderId | string | The ID of the order to update. | |
| body | UpdateOrderRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]