Documentation
¶
Index ¶
- type Client
- func (c *Client) BatchGet(ctx context.Context, request *squaregosdk.BatchGetOrdersRequest, ...) (*squaregosdk.BatchGetOrdersResponse, error)
- func (c *Client) Calculate(ctx context.Context, request *squaregosdk.CalculateOrderRequest, ...) (*squaregosdk.CalculateOrderResponse, error)
- func (c *Client) Clone(ctx context.Context, request *squaregosdk.CloneOrderRequest, ...) (*squaregosdk.CloneOrderResponse, error)
- func (c *Client) Create(ctx context.Context, request *squaregosdk.CreateOrderRequest, ...) (*squaregosdk.CreateOrderResponse, error)
- func (c *Client) Get(ctx context.Context, request *squaregosdk.OrdersGetRequest, ...) (*squaregosdk.GetOrderResponse, error)
- func (c *Client) Pay(ctx context.Context, request *squaregosdk.PayOrderRequest, ...) (*squaregosdk.PayOrderResponse, error)
- func (c *Client) Search(ctx context.Context, request *squaregosdk.SearchOrdersRequest, ...) (*squaregosdk.SearchOrdersResponse, error)
- func (c *Client) Update(ctx context.Context, request *squaregosdk.UpdateOrderRequest, ...) (*squaregosdk.UpdateOrderResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { CustomAttributeDefinitions *customattributedefinitions.Client CustomAttributes *customattributes.Client // contains filtered or unexported fields }
func NewClient ¶
func NewClient(opts ...option.RequestOption) *Client
func (*Client) BatchGet ¶
func (c *Client) BatchGet( ctx context.Context, request *squaregosdk.BatchGetOrdersRequest, opts ...option.RequestOption, ) (*squaregosdk.BatchGetOrdersResponse, error)
Retrieves a set of [orders](entity:Order) by their IDs.
If a given order ID does not exist, the ID is ignored instead of generating an error.
func (*Client) Calculate ¶
func (c *Client) Calculate( ctx context.Context, request *squaregosdk.CalculateOrderRequest, opts ...option.RequestOption, ) (*squaregosdk.CalculateOrderResponse, error)
Enables applications to preview order pricing without creating an order.
func (*Client) Clone ¶
func (c *Client) Clone( ctx context.Context, request *squaregosdk.CloneOrderRequest, opts ...option.RequestOption, ) (*squaregosdk.CloneOrderResponse, error)
Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has only the core fields (such as line items, taxes, and discounts) copied from the original order.
func (*Client) Create ¶
func (c *Client) Create( ctx context.Context, request *squaregosdk.CreateOrderRequest, opts ...option.RequestOption, ) (*squaregosdk.CreateOrderResponse, error)
Creates a new [order](entity:Order) that can include information about products for purchase and settings to apply to the purchase.
To pay for a created order, see [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint.
func (*Client) Get ¶
func (c *Client) Get( ctx context.Context, request *squaregosdk.OrdersGetRequest, opts ...option.RequestOption, ) (*squaregosdk.GetOrderResponse, error)
Retrieves an [Order](entity:Order) by ID.
func (*Client) Pay ¶
func (c *Client) Pay( ctx context.Context, request *squaregosdk.PayOrderRequest, opts ...option.RequestOption, ) (*squaregosdk.PayOrderResponse, error)
Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment) 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](api-endpoint:Payments-CreatePayment). Any approved payments that reference the same `order_id` not specified in the `payment_ids` is canceled. - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture). Using a delayed capture payment with `PayOrder` completes the approved payment.
func (*Client) Search ¶
func (c *Client) Search( ctx context.Context, request *squaregosdk.SearchOrdersRequest, opts ...option.RequestOption, ) (*squaregosdk.SearchOrdersResponse, error)
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 (such as Point of Sale, Invoices, and Connect APIs).
`SearchOrders` requests need to specify which locations to search and define a [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls how to sort or filter the results. Your `SearchOrdersQuery` can:
Set filter criteria. Set the sort order. Determine whether to return results as complete `Order` objects or as
[OrderEntry](entity:OrderEntry) objects.
Note that details for orders processed with Square Point of Sale while in offline mode might 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.
func (*Client) Update ¶
func (c *Client) Update( ctx context.Context, request *squaregosdk.UpdateOrderRequest, opts ...option.RequestOption, ) (*squaregosdk.UpdateOrderResponse, error)
Updates an open [order](entity: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](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects) containing only the fields to update and the version to which the update is being applied. - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete) identifying the fields to clear.
To pay for an order, see [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).