gosquare

package module
v0.0.0-...-23695ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2017 License: MIT Imports: 12 Imported by: 0

README

gosquare

##Summary Square API for Golang. See the api documentation for further details. See the go docs for details on this lib.

##Notes Every method in the the Connect V1 API is accounted for in the lib. Additionally every method has a corresponding *BatchRequest method, that returns a *BatchRequest object that can be added to an array and sent as a BatchRequest using the SubmitBatch method. There are two exceptions, SubmitBatch itself, which is prohibited by Square explicitly, and UploadItemImage, which doesn't work for obvious reasons.

There are several utilities and functions you should be aware of for your benefit:

  1. Square will sometimes paginate results on large get request. On any method for which this is possible, the method will return a NextRequest object, which will be nil if there is no "next" result but will be present when there is. The NextRequest object has two convenient methods GetNextRequest, which takes an expected result object as an argument, and will, itself, return another NextRequest object if there is an additional one, and GetNextRequestAsBatchRequest, which will return the request as a BatchRequest object which can be sent along with other BatchRequests in SubmitBatch. Finally if any BatchRequest object has pagination the BatchResponse object will be populated with a NextRequest member, which can be used the same as discussed above.

  2. GeneratePermissionURL is a method you can use to generate a url, based on your square client id, that will give redirect anyone who clicks it to a square signin screen asking if they would like to give your application permission to access their data (along with the specific permissions you ask for in the scope argument). Should the user grant your application permission you can also add a redirect url in the method (the locale argument) along with any state you'd like to transfer between requests (the state argument). See Square's Oauth docs for details.

  3. The GetToken method gets a first time token based on the authorization code you get when someone grants your application permission to access their square account. The RenewToken method, obviously, allows you to renew the token based on the expired token (the grace period for an old, expired token being able to get your application a renewed token, is 30 days).

  4. ValidateWebhook validates a Square-initiated webhook request to your application is.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCategory

func DeleteCategory(token, locationID, categoryID string) error

Deletes an existing item category.

Required permissions: ITEMS_WRITE

func DeleteCell

func DeleteCell(token, locationID, pageID string, row, column int) error

Deletes a cell from a Favorites page in Square Register.

Required permissions: ITEMS_WRITE

`row`: The row of the cell to clear. Always an integer between 0 and 4, inclusive. Row 0 is the top row.

`column`: The column of the cell to clear. Always an integer between 0 and 4, inclusive. Column 0 is the leftmost column.

func DeleteDiscount

func DeleteDiscount(token, locationID, discountID string) error

Deletes an existing discount.

Required permissions: ITEMS_WRITE

func DeleteFee

func DeleteFee(token, locationID, feeID string) error

Deletes an existing fee (tax).

Required permissions: ITEMS_WRITE

func DeleteItem

func DeleteItem(token, locationID, itemID string) error

Deletes an existing item and all item variations associated with it.

Required permissions: ITEMS_WRITE

func DeleteModifierList

func DeleteModifierList(token, locationID, modifierListID string) error

Deletes an existing item modifier list and all modifier options associated with it.

Required permissions: ITEMS_WRITE

func DeleteModifierOption

func DeleteModifierOption(token, locationID, modifierListID, modifierOptionID string) error

Deletes an existing item modifier option from a modifier list.

Every modifier list must have at least one option. This endpoint returns an error if you attempt to delete a modifier list's only option.

Required permissions: ITEMS_WRITE

func DeletePage

func DeletePage(token, locationID, pageID string) error

Deletes an existing Favorites page and all of its cells.

Required permissions: ITEMS_WRITE

func DeleteTimecard

func DeleteTimecard(token, timecardID string) error

func DeleteVariation

func DeleteVariation(token, locationID, itemID, variationID string) error

Deletes an existing item variation from an item.

Every item must have at least one varation. This endpoint returns an error if you attempt to delete an item's only variation.

Required permissions: ITEMS_WRITE

func GeneratePermissionURL

func GeneratePermissionURL(clientID, scope string, session bool, locale, state string) string

Generate a url to pass to a user to gain permisson to their account. Cf. https://docs.connect.squareup.com/api/oauth/ "locale", "state" are optional leave them as empty strings to omit them. "session", if "false", will require the merchant to sign into their account even if they have a valid session in their account. It is likely that you want to pass "true". Scope should be a space seperated list of permissions, see the above url for details on what permissions are available. This function will escape all your arguments so don't pass uri-escaped values.

func ListBankAccounts

func ListBankAccounts(token, locationID string) ([]*BankAccount, *NextRequest, error)

Provides non-confidential details for all of a location's associated bank accounts. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.

Required permissions: BANK_ACCOUNTS_READ

func ListCashDrawerShifts

func ListCashDrawerShifts(token, locationID, beginTime, endTime, order string) ([]*CashDrawerShift, *NextRequest, error)

Provides the details for all of a location's cash drawer shifts during a date range. The date range you specify cannot exceed 90 days.

CashDrawerShift objects returned by this endpoint do not include the events field, which lists the events that occurred during the shift. To get a particular shift's events, use the Retrieve Cash Drawer Shift endpoint.

Required permissions: PAYMENTS_READ

`beginTime`: The beginning of the requested reporting period, in ISO 8601 format.Default value: The current time minus 90 days.

`endTime`: The beginning of the requested reporting period, in ISO 8601 format.Default value: The current time.

`order`: The order in which cash drawer shifts are listed in the response, based on their created_at field.Default value: ASC

func ListCategories

func ListCategories(token, locationID string) ([]*Category, *NextRequest, error)

Lists all of a location's item categories.

Required permissions: ITEMS_READ

func ListDiscounts

func ListDiscounts(token, locationID string) ([]*Discount, *NextRequest, error)

Lists all of a location's discounts.

Required permissions: ITEMS_READ

func ListEmployees

func ListEmployees(token string, order, beginUpdatedAt, endUpdatedAt, beginCreatedAt, endCreatedAt, status, externalID string, limit int) ([]*Employee, *NextRequest, error)

Provides summary information for all of a business's employees.

You can filter the results returned by this endpoint by exactly one of the following fields:

`order`: The order in which employees are listed in the response, based on their created_at field.Default value: ASC

`beginUpdatedAt`: If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format.

`endUpdatedAt`: If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format.

`beginCreatedAt`: If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format.

`endCreatedAt`: If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format.

`status`: If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE).

`externalID`: If provided, the endpoint returns only employee entities with the specified external_id.

`limit`: The maximum number of employee entities to return in a single response. This value cannot exceed 200.This value is always an integer.Default value: 100

func ListFees

func ListFees(token, locationID string) ([]*Fee, *NextRequest, error)

Lists all of a location's fees (taxes).

Required permissions: ITEMS_READ

func ListInventory

func ListInventory(token, locationID string, limit int) ([]*InventoryEntry, *NextRequest, error)

Provides inventory information for all of a merchant's inventory-enabled item variations.

See Managing inventory to learn how to enable an item variation for inventory tracking.

Required permissions: ITEMS_READ

`limit`: The maximum number of inventory entries to return in a single response. This value cannot exceed 1000.This value is always an integer.Default value: 1000

func ListItems

func ListItems(token, locationID string) ([]*Item, *NextRequest, error)

Provides summary information for all of a location's items.

Required permissions: ITEMS_READ

func ListLocations

func ListLocations(token string) ([]*Merchant, *NextRequest, error)

Provides details for a business's locations, including their IDs.

The account_capabilities array returned in each Merchant object indicates which account capabilities the location has enabled. For example, if this array does not include the value CREDIT_CARD_PROCESSING, the location cannot currently process credit cards with Square.

Required permissions: MERCHANT_PROFILE_READ

func ListModifierLists

func ListModifierLists(token, locationID string) ([]*ModifierList, *NextRequest, error)

Lists all of a location's modifier lists.

Required permissions: ITEMS_READ

func ListOrders

func ListOrders(token, locationID string, limit int, order string) ([]*Order, *NextRequest, error)

`limit`: The maximum number of orders to return in a single response. This value cannot exceed 200.This value is always an integer.Default value: 100

`order`: Indicates whether orders are listed in chronological (ASC) or reverse-chronological (DESC) order.Default value: ASC

func ListPages

func ListPages(token, locationID string) ([]*Page, *NextRequest, error)

Lists all of a location's Favorites pages in Square Register.

Required permissions: ITEMS_READ

func ListPayments

func ListPayments(token, locationID, beginTime, endTime, order string, limit int) ([]*Payment, *NextRequest, error)

Provides summary information for all payments taken by a merchant or any of the merchant's mobile staff during a date range. Date ranges cannot exceed one year in length. See Date ranges for details of inclusive and exclusive dates.

Required permissions: PAYMENTS_READ

`beginTime`: The beginning of the requested reporting period, in ISO 8601 format.If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error.Default value: The current time minus one year.

`endTime`: The end of the requested reporting period, in ISO 8601 format.If this value is more than one year greater than begin_time, this endpoint returns an error.Default value: The current time.

`order`: The order in which payments are listed in the response.Default value: ASC

`limit`: The maximum number of payments to return in a single response. This value cannot exceed 200.This value is always an integer.Default value: 100

func ListRefunds

func ListRefunds(token, locationID, beginTime, endTime, order string, limit int) ([]*Refund, *NextRequest, error)

Provides the details for all refunds initiated by a merchant or any of the merchant's mobile staff during a date range. Date ranges cannot exceed one year in length. See Date ranges for details of inclusive and exclusive dates.

Required permissions: PAYMENTS_READ

`beginTime`: The beginning of the requested reporting period, in ISO 8601 format.If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error.Default value: The current time minus one year.

`endTime`: The end of the requested reporting period, in ISO 8601 format.If this value is more than one year greater than begin_time, this endpoint returns an error.Default value: The current time.

`order`: The order in which refunds are listed in the response.Default value: ASC

`limit`: The maximum number of refunds to return in a single response. This value cannot exceed 200.This value is always an integer.Default value: 100

func ListRoles

func ListRoles(token, order string, limit int) ([]*EmployeeRole, *NextRequest, error)

Provides summary information for all of a business's employee roles.

Required permissions: EMPLOYEES_READ

`order`: The order in which roles are listed in the response.Default value: ASC

`limit`: The maximum number of employee entities to return in a single response. This value cannot exceed 200.This value is always an integer.Default value: 100

func ListSettlements

func ListSettlements(token, locationID, beginTime, endTime, order string, limit int, status string) ([]*Settlement, *NextRequest, error)

Provides summary information for all deposits and withdrawals initiated by Square to a merchant's bank account during a date range. Date ranges cannot exceed one year in length. See Date ranges for details of inclusive and exclusive dates.

Settlement objects returned by this endpoint do not include the entries field, which lists the transactions that contribute to the total of the settlement. To get a particular settlement's entries, use the Retrieve Settlement endpoint.

Square initiates its regular deposits to merchant bank accounts on the schedule indicated on this page. A deposit initiated by Square on a given day is usually not provided by this endpoint before 10 p.m. PST the same day.

Square does not know when an initiated settlement completes, only whether it has failed. A completed settlement is typically reflected in a merchant's bank account within three business days, but in exceptional cases it might take longer.

Required permissions: SETTLEMENTS_READ

`beginTime`: The beginning of the requested reporting period, in ISO 8601 format.If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error.Default value: The current time minus one year.

`endTime`: The end of the requested reporting period, in ISO 8601 format.If this value is more than one year greater than begin_time, this endpoint returns an error.Default value: The current time.

`order`: The order in which settlements are listed in the response.Default value: ASC

`limit`: The maximum number of settlements to return in a single response. This value cannot exceed 200.This value is always an integer.Default value: 100

`status`: Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED).

func ListSubscriptionPlans

func ListSubscriptionPlans(token, clientID string) ([]*SubscriptionPlan, *NextRequest, error)

Provides information for all of an application's subscription plans.

Important: The Authorization header you provide to this endpoint must have the following format:

func ListSubscriptions

func ListSubscriptions(token, clientID, merchantID string, limit int) ([]*Subscription, *NextRequest, error)

Lists subscriptions that have been created for an application. You can look up subscription information for a single merchant by providing the merchant_id parameter to this endpoint.

Subscription objects returned by this endpoint do not include the fees field, which lists the subscription's payment history. To get a particular subscription's payment history, use the Retrieve Subscription endpoint.

Important: The Authorization header you provide to this endpoint must have the following format:

`merchantID`: If you provide this parameter, the endpoint returns only subscription information for the specified merchant.You can get a merchant's ID with the Retrieve Merchant endpoint.

`limit`: The maximum number of subscriptions to return in a single response. This value cannot exceed 200.Default value: 100

func ListTimecardEvents

func ListTimecardEvents(token, timecardID string) ([]*TimecardEvent, *NextRequest, error)

Provides summary information for all events associated with a particular timecard.

Required permissions: TIMECARDS_READ

func ListTimecards

func ListTimecards(token, order, employeeID, beginClockinTime, endClockinTime, beginClockoutTime, endClockoutTime, beginUpdatedAt, endUpdatedAt string, deleted bool, limit int) ([]*Timecard, *NextRequest, error)

Provides summary information for all of a business's employee timecards.

You can filter the results returned by this endpoint by exactly one of the following fields:

`order`: The order in which timecards are listed in the response, based on their created_at field.Default value: ASC

`employeeID`: If provided, the endpoint returns only timecards for the employee with the specified ID.

`beginClockinTime`: If filtering results by their clockin_time field, the beginning of the requested reporting period, in ISO 8601 format.

`endClockinTime`: If filtering results by their clockin_time field, the end of the requested reporting period, in ISO 8601 format.

`beginClockoutTime`: If filtering results by their clockout_time field, the beginning of the requested reporting period, in ISO 8601 format.

`endClockoutTime`: If filtering results by their clockout_time field, the end of the requested reporting period, in ISO 8601 format.

`beginUpdatedAt`: If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format.

`endUpdatedAt`: If filtering results by their updated_at field, the end of the requested reporting period, in ISO 8601 format.

`deleted`: If true, only deleted timecards are returned. If false, only valid timecards are returned.If you don't provide this parameter, both valid and deleted timecards are returned.

`limit`: The maximum number of timecards to return in a single response. This value cannot exceed 200.This value is always an integer.

func RemoveFee

func RemoveFee(token, locationID, itemID, feeID string) error

Removes a fee assocation from an item, meaning the fee is no longer automatically applied to the item in Square Register.

Required permissions: ITEMS_WRITE

func RemoveModifierList

func RemoveModifierList(token, locationID, itemID, modifierListID string) error

Removes a modifier list association from an item, meaning modifier options from the list can no longer be applied to the item.

Required permissions: ITEMS_WRITE

func ValidateWebHook

func ValidateWebHook(webhookURL, webhookSignatureKey, body, squareSignature string) bool

This method validates that the "X-Square-Signature" header is valid and that the webook is, therefore, a valide request from sqaure and not an attack. Cf https://docs.connect.squareup.com/api/connect/v1/#validating-notifications The first argument should be the url that handles the incoming webhooks The second argument is your webhook signature, the third is the body of the request, the fourth is the header "X-Square-Signatrue"

Types

type AdjustInventoryReqObject

type AdjustInventoryReqObject struct {
	// The number to adjust the variation's quantity by.This value must be negative if adjustment_type is SALE, and it must be
	// positive if adjustment_type is RECEIVE_STOCK.
	QuantityDelta int `json:"quantity_delta"`
	// The reason for the inventory adjustment.
	AdjustmentType string `json:"adjustment_type"`
	// A note about the inventory adjustment.
	Memo string `json:"memo"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type BankAccount

type BankAccount struct {
	// The bank account's Square-issued ID.
	ID string `json:"id"`
	// The Square-issued ID of the merchant associated with the bank account.
	MerchantID string `json:"merchant_id"`
	// The name of the bank that manages the account.
	BankName string `json:"bank_name"`
	// The name associated with the bank account.
	Name string `json:"name"`
	// The bank account's type (for example, savings or checking).
	Type string `json:"type"`
	// The bank account's routing number.
	RoutingNumber string `json:"routing_number"`
	// The last few digits of the bank account number.
	AccountNumberSuffix string `json:"account_numberSuffix"`
	// The currency code of the currency associated with the bank account, in ISO 4217
	// format. For example, the currency code for US dollars is USD.
	CurrencyCode string `json:"currency_code"`
}

Represents a merchant's bank account.

func RetrieveBankAccount

func RetrieveBankAccount(token, locationID, bankAccountID string) (*BankAccount, error)

Provides non-confidential details for a merchant's associated bank account. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.

Required permissions: BANK_ACCOUNTS_READ

type BatchRequest

type BatchRequest struct {
	// The HTTP method of the request (DELETE, GET, POST, or PUT).
	Method string `json:"method"`
	// The path of the request's endpoint, relative to
	// https://connect.squareup.com.For example, this value is
	// /v1/MERCHANT_ID/payments for the List Payments
	// endpoint (with the proper merchant ID).For GET and DELETE requests,
	// include any request parameters in a query string appended to the path (for example,
	// /v1/MERCHANT_ID/payments?order=DESC).
	RelativePath string `json:"relative_path"`
	// The access token to use for the request. This can be a personal access token or an
	// access token generated with the OAuth API.
	AccessToken string `json:"access_token"`
	// The body of the request, if any. Include parameters for POST and PUT
	// requests here.
	Body interface{} `json:"body"`
	// An optional identifier for the request, returned in the request's corresponding
	// BatchResponse.
	RequestID string `json:"request_id"`
	// contains filtered or unexported fields
}

Represents a single request included in a call to the Submit Batch endpoint.

func AdjustInventoryBatchRequest

func AdjustInventoryBatchRequest(token, locationID, variationID string, reqObj *AdjustInventoryReqObject) (*BatchRequest, string)

AdjustInventoryBatchRequest returns a BatchRequest object for AdjustInventory, along with a unique request id.

func ApplyFeeBatchRequest

func ApplyFeeBatchRequest(token, locationID, itemID, feeID string) (*BatchRequest, string)

ApplyFeeBatchRequest returns a BatchRequest object for ApplyFee, along with a unique request id.

func ApplyModifierListBatchRequest

func ApplyModifierListBatchRequest(token, locationID, itemID, modifierListID string) (*BatchRequest, string)

ApplyModifierListBatchRequest returns a BatchRequest object for ApplyModifierList, along with a unique request id.

func CreateCategoryBatchRequest

func CreateCategoryBatchRequest(token, locationID string, reqObj *CreateCategoryReqObject) (*BatchRequest, string)

CreateCategoryBatchRequest returns a BatchRequest object for CreateCategory, along with a unique request id.

func CreateDiscountBatchRequest

func CreateDiscountBatchRequest(token, locationID string, reqObj *CreateDiscountReqObject) (*BatchRequest, string)

CreateDiscountBatchRequest returns a BatchRequest object for CreateDiscount, along with a unique request id.

func CreateEmployeeBatchRequest

func CreateEmployeeBatchRequest(token string, reqObj *CreateEmployeeReqObject) (*BatchRequest, string)

CreateEmployeeBatchRequest returns a BatchRequest object for CreateEmployee, along with a unique request id.

func CreateFeeBatchRequest

func CreateFeeBatchRequest(token, locationID string, reqObj *CreateFeeReqObject) (*BatchRequest, string)

CreateFeeBatchRequest returns a BatchRequest object for CreateFee, along with a unique request id.

func CreateItemBatchRequest

func CreateItemBatchRequest(token, locationID string, reqObj *CreateItemReqObject) (*BatchRequest, string)

CreateItemBatchRequest returns a BatchRequest object for CreateItem, along with a unique request id.

func CreateModifierListBatchRequest

func CreateModifierListBatchRequest(token, locationID string, reqObj *CreateModifierListReqObject) (*BatchRequest, string)

CreateModifierListBatchRequest returns a BatchRequest object for CreateModifierList, along with a unique request id.

func CreateModifierOptionBatchRequest

func CreateModifierOptionBatchRequest(token, locationID, modifierListID string, reqObj *CreateModifierOptionReqObject) (*BatchRequest, string)

CreateModifierOptionBatchRequest returns a BatchRequest object for CreateModifierOption, along with a unique request id.

func CreatePageBatchRequest

func CreatePageBatchRequest(token, locationID string, reqObj *CreatePageReqObject) (*BatchRequest, string)

CreatePageBatchRequest returns a BatchRequest object for CreatePage, along with a unique request id.

func CreateRefundBatchRequest

func CreateRefundBatchRequest(token, locationID string, reqObj *CreateRefundReqObject) (*BatchRequest, string)

CreateRefundBatchRequest returns a BatchRequest object for CreateRefund, along with a unique request id.

func CreateRoleBatchRequest

func CreateRoleBatchRequest(token string, reqObj *CreateRoleReqObject) (*BatchRequest, string)

CreateRoleBatchRequest returns a BatchRequest object for CreateRole, along with a unique request id.

func CreateTimecardBatchRequest

func CreateTimecardBatchRequest(token string, reqObj *CreateTimecardReqObject) (*BatchRequest, string)

CreateTimecardBatchRequest returns a BatchRequest object for CreateTimecard, along with a unique request id.

func DeleteCategoryBatchRequest

func DeleteCategoryBatchRequest(token, locationID, categoryID string) (*BatchRequest, string)

DeleteCategoryBatchRequest returns a BatchRequest object for DeleteCategory, along with a unique request id.

func DeleteCellBatchRequest

func DeleteCellBatchRequest(token, locationID, pageID string, row, column int) (*BatchRequest, string)

DeleteCellBatchRequest returns a BatchRequest object for DeleteCell, along with a unique request id.

func DeleteDiscountBatchRequest

func DeleteDiscountBatchRequest(token, locationID, discountID string) (*BatchRequest, string)

DeleteDiscountBatchRequest returns a BatchRequest object for DeleteDiscount, along with a unique request id.

func DeleteFeeBatchRequest

func DeleteFeeBatchRequest(token, locationID, feeID string) (*BatchRequest, string)

DeleteFeeBatchRequest returns a BatchRequest object for DeleteFee, along with a unique request id.

func DeleteItemBatchRequest

func DeleteItemBatchRequest(token, locationID, itemID string) (*BatchRequest, string)

DeleteItemBatchRequest returns a BatchRequest object for DeleteItem, along with a unique request id.

func DeleteModifierListBatchRequest

func DeleteModifierListBatchRequest(token, locationID, modifierListID string) (*BatchRequest, string)

DeleteModifierListBatchRequest returns a BatchRequest object for DeleteModifierList, along with a unique request id.

func DeleteModifierOptionBatchRequest

func DeleteModifierOptionBatchRequest(token, locationID, modifierListID, modifierOptionID string) (*BatchRequest, string)

DeleteModifierOptionBatchRequest returns a BatchRequest object for DeleteModifierOption, along with a unique request id.

func DeletePageBatchRequest

func DeletePageBatchRequest(token, locationID, pageID string) (*BatchRequest, string)

DeletePageBatchRequest returns a BatchRequest object for DeletePage, along with a unique request id.

func DeleteTimecardBatchRequest

func DeleteTimecardBatchRequest(token, timecardID string) (*BatchRequest, string)

DeleteTimecardBatchRequest returns a BatchRequest object for DeleteTimecard, along with a unique request id.

func DeleteVariationBatchRequest

func DeleteVariationBatchRequest(token, locationID, itemID, variationID string) (*BatchRequest, string)

DeleteVariationBatchRequest returns a BatchRequest object for DeleteVariation, along with a unique request id.

func ListBankAccountsBatchRequest

func ListBankAccountsBatchRequest(token, locationID string) (*BatchRequest, string)

ListBankAccountsBatchRequest returns a BatchRequest object for ListBankAccounts, along with a unique request id.

func ListCashDrawerShiftsBatchRequest

func ListCashDrawerShiftsBatchRequest(token, locationID, beginTime, endTime, order string) (*BatchRequest, string)

ListCashDrawerShiftsBatchRequest returns a BatchRequest object for ListCashDrawerShifts, along with a unique request id.

func ListCategoriesBatchRequest

func ListCategoriesBatchRequest(token, locationID string) (*BatchRequest, string)

ListCategoriesBatchRequest returns a BatchRequest object for ListCategories, along with a unique request id.

func ListDiscountsBatchRequest

func ListDiscountsBatchRequest(token, locationID string) (*BatchRequest, string)

ListDiscountsBatchRequest returns a BatchRequest object for ListDiscounts, along with a unique request id.

func ListEmployeesBatchRequest

func ListEmployeesBatchRequest(token string, order, beginUpdatedAt, endUpdatedAt, beginCreatedAt, endCreatedAt, status, externalID string, limit int) (*BatchRequest, string)

ListEmployeesBatchRequest returns a BatchRequest object for ListEmployees, along with a unique request id.

func ListFeesBatchRequest

func ListFeesBatchRequest(token, locationID string) (*BatchRequest, string)

ListFeesBatchRequest returns a BatchRequest object for ListFees, along with a unique request id.

func ListInventoryBatchRequest

func ListInventoryBatchRequest(token, locationID string, limit int) (*BatchRequest, string)

ListInventoryBatchRequest returns a BatchRequest object for ListInventory, along with a unique request id.

func ListItemsBatchRequest

func ListItemsBatchRequest(token, locationID string) (*BatchRequest, string)

ListItemsBatchRequest returns a BatchRequest object for ListItems, along with a unique request id.

func ListLocationsBatchRequest

func ListLocationsBatchRequest(token string) (*BatchRequest, string)

ListLocationsBatchRequest returns a BatchRequest object for ListLocations, along with a unique request id.

func ListModifierListsBatchRequest

func ListModifierListsBatchRequest(token, locationID string) (*BatchRequest, string)

ListModifierListsBatchRequest returns a BatchRequest object for ListModifierLists, along with a unique request id.

func ListOrdersBatchRequest

func ListOrdersBatchRequest(token, locationID string, limit int, order string) (*BatchRequest, string)

ListOrdersBatchRequest returns a BatchRequest object for ListOrders, along with a unique request id.

func ListPagesBatchRequest

func ListPagesBatchRequest(token, locationID string) (*BatchRequest, string)

ListPagesBatchRequest returns a BatchRequest object for ListPages, along with a unique request id.

func ListPaymentsBatchRequest

func ListPaymentsBatchRequest(token, locationID, beginTime, endTime, order string, limit int) (*BatchRequest, string)

ListPaymentsBatchRequest returns a BatchRequest object for ListPayments, along with a unique request id.

func ListRefundsBatchRequest

func ListRefundsBatchRequest(token, locationID, beginTime, endTime, order string, limit int) (*BatchRequest, string)

ListRefundsBatchRequest returns a BatchRequest object for ListRefunds, along with a unique request id.

func ListRolesBatchRequest

func ListRolesBatchRequest(token, order string, limit int) (*BatchRequest, string)

ListRolesBatchRequest returns a BatchRequest object for ListRoles, along with a unique request id.

func ListSettlementsBatchRequest

func ListSettlementsBatchRequest(token, locationID, beginTime, endTime, order string, limit int, status string) (*BatchRequest, string)

ListSettlementsBatchRequest returns a BatchRequest object for ListSettlements, along with a unique request id.

func ListSubscriptionPlansBatchRequest

func ListSubscriptionPlansBatchRequest(token, clientID string) (*BatchRequest, string)

ListSubscriptionPlansBatchRequest returns a BatchRequest object for ListSubscriptionPlans, along with a unique request id.

func ListSubscriptionsBatchRequest

func ListSubscriptionsBatchRequest(token, clientID, merchantID string, limit int) (*BatchRequest, string)

ListSubscriptionsBatchRequest returns a BatchRequest object for ListSubscriptions, along with a unique request id.

func ListTimecardEventsBatchRequest

func ListTimecardEventsBatchRequest(token, timecardID string) (*BatchRequest, string)

ListTimecardEventsBatchRequest returns a BatchRequest object for ListTimecardEvents, along with a unique request id.

func ListTimecardsBatchRequest

func ListTimecardsBatchRequest(token, order, employeeID, beginClockinTime, endClockinTime, beginClockoutTime, endClockoutTime, beginUpdatedAt, endUpdatedAt string, deleted bool, limit int) (*BatchRequest, string)

ListTimecardsBatchRequest returns a BatchRequest object for ListTimecards, along with a unique request id.

func ListWebhooksBatchRequest

func ListWebhooksBatchRequest(token, locationID string) (*BatchRequest, string)

ListWebhooksBatchRequest returns a BatchRequest object for ListWebhooks, along with a unique request id.

func RemoveFeeBatchRequest

func RemoveFeeBatchRequest(token, locationID, itemID, feeID string) (*BatchRequest, string)

RemoveFeeBatchRequest returns a BatchRequest object for RemoveFee, along with a unique request id.

func RemoveModifierListBatchRequest

func RemoveModifierListBatchRequest(token, locationID, itemID, modifierListID string) (*BatchRequest, string)

RemoveModifierListBatchRequest returns a BatchRequest object for RemoveModifierList, along with a unique request id.

func RetrieveBankAccountBatchRequest

func RetrieveBankAccountBatchRequest(token, locationID, bankAccountID string) (*BatchRequest, string)

RetrieveBankAccountBatchRequest returns a BatchRequest object for RetrieveBankAccount, along with a unique request id.

func RetrieveBusinessBatchRequest

func RetrieveBusinessBatchRequest(token string) (*BatchRequest, string)

RetrieveBusinessBatchRequest returns a BatchRequest object for RetrieveBusiness, along with a unique request id.

func RetrieveCashDrawerShiftBatchRequest

func RetrieveCashDrawerShiftBatchRequest(token, locationID, shiftID string) (*BatchRequest, string)

RetrieveCashDrawerShiftBatchRequest returns a BatchRequest object for RetrieveCashDrawerShift, along with a unique request id.

func RetrieveEmployeeBatchRequest

func RetrieveEmployeeBatchRequest(token, employeeID string) (*BatchRequest, string)

RetrieveEmployeeBatchRequest returns a BatchRequest object for RetrieveEmployee, along with a unique request id.

func RetrieveItemBatchRequest

func RetrieveItemBatchRequest(token, locationID, itemID string) (*BatchRequest, string)

RetrieveItemBatchRequest returns a BatchRequest object for RetrieveItem, along with a unique request id.

func RetrieveModifierListBatchRequest

func RetrieveModifierListBatchRequest(token, locationID, modifierListID string) (*BatchRequest, string)

RetrieveModifierListBatchRequest returns a BatchRequest object for RetrieveModifierList, along with a unique request id.

func RetrieveOrderBatchRequest

func RetrieveOrderBatchRequest(token, locationID, orderID string) (*BatchRequest, string)

RetrieveOrderBatchRequest returns a BatchRequest object for RetrieveOrder, along with a unique request id.

func RetrievePaymentBatchRequest

func RetrievePaymentBatchRequest(token, locationID, paymentID string) (*BatchRequest, string)

RetrievePaymentBatchRequest returns a BatchRequest object for RetrievePayment, along with a unique request id.

func RetrieveRoleBatchRequest

func RetrieveRoleBatchRequest(token, roleID string) (*BatchRequest, string)

RetrieveRoleBatchRequest returns a BatchRequest object for RetrieveRole, along with a unique request id.

func RetrieveSettlementBatchRequest

func RetrieveSettlementBatchRequest(token, locationID, settlementID string) (*BatchRequest, string)

RetrieveSettlementBatchRequest returns a BatchRequest object for RetrieveSettlement, along with a unique request id.

func RetrieveSubscriptionBatchRequest

func RetrieveSubscriptionBatchRequest(token, clientID, subscriptionID string) (*BatchRequest, string)

RetrieveSubscriptionBatchRequest returns a BatchRequest object for RetrieveSubscription, along with a unique request id.

func RetrieveSubscriptionPlanBatchRequest

func RetrieveSubscriptionPlanBatchRequest(token, clientID, planID string) (*BatchRequest, string)

RetrieveSubscriptionPlanBatchRequest returns a BatchRequest object for RetrieveSubscriptionPlan, along with a unique request id.

func RetrieveTimecardBatchRequest

func RetrieveTimecardBatchRequest(token, timecardID string) (*BatchRequest, string)

RetrieveTimecardBatchRequest returns a BatchRequest object for RetrieveTimecard, along with a unique request id.

func UpdateCategoryBatchRequest

func UpdateCategoryBatchRequest(token, locationID, categoryID string, reqObj *UpdateCategoryReqObject) (*BatchRequest, string)

UpdateCategoryBatchRequest returns a BatchRequest object for UpdateCategory, along with a unique request id.

func UpdateCellBatchRequest

func UpdateCellBatchRequest(token, locationID, pageID string, reqObj *UpdateCellReqObject) (*BatchRequest, string)

UpdateCellBatchRequest returns a BatchRequest object for UpdateCell, along with a unique request id.

func UpdateDiscountBatchRequest

func UpdateDiscountBatchRequest(token, locationID, discountID string, reqObj *UpdateDiscountReqObject) (*BatchRequest, string)

UpdateDiscountBatchRequest returns a BatchRequest object for UpdateDiscount, along with a unique request id.

func UpdateEmployeeBatchRequest

func UpdateEmployeeBatchRequest(token, employeeID string, reqObj *UpdateEmployeeReqObject) (*BatchRequest, string)

UpdateEmployeeBatchRequest returns a BatchRequest object for UpdateEmployee, along with a unique request id.

func UpdateFeeBatchRequest

func UpdateFeeBatchRequest(token, locationID, feeID string, reqObj *UpdateFeeReqObject) (*BatchRequest, string)

UpdateFeeBatchRequest returns a BatchRequest object for UpdateFee, along with a unique request id.

func UpdateItemBatchRequest

func UpdateItemBatchRequest(token, locationID, itemID string, reqObj *UpdateItemReqObject) (*BatchRequest, string)

UpdateItemBatchRequest returns a BatchRequest object for UpdateItem, along with a unique request id.

func UpdateModifierListBatchRequest

func UpdateModifierListBatchRequest(token, locationID, modifierListID string, reqObj *UpdateModifierListReqObject) (*BatchRequest, string)

UpdateModifierListBatchRequest returns a BatchRequest object for UpdateModifierList, along with a unique request id.

func UpdateModifierOptionBatchRequest

func UpdateModifierOptionBatchRequest(token, locationID, modifierListID, modifierOptionID string, reqObj *UpdateModifierOptionReqObject) (*BatchRequest, string)

UpdateModifierOptionBatchRequest returns a BatchRequest object for UpdateModifierOption, along with a unique request id.

func UpdateOrderBatchRequest

func UpdateOrderBatchRequest(token, locationID, orderID string, reqObj *UpdateOrderReqObject) (*BatchRequest, string)

UpdateOrderBatchRequest returns a BatchRequest object for UpdateOrder, along with a unique request id.

func UpdatePageBatchRequest

func UpdatePageBatchRequest(token, locationID, pageID string, reqObj *UpdatePageReqObject) (*BatchRequest, string)

UpdatePageBatchRequest returns a BatchRequest object for UpdatePage, along with a unique request id.

func UpdateRoleBatchRequest

func UpdateRoleBatchRequest(token, roleID string, reqObj *UpdateRoleReqObject) (*BatchRequest, string)

UpdateRoleBatchRequest returns a BatchRequest object for UpdateRole, along with a unique request id.

func UpdateTimecardBatchRequest

func UpdateTimecardBatchRequest(token, timecardID string, reqObj *UpdateTimecardReqObject) (*BatchRequest, string)

UpdateTimecardBatchRequest returns a BatchRequest object for UpdateTimecard, along with a unique request id.

func UpdateVariationBatchRequest

func UpdateVariationBatchRequest(token, locationID, itemID, variationID string, reqObj *UpdateVariationReqObject) (*BatchRequest, string)

UpdateVariationBatchRequest returns a BatchRequest object for UpdateVariation, along with a unique request id.

func UpdateWebhooksBatchRequest

func UpdateWebhooksBatchRequest(token, locationID string) (*BatchRequest, string)

UpdateWebhooksBatchRequest returns a BatchRequest object for UpdateWebhooks, along with a unique request id.

type BatchResponse

type BatchResponse struct {
	// The response's HTTP status code.
	StatusCode int `json:"status_code"`
	// Contains any important headers for the response, indexed by header name. For example,
	// if the response includes a pagination header, the
	// header's value is available from headers["Link"].
	Headers interface{} `json:"headers"`
	// The body of the response, if any.
	Body interface{} `json:"body"`
	// The value you provided for request_id in the corresponding BatchRequest, if any.
	RequestID string `json:"request_id"`
	// Specific to this library
	NextRequest *NextRequest `json:"-"`
}

Represents the response for a request included in a call to the Submit Batch endpoint.

func SubmitBatch

func SubmitBatch(token string, batchRequests []*BatchRequest) ([]*BatchResponse, error)

Lets you batch multiple requests to other Connect API endpoints into a single request. This endpoint's response is an array that contains the response for each batched request.

You don't need to provide an access token in the header of your request to the Submit Batch endpoint. Instead, you provide an access_token parameter for each request included in the batch.

Note the following when using the Submit Batch endpoint:

type CashDrawerEvent

type CashDrawerEvent struct {
	// The event's unique ID.
	ID string `json:"id"`
	// The ID of the employee that created the event.
	EmployeeID string `json:"employee_id"`
	// The type of event that occurred, such as CASH_TENDER_PAYMENT or
	// CASH_TENDER_REFUND.
	EventType string `json:"event_type"`
	// The amount of money that was added to or removed from the cash drawer because of the
	// event. This value can be positive (for added money) or negative (for removed money).
	// event_money Money `json:"event_money"`
	// The time when the event occurred, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
	// An optional description of the event, entered by the employee that created it.
	Description string `json:"description"`
}

Represents an event (such as a payment or refund) that involved opening the cash drawer during a cash drawer shift.

type CashDrawerShift

type CashDrawerShift struct {
	// The shift's unique ID.
	ID string `json:"id"`
	// The shift's current state (OPEN, ENDED, or CLOSED).
	CashDrawerState string `json:"cash_drawer_state"`
	// The time when the shift began, in ISO 8601 format.
	OpenedAt string `json:"opened_at"`
	// The time when the shift ended, in ISO 8601 format.
	EndedAt string `json:"ended_at"`
	// The time when the shift was closed, in ISO 8601 format.
	ClosedAt string `json:"closed_at"`
	// The IDs of all employees that were logged into Square Register at some point during the
	// cash drawer shift.
	EmployeeIDs []string `json:"employee_ids"`
	// The ID of the employee that started the cash drawer shift.
	OpeningEmployeeID string `json:"opening_employee_id"`
	// The ID of the employee that ended the cash drawer shift.
	EndingEmployeeID string `json:"ending_employee_id"`
	// The ID of the employee that closed the cash drawer shift by auditing the cash drawer's
	// contents.
	ClosingEmployeeID string `json:"closing_employee_id"`
	// An optional description of the shift, entered by the employee that ended it.
	Description string `json:"description"`
	// The amount of money in the cash drawer at the start of the shift.
	StartingCashMoney Money `json:"starting_cash_money"`
	// The amount of money added to the cash drawer from cash payments.
	CashPaymentMoney Money `json:"cash_payment_money"`
	// The amount of money removed from the cash drawer from cash refunds. This value is
	// always negative or zero.
	CashRefundsMoney Money `json:"cash_refunds_money"`
	// The amount of money added to the cash drawer for reasons other than cash payments.
	CashPaidInMoney Money `json:"cash_paid_in_money"`
	// The amount of money removed from the cash drawer for reasons other than cash
	// refunds.
	CashPaidOutMoney Money `json:"cash_paid_out_money"`
	// The amount of money that should be in the cash drawer at the end of the shift, based on
	// the shift's other money amounts.
	ExpectedCashMoney Money `json:"expected_cash_money"`
	// The amount of money found in the cash drawer at the end of the shift by an auditing
	// employee.
	ClosedCashMoney Money `json:"closed_cash_money"`
	// The device running Square Register that was connected to the cash drawer.
	Device Device `json:"device"`
	// All of the events (payments, refunds, and so on) that involved the cash drawer during
	// the shift.
	Events []CashDrawerEvent `json:"events"`
}

Represents all cash drawer activity that takes place during a single cash drawer shift.

func RetrieveCashDrawerShift

func RetrieveCashDrawerShift(token, locationID, shiftID string) (*CashDrawerShift, error)

Provides the details for a single cash drawer shift, including all events that occurred during the shift.

Required permissions: PAYMENTS_READ

type Category

type Category struct {
	// The category's unique ID.
	ID string `json:"id"`
	// The category's name.
	Name string `json:"name"`
}

Represents an item category.

func CreateCategory

func CreateCategory(token, locationID string, reqObj *CreateCategoryReqObject) (*Category, error)

Creates an item category.

To add or remove an item from a category, use the Update Item endpoint.

Required permissions: ITEMS_WRITE

func UpdateCategory

func UpdateCategory(token, locationID, categoryID string, reqObj *UpdateCategoryReqObject) (*Category, error)

Modifies the details of an existing item category.

To add or remove an item from a category, use the Update Item endpoint.

Required permissions: ITEMS_WRITE

type Coordinates

type Coordinates struct {
	// The latitude coordinate, in degrees.
	Latitude float64 `json:"latitude"`
	// The longitude coordinate, in degrees.
	Longitude float64 `json:"longitude"`
}

Represents geographic coordinates.

type CreateCategoryReqObject

type CreateCategoryReqObject struct {
	// The category's ID. Must be unique among all entity IDs ever provided on behalf of the
	// merchant. You can never reuse an ID. This value can include alphanumeric
	// characters, dashes (-), and underscores (_).If you don't provide this value, an ID is generated by Square.
	ID string `json:"id"`
	// The category's name.
	Name string `json:"name"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateDiscountReqObject

type CreateDiscountReqObject struct {
	// The discount's ID. Must be unique among all entity IDs ever provided on behalf of the
	// merchant. You can never reuse an ID. This value can include alphanumeric
	// characters, dashes (-), and underscores (_).If you don't provide this value, an ID is generated by Square.
	ID string `json:"id"`
	// The discount's name.
	Name string `json:"name"`
	// The rate of the discount, as a string representation of a decimal number. A value of
	// 0.07 corresponds to a rate of 7%. Specify a rate of 0 if discount_type
	// is VARIABLE_PERCENTAGE.Do not include this field for amount-based discounts.
	Rate string `json:"rate"`
	// The amount of the discount. Specify an amount of 0 if discount_type is
	// VARIABLE_AMOUNT.Do not include this field for rate-based discounts.
	AmountMoney Money `json:"amount_money"`
	// Indicates whether the discount is a FIXED value or entered at the time of
	// sale.Default value: FIXED
	DiscountType string `json:"discount_type"`
	// Indicates whether a mobile staff member needs to enter their PIN to apply the discount
	// to a payment.Default value: false
	PinRequired bool `json:"pin_required"`
	// The color of the discount's display label in Square Register.Default value: 9da2a6
	Color string `json:"color"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateEmployeeReqObject

type CreateEmployeeReqObject struct {
	// The employee's first name.
	FirstName string `json:"first_name"`
	// The employee's last name.
	LastName string `json:"last_name"`
	// An optional second ID to associate the employee with an entity in another system.
	ExternalID string `json:"external_id"`
	// The ids of the employee's associated roles. Currently, you can specify only one
	// or zero roles per employee.Default value: []
	RoleIDs []string `json:"role_ids"`
	// An optional email address to associate with the employee.Note that you cannot edit an existing employee's email address with the Connect API.
	// You can only set its initial value when creating an employee.
	Email string `json:"email"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateFeeReqObject

type CreateFeeReqObject struct {
	// The fee's ID. Must be unique among all entity IDs ever provided on behalf of the
	// merchant. You can never reuse an ID. This value can include alphanumeric
	// characters, dashes (-), and underscores (_).If you don't provide this value, an ID is generated by Square.
	ID string `json:"id"`
	// The fee's name.
	Name string `json:"name"`
	// The rate of the fee, as a string representation of a decimal number. A value of
	// 0.07 corresponds to a rate of 7%.
	Rate string `json:"rate"`
	// Whether the fee is calculated based on a payment's subtotal or total.Default value: FEE_SUBTOTAL_PHASE
	CalculationPhase string `json:"calculation_phase"`
	// The type of adjustment the fee applies to a payment. Currently, this value is
	// TAX for all fees.Default value: TAX
	AdjustmentType string `json:"adjustment_type"`
	// If true, the fee applies to custom amounts entered into Square Register that are
	// not associated with a particular item.Default value: true
	AppliesToCustomAmounts bool `json:"applies_to_custom_amounts"`
	// If true, the fee is applied to payments. If false, it isn't.Default value: true
	Enabled bool `json:"enabled"`
	// Whether the fee is ADDITIVE or INCLUSIVE.Default value: ADDITIVE
	InclusionType string `json:"inclusion_type"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateItemReqObject

type CreateItemReqObject struct {
	// The item's ID. Must be unique among all entity IDs ever provided on behalf of the
	// merchant. You can never reuse an ID. This value can include alphanumeric
	// characters, dashes (-), and underscores (_).If you don't provide this value, an ID is generated by Square.
	ID string `json:"id"`
	// The item's name.
	Name string `json:"name"`
	// The item's description.
	Description string `json:"description"`
	// The ID of the item's category, if any.
	CategoryID string `json:"category_id"`
	// The color of the item's display label in Square Register.Default value: 9da2a6
	Color string `json:"color"`
	// The text of the item's display label in Square Register. Only up to the first five
	// characters of the string are used.Default value: The first two characters of the item's name.
	Abbreviation string `json:"abbreviation"`
	// Indicates whether the item is viewable from the merchant's online store (PUBLIC)
	// or PRIVATE.Default value: PUBLIC
	Visibility string `json:"visibility"`
	// If true, the item can be added to shipping orders from the merchant's online
	// store.Default value: false
	AvailableOnline bool `json:"available_online"`
	// If true, the item can be added to pickup orders from the merchant's online
	// store.Default value: false
	AvailableForPickup bool `json:"available_for_pickup"`
	// The item's variations. You must specify at least one variation.
	Variations []ItemVariation `json:"variations"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateModifierListReqObject

type CreateModifierListReqObject struct {
	// The modifier list's ID. Must be unique among all entity IDs ever provided on behalf of
	// the merchant. You can never reuse an ID. This value can include alphanumeric
	// characters, dashes (-), and underscores (_).If you don't provide this value, an ID is generated by Square.
	ID string `json:"id"`
	// The modifier list's name.
	Name string `json:"name"`
	// Indicates whether multiple options from the modifier list can be applied to a single
	// item.Default value: SINGLE
	SelectionType string `json:"selection_type"`
	// The options included in the modifier list. You must include at least one modifier
	// option.
	ModifierOptions []ModifierOption `json:"modifier_options"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateModifierOptionReqObject

type CreateModifierOptionReqObject struct {
	// The modifier option's ID. Must be unique among all entity IDs ever provided on behalf
	// of the merchant. You can never reuse an ID. This value can include alphanumeric
	// characters, dashes (-), and underscores (_).If you don't provide this value, an ID is generated by Square.
	ID string `json:"id"`
	// The modifier option's name.
	Name string `json:"name"`
	// The modifier option's price.
	PriceMoney Money `json:"price_money"`
	// If true, the modifier option is the default option in a modifier list for which
	// selection_type is SINGLE.Default value: false
	OnByDefault bool `json:"on_by_default"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreatePageReqObject

type CreatePageReqObject struct {
	// The page's ID. Must be unique among all entity IDs ever provided on behalf of the
	// merchant. You can never reuse an ID. This value can include alphanumeric
	// characters, dashes (-), and underscores (_).If you don't provide this value, an ID is generated by Square.
	ID string `json:"id"`
	// The page's name.
	Name string `json:"name"`
	// The page's position in the list of pages. Must be an integer between 0 and
	// 4, inclusive.The endpoint returns an error if you specify a page_index that another page is
	// already using.
	PageIndex int `json:"page_index"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateRefundReqObject

type CreateRefundReqObject struct {
	// The ID of the payment to refund.If you're creating a PARTIAL refund for a split tender payment, instead provide
	// the id of the particular tender you want to refund. See Split Tender Payments for details.
	PaymentID string `json:"payment_id"`
	// The type of refund (FULL or PARTIAL).
	Type string `json:"type"`
	// The reason for the refund.
	Reason string `json:"reason"`
	// The amount of money to refund. Required only for PARTIAL refunds.The value of amount must be negative.
	RefundedMoney Money `json:"refunded_money"`
	// An optional key to ensure idempotence if you issue the same PARTIAL refund
	// request more than once.If you attempt to issue a partial refund and you aren't sure whether your request
	// succeeded, you can safely repeat your request with the same
	// request_idempotence_key. If you want to issue another partial refund for
	// the same payment, you must use a request_idempotence_key that is unique among
	// refunds you have issued for the payment.
	RequestIDempotenceKey string `json:"request_idempotence_key"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateRoleReqObject

type CreateRoleReqObject struct {
	// The role's name.
	Name string `json:"name"`
	// The role's permissions.
	Permissions []string `json:"permissions"`
	// If true, employees with this role have all permissions, regardless of the
	// values indicated in permissions.Default value: false
	IsOwner bool `json:"is_owner"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateTimecardReqObject

type CreateTimecardReqObject struct {
	// The employee to create a timecard for.
	EmployeeID string `json:"employee_id"`
	// The clock-in time for the timecard, in ISO 8601 format.Default value: The current time.
	ClockinTime string `json:"clockin_time"`
	// The clock-out time for the timecard, in ISO 8601 format.
	// Provide this value only if importing timecard information from another system.
	ClockoutTime string `json:"clockout_time"`
	// The ID of the location the employee clocked in from, if any.
	ClockinLocationID string `json:"clockin_location_id"`
	// The ID of the location the employee clocked out from. Provide this value only if
	// importing timecard information from another system.If you provide this value, you must also provide a value for clockout_time.
	ClockoutLocationID string `json:"clockout_location_id"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type CreateVariationReqObject

type CreateVariationReqObject struct {
	// The variation's ID. Must be unique among all entity IDs ever provided on behalf of the
	// merchant. You can never reuse an ID. This value can include alphanumeric
	// characters, dashes (-), and underscores (_).If you don't provide this value, an ID is generated by Square.
	ID string `json:"id"`
	// The item variation's name.
	Name string `json:"name"`
	// Indicates whether the item variation's price is fixed or determined at the time of
	// sale.Default value: FIXED_PRICING
	PricingType string `json:"pricing_type"`
	// The item variation's price, if any.
	PriceMoney Money `json:"price_money"`
	// The item variation's SKU, if any.
	Sku string `json:"sku"`
	// If true, inventory tracking is active for the variation.Default value: false
	TrackInventory bool `json:"track_inventory"`
	// Indicates whether the item variation displays an alert when its inventory quantity is
	// less than or equal to its inventory_alert_threshold.Default value: NONE
	InventoryAlertType string `json:"inventory_alert_type"`
	// If the inventory quantity for the variation is less than or equal to this value and
	// inventory_alert_type is LOW_QUANTITY, the variation displays an alert in
	// the merchant dashboard.This value is always an integer.Default value: 0
	InventoryAlertThreshold int `json:"inventory_alert_threshold"`
	// Arbitrary metadata to associate with the variation. Cannot exceed 255 characters.
	UserData string `json:"user_data"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type Device

type Device struct {
	// The device's merchant-specified name.
	Name string `json:"name"`
	// The device's Square-issued ID.
	ID string `json:"id"`
}

Represents a device running Square Register.

type Discount

type Discount struct {
	// The discount's unique ID.
	ID string `json:"id"`
	// The discount's name.
	Name string `json:"name"`
	// The rate of the discount, as a string representation of a decimal number. A value of
	// 0.07 corresponds to a rate of 7%. This rate is 0 if discount_type
	// is VARIABLE_PERCENTAGE.This field is not included for amount-based discounts.
	Rate string `json:"rate"`
	// The amount of the discount. This amount is 0 if discount_type is
	// VARIABLE_AMOUNT.This field is not included for rate-based discounts.
	AmountMoney Money `json:"amount_money"`
	// Indicates whether the discount is a FIXED value or entered at the time of
	// sale.
	DiscountType string `json:"discount_type"`
	// Indicates whether a mobile staff member needs to enter their PIN to apply the discount
	// to a payment.
	PinRequired bool `json:"pin_required"`
	// The color of the discount's display label in Square Register, if not the default color.
	// The default color is 9da2a6.
	Color string `json:"color"`
}

Represents a discount that can be applied to a payment. A discount can be either a percentage or a flat amount. You can determine a particular discount's type by checking which of rate or amount_money is included in the object.

func CreateDiscount

func CreateDiscount(token, locationID string, reqObj *CreateDiscountReqObject) (*Discount, error)

Creates a discount.

Required permissions: ITEMS_WRITE

func UpdateDiscount

func UpdateDiscount(token, locationID, discountID string, reqObj *UpdateDiscountReqObject) (*Discount, error)

Modifies the details of an existing discount.

Required permissions: ITEMS_WRITE

type Employee

type Employee struct {
	// The employee's unique ID.
	ID string `json:"id"`
	// The employee's first name.
	FirstName string `json:"first_name"`
	// The employee's last name.
	LastName string `json:"last_name"`
	// The ids of the employee's associated roles. Currently, you can specify only one
	// or zero roles per employee.
	RoleIDs []string `json:"role_ids"`
	// The IDs of the locations the employee is allowed to clock in at.
	AuthorizedLocationIDs []string `json:"authorized_location_ids"`
	// The employee's email address.You cannot edit this value with the Connect API.
	// You can only set its initial value
	// when creating an employee with the Create Employee endpoint.
	Email string `json:"email"`
	// Whether the employee is ACTIVE or INACTIVE. Inactive employees cannot
	// sign in to Square Register.Merchants update this field from the Square Dashboard.
	// You cannot modify it with the Connect API.
	Status string `json:"status"`
	// An ID the merchant can set to associate the employee with an entity in another
	// system.You cannot set this value with the Connect API.
	ExternalID string `json:"external_id"`
	// The time when the employee entity was created, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
	// The time when the employee entity was most recently updated, in ISO 8601 format.
	UpdatedAt string `json:"updated_at"`
}

Represents one of a business's employees.

func CreateEmployee

func CreateEmployee(token string, reqObj *CreateEmployeeReqObject) (*Employee, error)

Creates an employee for a business.

Required permissions: EMPLOYEES_WRITE

func RetrieveEmployee

func RetrieveEmployee(token, employeeID string) (*Employee, error)

Provides the details for a single employee.

Required permissions: EMPLOYEES_READ

func UpdateEmployee

func UpdateEmployee(token, employeeID string, reqObj *UpdateEmployeeReqObject) (*Employee, error)

Modifies the details of an employee.

Required permissions: EMPLOYEES_WRITE

type EmployeeRole

type EmployeeRole struct {
	// The role's unique ID.
	ID string `json:"id"`
	// The role's merchant-defined name.
	Name string `json:"name"`
	// The permissions that the role has been granted.
	Permissions []string `json:"permissions"`
	// If true, employees with this role have all permissions, regardless of the
	// values indicated in permissions.
	IsOwner bool `json:"is_owner"`
	// The time when the role was created, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
	// The time when the role was most recently updated, in ISO 8601 format.
	UpdatedAt string `json:"updated_at"`
}

Represents a role that can be assigned to one or more employees. An employee's role indicates which permissions they have.

func CreateRole

func CreateRole(token string, reqObj *CreateRoleReqObject) (*EmployeeRole, error)

Creates an employee role you can then assign to employees.

Required permissions: EMPLOYEES_WRITE

func RetrieveRole

func RetrieveRole(token, roleID string) (*EmployeeRole, error)

Provides the details for a single employee role.

Required permissions: EMPLOYEES_READ

func UpdateRole

func UpdateRole(token, roleID string, reqObj *UpdateRoleReqObject) (*EmployeeRole, error)

Modifies the details of an employee role.

Required permissions: EMPLOYEES_WRITE

type Fee

type Fee struct {
	// The fee's unique ID.
	ID string `json:"id"`
	// The fee's name.
	Name string `json:"name"`
	// The rate of the fee, as a string representation of a decimal number. A value of
	// 0.07 corresponds to a rate of 7%.
	Rate string `json:"rate"`
	// Forthcoming.
	CalculationPhase string `json:"calculation_phase"`
	// The type of adjustment the fee applies to a payment. Currently, this value is
	// TAX for all fees.
	AdjustmentType string `json:"adjustment_type"`
	// If true, the fee applies to custom amounts entered into Square Register that are
	// not associated with a particular item.
	AppliesToCustomAmounts bool `json:"applies_to_custom_amounts"`
	// If true, the fee is applied to all appropriate items. If false, the fee
	// is not applied at all.
	Enabled bool `json:"enabled"`
	// Whether the fee is ADDITIVE or INCLUSIVE.
	InclusionType string `json:"inclusion_type"`
	// In countries with multiple classifications for sales taxes, indicates which
	// classification the fee falls under. Currently relevant only to Canadian merchants.
	Type string `json:"type"`
}

Represents a tax or other fee that can be applied to a payment.

func CreateFee

func CreateFee(token, locationID string, reqObj *CreateFeeReqObject) (*Fee, error)

Creates a fee (tax).

Required permissions: ITEMS_WRITE

func UpdateFee

func UpdateFee(token, locationID, feeID string, reqObj *UpdateFeeReqObject) (*Fee, error)

Modifies the details of an existing fee (tax).

Required permissions: ITEMS_WRITE

type GlobalAddress

type GlobalAddress struct {
	// The first line of the address.Fields that start with address_line provide
	// the address's most specific details,
	// like street number, street name, and building name. They do not provide less
	// specific details like city, state/province, or country (these details are provided in
	// other fields).
	AddressLine1 string `json:"address_line_1"`
	// The second line of the address, if any.
	AddressLine2 string `json:"address_line_2"`
	// The third line of the address, if any.
	AddressLine3 string `json:"address_line_3"`
	// The fourth line of the address, if any.
	AddressLine4 string `json:"address_line_4"`
	// The fifth line of the address, if any.
	AddressLine5 string `json:"address_line_5"`
	// The city or town of the address.
	Locality string `json:"locality"`
	// A civil region within the address's locality, if any.
	Sublocality string `json:"sublocality"`
	// A civil region within the address's sublocality, if any.
	Sublocality1 string `json:"sublocality_1"`
	// A civil region within the address's sublocality_1, if any.
	Sublocality2 string `json:"sublocality_2"`
	// A civil region within the address's sublocality_2, if any.
	Sublocality3 string `json:"sublocality_3"`
	// A civil region within the address's sublocality_3, if any.
	Sublocality4 string `json:"sublocality_4"`
	// A civil region within the address's sublocality_4, if any.
	Sublocality5 string `json:"sublocality_5"`
	// A civil entity within the address's country. In the United States, this is the
	// state.
	AdministrativeDistrictLevel1 string `json:"administrative_district_level_1"`
	// A civil entity within the address's administrative_district_level_1, if any. In
	// the United States, this is the county.
	AdministrativeDistrictLevel2 string `json:"administrative_district_level_2"`
	// A civil entity within the address's administrative_district_level_2, if any.
	AdministrativeDistrictLevel3 string `json:"administrative_district_level_3"`
	// The address's postal code.
	PostalCode string `json:"postal_code"`
	// The address's country, in ISO 3166-1-alpha-2 format.
	CountryCode string `json:"country_code"`
	// The coordinates of the address.
	AddressCoordinates Coordinates `json:"address_coordinates"`
}

A generic representation of a physical address.

type InventoryEntry

type InventoryEntry struct {
	// The variation that the entry corresponds to.
	VariationID string `json:"variation_id"`
	// The current available quantity of the item variation.
	QuantityOnHand int `json:"quantity_on_hand"`
}

Represents inventory information for one of a merchant's item variations.

func AdjustInventory

func AdjustInventory(token, locationID, variationID string, reqObj *AdjustInventoryReqObject) (*InventoryEntry, error)

Adjusts an item variation's current available inventory.

See Managing inventory to learn how to enable an item variation for inventory tracking.

Required permissions: ITEMS_WRITE

type Item

type Item struct {
	// The item's unique ID.
	ID string `json:"id"`
	// The item's name.
	Name string `json:"name"`
	// The item's description, if any.
	Description string `json:"description"`
	// The item's type. This value is NORMAL for almost all items.
	Type string `json:"type"`
	// The text of the item's display label in Square Register. This value is present only if
	// an abbreviation other than the default has been set.
	Abbreviation string `json:"abbreviation"`
	// The color of the item's display label in Square Register, if not the default color.
	// The default color is 9da2a6.
	Color string `json:"color"`
	// Indicates whether the item is viewable in the merchant's online store (PUBLIC)
	// or PRIVATE.
	Visibility string `json:"visibility"`
	// If true, the item is available for purchase from the merchant's online
	// store.
	AvailableOnline bool `json:"available_online"`
	// The item's master image, if any.
	MasterImage ItemImage `json:"master_image"`
	// The category the item belongs to, if any.
	Category Category `json:"category"`
	// The item's variations.
	Variations []ItemVariation `json:"variations"`
	// The modifier lists that apply to the item, if any.
	ModifierLists []ModifierList `json:"modifier_lists"`
	// The fees that apply to the item, if any.
	Fees []Fee `json:"fees"`
	// Deprecated. This field is not used.
	Taxable bool `json:"taxable"`
}

Represents a merchant's item.

func ApplyFee

func ApplyFee(token, locationID, itemID, feeID string) (*Item, error)

Associates a fee with an item, meaning the fee is automatically applied to the item in Square Register.

Required permissions: ITEMS_WRITE

func ApplyModifierList

func ApplyModifierList(token, locationID, itemID, modifierListID string) (*Item, error)

Associates a modifier list with an item, meaning modifier options from the list can be applied to the item.

Required permissions: ITEMS_WRITE

func CreateItem

func CreateItem(token, locationID string, reqObj *CreateItemReqObject) (*Item, error)

Creates an item and at least one variation for it.

Required permissions: ITEMS_WRITE

func RetrieveItem

func RetrieveItem(token, locationID, itemID string) (*Item, error)

Provides the details for a single item, including associated modifier lists and fees.

Required permissions: ITEMS_READ

func UpdateItem

func UpdateItem(token, locationID, itemID string, reqObj *UpdateItemReqObject) (*Item, error)

Modifies the core details of an existing item.

If you want to modify an item's variations, use the Update Variation endpoint instead.

If you want to add or remove a modifier list from an item, use the Apply Modifier List and Remove Modifier List endpoints instead.

If you want to add or remove a fee from an item, use the Apply Fee and Remove Fee endpoints instead.

Required permissions: ITEMS_WRITE

type ItemImage

type ItemImage struct {
	// The image's unique ID.
	ID string `json:"id"`
	// The image's publicly accessible URL.
	Url string `json:"url"`
}

Represents an image of an item.

func UploadItemImage

func UploadItemImage(token, locationID, itemID, imageName, imageMime string, body io.Reader) (*ItemImage, error)

Uploads a JPEG or PNG image and sets it as the master image for an item. See this article for recommended specifications for item images.

If you upload an image for an item that already has a master image, the new image replaces the existing one.

Important: Requests to this endpoint use the Content-Type: multipart/form-data header instead of Content-Type: application/json. It's recommended that you use an HTTP library (such as Requests for Python) that simplifies the process for sending multipart/form-data requests.

The example request body shown assumes that you've set your request's multipart boundary to BOUNDARY in your Content-Type header, like so:

Content-Type: multipart/form-data; boundary=BOUNDARY

Note that some HTTP libraries set your request's multipart boundary for you.

Required permissions: ITEMS_WRITE

type ItemVariation

type ItemVariation struct {
	// The item variation's unique ID.
	ID string `json:"id"`
	// The item variation's name.
	Name string `json:"name"`
	// The ID of the variation's associated item.
	ItemID string `json:"item_id"`
	// Indicates the variation's list position when displayed in Square Register and the
	// merchant dashboard. If more than one variation for the same item has the same
	// ordinal value, those variations are displayed in alphabetical order.
	// An item's variation with the lowest ordinal value is displayed first.
	Ordinal int `json:"ordinal"`
	// Indicates whether the item variation's price is fixed or determined at the time of
	// sale.
	PricingType string `json:"pricing_type"`
	// The item variation's price, if any.
	PriceMoney Money `json:"price_money"`
	// The item variation's SKU, if any.
	Sku string `json:"sku"`
	// If true, inventory tracking is active for the variation.
	TrackInventory bool `json:"track_inventory"`
	// Indicates whether the item variation displays an alert when its inventory quantity is
	// less than or equal to its inventory_alert_threshold.
	InventoryAlertType string `json:"inventory_alert_type"`
	// If the inventory quantity for the variation is less than or equal to this value and
	// inventory_alert_type is LOW_QUANTITY, the variation displays an alert in
	// the merchant dashboard.This value is always an integer.
	InventoryAlertThreshold int `json:"inventory_alert_threshold"`
	// Arbitrary metadata associated with the variation. Cannot exceed 255 characters.
	UserData string `json:"user_data"`
}

Represents a variation of an Item. Every item has at least one variation.

func CreateVariation

func CreateVariation(token, locationID, itemID string, reqObj *CreateVariationReqObject) (*ItemVariation, error)

Creates an item variation for an existing item.

Required permissions: ITEMS_WRITE

func UpdateVariation

func UpdateVariation(token, locationID, itemID, variationID string, reqObj *UpdateVariationReqObject) (*ItemVariation, error)

Modifies the details of an existing item variation.

Required permissions: ITEMS_WRITE

type Merchant

type Merchant struct {
	// The merchant account's unique identifier.
	ID string `json:"id"`
	// The name associated with the merchant account.
	Name string `json:"name"`
	// The email address associated with the merchant account.
	Email string `json:"email"`
	// Indicates whether the merchant account corresponds to a single-location account
	// (LOCATION) or a business account (BUSINESS). This value is almost always
	// LOCATION. See Multi-Location
	// Overview for more information.
	AccountType string `json:"account_type"`
	// Capabilities that are enabled for the merchant's Square account. Capabilities that are
	// not listed in this array are not enabled for the account. Currently there is only one
	// capability, CREDIT_CARD_PROCESSING.
	AccountCapabilities []string `json:"account_capabilities"`
	// The country associated with the merchant account, in ISO 3166-1-alpha-2
	// format.
	CountryCode string `json:"country_code"`
	// The language associated with the merchant account, in BCP 47 format.
	LanguageCode string `json:"language_code"`
	// The currency associated with the merchant account, in ISO 4217
	// format. For example, the currency code for US dollars is USD.
	CurrencyCode string `json:"currency_code"`
	// The name of the merchant's business.
	BusinessName string `json:"business_name"`
	// The address of the merchant's business.
	BusinessAddress GlobalAddress `json:"business_address"`
	// The phone number of the merchant's business.
	BusinessPhone PhoneNumber `json:"business_phone"`
	// The type of business operated by the merchant.
	BusinessType string `json:"business_type"`
	// The merchant's shipping address.
	ShippingAddress GlobalAddress `json:"shipping_address"`
	// Additional information for a single-location account specified by its associated
	// business account, if it has one.Never included in Merchant objects with the account_type
	// BUSINESS.
	LocationDetails MerchantLocationDetails `json:"location_details"`
	// The URL of the merchant's online store.
	MarketUrl string `json:"market_url"`
}

Represents a Square merchant account.

func RetrieveBusiness

func RetrieveBusiness(token string) (*Merchant, error)

Provides a business's account information, such as its name and associated email address.

Required permissions: MERCHANT_PROFILE_READ

type MerchantLocationDetails

type MerchantLocationDetails struct {
	// The nickname assigned to the single-location account by the parent business. This value
	// appears in the parent business's multi-location dashboard.
	Nickname string `json:"nickname"`
}

Represents additional details for a single-location account as specified by its parent business.

type ModifierList

type ModifierList struct {
	// The modifier list's unique ID.
	ID string `json:"id"`
	// The modifier list's name.
	Name string `json:"name"`
	// Indicates whether MULTIPLE options or a SINGLE option from the modifier
	// list can be applied to a single item.
	SelectionType string `json:"selection_type"`
	// The options included in the modifier list.
	ModifierOptions []string `json:"modifier_options"`
}

Represents an item modifier list.

func CreateModifierList

func CreateModifierList(token, locationID string, reqObj *CreateModifierListReqObject) (*ModifierList, error)

Creates an item modifier list and at least one modifier option for it.

Required permissions: ITEMS_WRITE

func RetrieveModifierList

func RetrieveModifierList(token, locationID, modifierListID string) (*ModifierList, error)

Provides the details for a single modifier list.

Required permissions: ITEMS_READ

func UpdateModifierList

func UpdateModifierList(token, locationID, modifierListID string, reqObj *UpdateModifierListReqObject) (*ModifierList, error)

Modifies the details of an existing item modifier list.

If you want to modify the details of a single modifier option, use the Update Modifier Option endpoint instead.

Required permissions: ITEMS_WRITE

type ModifierOption

type ModifierOption struct {
	// The modifier option's unique ID.
	ID string `json:"id"`
	// The modifier option's name.
	Name string `json:"name"`
	// The modifier option's price.
	PriceMoney Money `json:"price_money"`
	// If true, the modifier option is the default option in a modifier list for which
	// selection_type is SINGLE.
	OnByDefault bool `json:"on_by_default"`
	// Indicates the modifier option's list position when displayed in Square Register and the
	// merchant dashboard. If more than one modifier option in the same modifier list has the
	//same ordinal value, those options are displayed in alphabetical order.
	// A modifier list's option with the lowest ordinal value is displayed first.
	Ordinal int `json:"ordinal"`
	// The ID of the modifier list the option belongs to.
	ModifierListID string `json:"modifier_list_id"`
}

Represents an item modifier option.

func CreateModifierOption

func CreateModifierOption(token, locationID, modifierListID string, reqObj *CreateModifierOptionReqObject) (*ModifierOption, error)

Creates an item modifier option and adds it to a modifier list.

Required permissions: ITEMS_WRITE

func UpdateModifierOption

func UpdateModifierOption(token, locationID, modifierListID, modifierOptionID string, reqObj *UpdateModifierOptionReqObject) (*ModifierOption, error)

Modifies the details of an existing item modifier option.

Required permissions: ITEMS_WRITE

type Money

type Money struct {
	// The amount of money, in the smallest unit of the applicable currency. For US dollars,
	// this value is in cents.This value is always an integer.
	Amount int `json:"amount"`
	// The type of currency involved in the current payment, in ISO 4217 format. For example, the
	// currency code for US dollars is USD.
	CurrencyCode string `json:"currency_code"`
}

Represents an amount of money. When you provide this object in a request, currency_code must match the currency associated with the merchant's Square account.

type NextRequest

type NextRequest struct {
	// contains filtered or unexported fields
}

func ListWebhooks

func ListWebhooks(token, locationID string) ([]string, *NextRequest, error)

Lists which types of events trigger webhook notifications for a particular location.

func UpdateWebhooks

func UpdateWebhooks(token, locationID string) ([]string, *NextRequest, error)

Sets which types of events trigger webhook notifications for a location.

Simply provide a JSON array of the event types you want notifications for in your request body (see Example Requests below).

func (*NextRequest) GetNextRequest

func (nr *NextRequest) GetNextRequest(result interface{}) (*NextRequest, error)

func (*NextRequest) GetNextRequestAsBatchRequest

func (nr *NextRequest) GetNextRequestAsBatchRequest(result interface{}) (*BatchRequest, string)

type Order

type Order struct {
	// The order's unique identifier.
	ID string `json:"id"`
	// The order's current state, such as OPEN or COMPLETED.
	State string `json:"state"`
	// The email address of the order's buyer.
	BuyerEmail string `json:"buyer_email"`
	// The name of the order's buyer.
	RecipientName string `json:"recipient_name"`
	// The phone number to use for the order's delivery.
	RecipientPhoneNumber string `json:"recipient_phone_number"`
	// The address to ship the order to.
	ShippingAddress GlobalAddress `json:"shipping_address"`
	// The amount of all items purchased in the order, before taxes and shipping.
	SubtotalMoney Money `json:"subtotal_money"`
	// The shipping cost for the order.
	TotalShippingMoney Money `json:"total_shipping_money"`
	// The total of all taxes applied to the order.
	TotalTaxMoney Money `json:"total_tax_money"`
	// The total cost of the order.
	TotalPriceMoney Money `json:"total_price_money"`
	// The total of all discounts applied to the order.
	TotalDiscountMoney Money `json:"total_discount_money"`
	// The time when the order was created, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
	// The time when the order was last modified, in ISO 8601 format.
	UpdatedAt string `json:"updated_at"`
	// The time when the order expires if no action is taken, in ISO 8601 format.
	ExpiresAt string `json:"expires_at"`
	// The unique identifier of the payment associated with the order.
	PaymentID string `json:"payment_id"`
	// A note provided by the buyer when the order was created, if any.
	BuyerNote string `json:"buyer_note"`
	// A note provided by the merchant when the order's state was set to COMPLETED, if any.
	CompletedNote string `json:"completed_note"`
	// A note provided by the merchant when the order's state was set to REFUNDED, if any.
	RefundedNote string `json:"refunded_note"`
	// A note provided by the merchant when the order's state was set to CANCELED, if any.
	CanceledNote string `json:"canceled_note"`
	// The tender used to pay for the order.
	Tender Tender `json:"tender"`
	// The history of actions associated with the order.
	OrderHistory []OrderHistoryEntry `json:"order_history"`
	// The promo code provided by the buyer, if any.
	PromoCode string `json:"promo_code"`
	// For Bitcoin transactions, the address that the buyer sent Bitcoin to.
	BtcReceiveAddress string `json:"btc_receive_address"`
	// For Bitcoin transactions, the price of the buyer's order in satoshi (100 million
	// satoshi equals 1 BTC).
	BtcPriceSatoshi int `json:"btc_price_satoshi"`
}

Represents an order from a merchant's online store.

func RetrieveOrder

func RetrieveOrder(token, locationID, orderID string) (*Order, error)

func UpdateOrder

func UpdateOrder(token, locationID, orderID string, reqObj *UpdateOrderReqObject) (*Order, error)

type OrderHistoryEntry

type OrderHistoryEntry struct {
	// The type of action performed on the order.
	Action string `json:"action"`
	// The time when the action was performed, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
}

Represents a prior action performed on an online store order.

type Page

type Page struct {
	// The page's unique identifier.
	ID string `json:"id"`
	// The page's name, if any.
	Name string `json:"name"`
	// The page's position in the merchant's list of pages. Always an integer between 0 and 4,
	// inclusive.
	PageIndex int `json:"page_index"`
	// The cells included on the page.
	Cells []PageCell `json:"cells"`
}

Represents a Favorites page in the iPad version of Square Register.

func CreatePage

func CreatePage(token, locationID string, reqObj *CreatePageReqObject) (*Page, error)

Creates a Favorites page in Square Register.

A merchant can have up to five pages, each of which has a page_index between 0 and 4, inclusive.

After you create a page, you can set the values of its cells with the Update Cell endpoint. A page doesn't appear in Square Register unless at least one of its cells has an assigned value.

Required permissions: ITEMS_WRITE

func UpdatePage

func UpdatePage(token, locationID, pageID string, reqObj *UpdatePageReqObject) (*Page, error)

Modifies the details of a Favorites page in Square Register.

Required permissions: ITEMS_WRITE

type PageCell

type PageCell struct {
	// The unique identifier of the page the cell is included on.
	PageID string `json:"page_id"`
	// The row of the cell. Always an integer between 0 and 4, inclusive.
	Row int `json:"row"`
	// The column of the cell. Always an integer between 0 and 4, inclusive.
	Column int `json:"column"`
	// The type of entity represented in the cell (ITEM, DISCOUNT,
	// CATEGORY, or PLACEHOLDER).
	ObjectType string `json:"object_type"`
	// The unique identifier of the entity represented in the cell. Not present for cells with
	// an object_type of PLACEHOLDER.
	ObjectID string `json:"object_id"`
	// For a cell with an object_type of PLACEHOLDER, this value indicates the cell's
	// special behavior.
	PlaceholderType string `json:"placeholder_type"`
}

Represents a cell of a Page.

func UpdateCell

func UpdateCell(token, locationID, pageID string, reqObj *UpdateCellReqObject) (*PageCell, error)

Modifies a cell of a Favorites page in Square Register.

Required permissions: ITEMS_WRITE

type Payment

type Payment struct {
	// The payment's unique identifier.
	ID string `json:"id"`
	// The unique identifier of the merchant that took the payment.
	MerchantID string `json:"merchant_id"`
	// The time when the payment was created, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
	// The unique identifier of the Square account that took the payment.
	// This value can differ from merchant_id if the merchant has mobile staff.
	CreatorID string `json:"creator_id"`
	// The device that took the payment.
	Device Device `json:"device"`
	// The URL of the payment's detail page in the merchant dashboard.
	// The merchant must be signed in to the merchant dashboard to view this page.
	PaymentUrl string `json:"payment_url"`
	// The URL of the receipt for the payment.Note that for split tender payments, this URL
	// corresponds to the receipt for the first tender listed in the payment's
	// tender field. Each Tender object has its own receipt_url field you can use
	// to get the other receipts associated with a split tender payment.
	ReceiptUrl string `json:"receipt_url"`
	// The sum of all inclusive taxes associated with the payment.
	InclusiveTaxMoney Money `json:"inclusive_tax_money"`
	// The sum of all additive taxes associated with the payment.
	AdditiveTaxMoney Money `json:"additive_tax_money"`
	// The total of all taxes applied to the payment.
	// This is always the sum of inclusive_tax_money and additive_tax_money.
	TaxMoney Money `json:"tax_money"`
	// The total of all tips applied to the payment.
	TipMoney Money `json:"tip_money"`
	// The total of all discounts applied to the payment.This value is always 0 or negative.
	DiscountMoney Money `json:"discount_money"`
	// The total amount of money collected from the buyer for the payment.
	TotalCollectedMoney Money `json:"total_collected_money"`
	// The total of all processing fees collected by Square for the payment.
	// This value is always 0 or negative.
	ProcessingFeeMoney Money `json:"processing_fee_money"`
	// The amount to be deposited into the merchant's bank account for the payment.
	// This is always the sum of total_collected_money and processing_fee_money
	// (note that processing_fee_money is always negative or 0).
	NetTotalMoney Money `json:"net_total_money"`
	// The total of all refunds applied to the payment.
	RefundedMoney Money `json:"refunded_money"`
	// All of the inclusive taxes associated with the payment.
	InclusiveTax []PaymentTax `json:"inclusive_tax"`
	// All of the additive taxes associated with the payment.
	AdditiveTax []PaymentTax `json:"additive_tax"`
	// The form(s) of tender provided by the buyer for the payment.
	Tender []Tender `json:"tender"`
	// All of the refunds applied to the payment.
	Refunds []Refund `json:"refunds"`
	// The items purchased in the payment.
	Itemizations []PaymentItemization `json:"itemizations"`
}

Represents a payment taken by a Square merchant.

func RetrievePayment

func RetrievePayment(token, locationID, paymentID string) (*Payment, error)

Provides comprehensive information for a single payment.

Required permissions: PAYMENTS_READ

type PaymentDiscount

type PaymentDiscount struct {
	// The discount's name.
	Name string `json:"name"`
	// The amount of money that this discount adds to the payment (note that this value is
	// always negative or zero).
	AppliedMoney Money `json:"applied_money"`
	// The ID of the applied discount, if available. Discounts applied in older versions of
	// Square Register might not have an ID.
	DiscountID string `json:"discount_id"`
}

Represents a discount applied to an itemization in a payment.

type PaymentItemDetail

type PaymentItemDetail struct {
	// The name of the item's merchant-defined category, if any.
	CategoryName string `json:"category_name"`
	// The item's merchant-defined SKU, if any.
	Sku string `json:"sku"`
	// The unique ID of the item purchased, if any.
	ItemID string `json:"item_id"`
	// The unique ID of the item variation purchased, if any.
	ItemVariationID string `json:"item_variation_id"`
}

Represents details of an item purchased in a payment.

type PaymentItemization

type PaymentItemization struct {
	// The item's name.
	Name string `json:"name"`
	// The quantity of the item purchased. This can be a decimal value.
	Quantity float64 `json:"quantity"`
	// The type of purchase that the itemization represents, such as an ITEM or
	// CUSTOM_AMOUNT.
	ItemizationType string `json:"itemization_type"`
	// Details of the item, including its unique identifier and the identifier of the item
	// variation purchased.
	ItemDetail PaymentItemDetail `json:"item_detail"`
	// Notes entered by the merchant about the item at the time of payment, if any.
	Notes string `json:"notes"`
	// The name of the item variation purchased, if any.
	ItemVariationName string `json:"item_variation_name"`
	// The total cost of the item, including all taxes and discounts.
	TotalMoney Money `json:"total_money"`
	// The cost of a single unit of this item.
	SingleQuantityMoney Money `json:"single_quantity_money"`
	// The total cost of the itemization and its modifiers, not including taxes or
	// discounts.
	GrossSalesMoney Money `json:"gross_sales_money"`
	// The total of all discounts applied to the itemization. This value is always negative or
	// zero.
	DiscountMoney Money `json:"discount_money"`
	// The sum of gross_sales_money and discount_money.
	NetSalesMoney Money `json:"net_sales_money"`
	// All taxes applied to this itemization.
	Taxes []PaymentTax `json:"taxes"`
	// All discounts applied to this itemization.
	Discounts []PaymentDiscount `json:"discounts"`
	// All modifier options applied to this itemization.
	Modifiers []PaymentModifier `json:"modifiers"`
}

Represents an item, custom monetary amount, or other entity purchased as part of a payment.

type PaymentModifier

type PaymentModifier struct {
	// The modifier option's name.
	Name string `json:"name"`
	// The amount of money that this modifier option adds to the payment.
	AppliedMoney Money `json:"applied_money"`
	// The ID of the applied modifier option, if available. Modifier options applied in older
	// versions of Square Register might not have an ID.
	ModifierOptionID string `json:"modifier_option_id"`
}

Represents a modifier option applied to an itemization in a payment.

type PaymentTax

type PaymentTax struct {
	// The merchant-defined name of the tax.
	Name string `json:"name"`
	// The amount of money that this tax adds to the payment.
	AppliedMoney Money `json:"applied_money"`
	// The rate of the tax, as a string representation of a decimal number. A value of
	// 0.07 corresponds to a rate of 7%.
	Rate string `json:"rate"`
	// Whether the tax is an ADDITIVE tax or an INCLUSIVE tax.
	InclusionType string `json:"inclusion_type"`
	// The ID of the tax, if available. Taxes applied in older versions of Square Register
	// might not have an ID.
	FeeID string `json:"fee_id"`
}

Represents a single tax applied to a payment.

type PhoneNumber

type PhoneNumber struct {
	// The phone number's international calling code.
	// For US phone numbers, this value is +1.
	CallingCode string `json:"calling_code"`
	// The phone number.
	Number string `json:"number"`
}

Represents a phone number.

type Refund

type Refund struct {
	// The type of refund (FULL or PARTIAL).
	Type string `json:"type"`
	// The merchant-specified reason for the refund.
	Reason string `json:"reason"`
	// The amount of money refunded. This amount is always negative.
	RefundedMoney Money `json:"refunded_money"`
	// The time when the merchant initiated the refund for Square to process, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
	// The time when Square processed the refund on behalf of the merchant, in ISO 8601 format.
	ProcessedAt string `json:"processed_at"`
	// The Square-issued ID of the payment the refund is applied to.
	PaymentID string `json:"payment_id"`
}

Represents a refund initiated by a Square merchant.

func CreateRefund

func CreateRefund(token, locationID string, reqObj *CreateRefundReqObject) (*Refund, error)

Issues a refund for a previously processed payment. You must issue a refund within 60 days of the associated payment. See this article for more information on refund behavior.

Issuing a refund for a card payment is not reversible. To develop against this endpoint, you can create fake cash payments in Square Register and refund them.

You can issue either full refunds or partial refunds. If you issue a partial refund, you must specify the amount of money to refund.

Required permissions: PAYMENTS_WRITE

type Settlement

type Settlement struct {
	// The settlement's unique identifier.
	ID string `json:"id"`
	// The settlement's current status.
	Status string `json:"status"`
	// The time when the settlement was submitted for deposit or withdrawal, in ISO 8601 format.
	InitiatedAt string `json:"initiated_at"`
	// The Square-issued unique identifier for the bank account associated with the
	// settlement.
	BankAccountID string `json:"bank_account_id"`
	// The amount of money involved in the settlement. A positive amount indicates a deposit,
	// and a negative amount indicates a withdrawal. This amount is never zero.
	TotalMoney Money `json:"total_money"`
	// The entries included in this settlement.
	Entries []SettlementEntry `json:"entries"`
}

Represents a deposit or withdrawal made by Square to a merchant's bank account.

func RetrieveSettlement

func RetrieveSettlement(token, locationID, settlementID string) (*Settlement, error)

Provides comprehensive information for a single settlement, including the entries that contribute to the settlement's total.

See SettlementEntry.Type for descriptions of the types of entries that compose a settlement.

Required permissions: SETTLEMENTS_READ

type SettlementEntry

type SettlementEntry struct {
	// The type of activity this entry represents.
	Type string `json:"type"`
	// The payment associated with the settlement entry, if any.
	PaymentID string `json:"payment_id"`
	// The total amount of money this entry contributes to the total settlement amount.
	AmountMoney Money `json:"amount_money"`
	// The amount of all Square fees associated with this settlement entry. This value is
	// always negative or zero.This amount has already been applied to amount_money.
	FeeMoney Money `json:"fee_money"`
}

Represents a single entry in a Settlement.

type SubmitBatchReqObject

type SubmitBatchReqObject struct {
	// The requests to perform.
	Requests []*BatchRequest `json:"requests"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type Subscription

type Subscription struct {
	// The subscription's unique ID.
	ID string `json:"id"`
	// The ID of the merchant with the subscription.
	MerchantID string `json:"merchant_id"`
	// The ID of the SubscriptionPlan the subscription belongs to.
	PlanID string `json:"plan_id"`
	// The subscription's status, such as active or canceled.
	Status string `json:"status"`
	// The method of payment used to pay the subscription's monthly fee.
	PaymentMethod string `json:"payment_method"`
	// The subscription's base monthly fee.
	FeeBaseMoney Money `json:"fee_base_money"`
	// The date when the subscription most recently became active, in YYYY-MM-DD format.
	ServiceStartDate string `json:"service_start_date"`
	// The history of subscription fees paid or pending for this subscription, in reverse
	// chronological order (newest first).
	Fees []SubscriptionFee `json:"fees"`
}

Represents a merchant's subscription to an application.

func RetrieveSubscription

func RetrieveSubscription(token, clientID, subscriptionID string) (*Subscription, error)

Provides comprehensive information for a single subscription, including its payment history.

Important: The Authorization header you provide to this endpoint must have the following format:

type SubscriptionFee

type SubscriptionFee struct {
	// The date when the subscription fee was charged, in YYYY-MM-DD format.
	FeeDate string `json:"fee_date"`
	// The payment status of the subscription fee, such as PENDING or PAID.
	FeeStatus string `json:"fee_status"`
	// The subscription fee's base amount.
	FeeBaseMoney Money `json:"fee_base_money"`
	// The total of all taxes applied to the subscription fee.
	FeeTaxMoney Money `json:"fee_tax_money"`
	// The subscription fee's total amount.
	// This is always the sum of fee_base_money and fee_tax_money.
	FeeTotalMoney Money `json:"fee_total_money"`
}

Represents a single fee charged to a merchant for a Subscription.

type SubscriptionPlan

type SubscriptionPlan struct {
	// The plan's unique ID.
	ID string `json:"id"`
	// The plan's name.
	Name string `json:"name"`
	// The country the plan applies to, in ISO 3166-1-alpha-2 format.
	CountryCode string `json:"country_code"`
	// The plan's base monthly fee.
	FeeBaseMoney Money `json:"fee_base_money"`
}

Represents an application subscription plan.

func RetrieveSubscriptionPlan

func RetrieveSubscriptionPlan(token, clientID, planID string) (*SubscriptionPlan, error)

type Tender

type Tender struct {
	// The tender's unique ID.
	ID string `json:"id"`
	// The type of tender.
	Type string `json:"type"`
	// A human-readable description of the tender.
	Name string `json:"name"`
	// The ID of the employee that processed the tender.
	// This field is included only if the associated merchant had employee
	// management features enabled at the time the tender was processed.
	EmployeeID string `json:"employee_id"`
	// The URL of the receipt for the tender.
	ReceiptUrl string `json:"receipt_url"`
	// The brand of credit card provided.Only present if the tender's type is CREDIT_CARD.
	CardBrand string `json:"card_brand"`
	// The last four digits of the provided credit card's account number.
	// Only present if the tender's type is CREDIT_CARD.
	PanSuffix string `json:"pan_suffix"`
	// The method with which the tender was entered.
	EntryMethod string `json:"entry_method"`
	// Notes entered by the merchant about the tender at the time of payment, if any.
	// Typically only present for tender with the typeOTHER.
	PaymentNote string `json:"payment_note"`
	// The total amount of money provided in this form of tender.
	TotalMoney Money `json:"total_money"`
	// The amount of total_money applied to the payment.
	TenderedMoney Money `json:"tendered_money"`
	// The amount of total_money returned to the buyer as change.
	ChangeBackMoney Money `json:"change_back_money"`
	// The total of all refunds applied to this tender. This amount is always negative or zero.
	RefundedMoney Money `json:"refunded_money"`
}

Represents a form and amount of tender provided for a payment. Multiple forms of tender can be provided for a single payment.

type Timecard

type Timecard struct {
	// The timecard's unique ID.
	ID string `json:"id"`
	// The ID of the employee the timecard is associated with.
	EmployeeID string `json:"employee_id"`
	// If true, the timecard was deleted by the merchant, and it is no longer
	// valid.
	Deleted bool `json:"deleted"`
	// The time the employee clocked in, in ISO 8601 format.
	ClockinTime string `json:"clockin_time"`
	// The time the employee clocked out, in ISO 8601 format.
	ClockoutTime string `json:"clockout_time"`
	// The ID of the location the employee clocked in from, if any.
	ClockinLocationID string `json:"clockin_location_id"`
	// The ID of the location the employee clocked out from, if any.
	ClockoutLocationID string `json:"clockout_location_id"`
	// The time when the timecard was created, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
	// The time when the timecard was most recently updated, in ISO 8601 format.
	UpdatedAt string `json:"updated_at"`
}

Represents a timecard for an employee.

func CreateTimecard

func CreateTimecard(token string, reqObj *CreateTimecardReqObject) (*Timecard, error)

Creates a timecard for an employee. Each timecard corresponds to a single shift.

This endpoint automatically creates an API_CREATE event for the new timecard.

Required permissions: TIMECARDS_WRITE

func RetrieveTimecard

func RetrieveTimecard(token, timecardID string) (*Timecard, error)

Currently, only approved merchants can manage their employees with Square. Unapproved merchants cannot use employee management features you include in your application. Provides the details for a single timecard. Required permissions: TIMECARDS_READ

func UpdateTimecard

func UpdateTimecard(token, timecardID string, reqObj *UpdateTimecardReqObject) (*Timecard, error)

Modifies a timecard's details. This creates an API_EDIT event for the timecard. You can view a timecard's event history with the List Timecard Events endpoint.

Required permissions: TIMECARDS_WRITE

type TimecardEvent

type TimecardEvent struct {
	// The event's unique ID.
	ID string `json:"id"`
	// The type of action performed on the timecard, such as CLOCKIN or
	// API_CREATE.
	EventType string `json:"event_type"`
	// The time the employee clocked in, in ISO 8601 format.
	ClockinTime string `json:"clockin_time"`
	// The time the employee clocked out, in ISO 8601 format.
	ClockoutTime string `json:"clockout_time"`
	// The time when the event was created, in ISO 8601 format.
	CreatedAt string `json:"created_at"`
}

Represents an event associated with a timecard, such as an employee clocking in.

type Token

type Token struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresAt   string `json:"expires_at"`
	MerchantID  string `json:"merchant_id"`
}

Response from GetToken and Renew Token

func GetToken

func GetToken(authorizationCode, applicationID, applicationSecret string) (*Token, error)

Get first token from new merchant's authorization code.

func RenewToken

func RenewToken(expiredToken, applicationID, applicationSecret string) (*Token, error)

Renew token from expired token. If the token is older than 30 days this won't work.

type UpdateCategoryReqObject

type UpdateCategoryReqObject struct {
	// The new name of the category.
	Name string `json:"name"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateCellReqObject

type UpdateCellReqObject struct {
	// The row of the cell to update. Always an integer between 0 and 4,
	// inclusive. Row 0 is the top row.
	Row int `json:"row"`
	// The column of the cell to update. Always an integer between 0 and 4,
	// inclusive. Column 0 is the leftmost row.
	Column int `json:"column"`
	// The type of entity represented in the cell (ITEM, DISCOUNT,
	// CATEGORY, or PLACEHOLDER).
	ObjectType string `json:"object_type"`
	// The unique identifier of the entity to represent in the cell. Do not include if the
	// cell's object_type is PLACEHOLDER.
	ObjectID string `json:"object_id"`
	// For a cell with an object_type of PLACEHOLDER, indicates the cell's
	// behavior.
	PlaceholderType string `json:"placeholder_type"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateDiscountReqObject

type UpdateDiscountReqObject struct {
	// The discount's name.
	Name string `json:"name"`
	// The rate of the discount, as a string representation of a decimal number. A value of
	// 0.07 corresponds to a rate of 7%. Specify a rate of 0 if discount_type
	// is VARIABLE_PERCENTAGE.Do not include this field for amount-based discounts.
	Rate string `json:"rate"`
	// The amount of the discount. Specify an amount of 0 if discount_type is
	// VARIABLE_AMOUNT.Do not include this field for rate-based discounts.
	AmountMoney Money `json:"amount_money"`
	// Indicates whether the discount is a FIXED value or entered at the time of
	// sale.Default value: FIXED
	DiscountType string `json:"discount_type"`
	// Indicates whether a mobile staff member needs to enter their PIN to apply the discount
	// to a payment.Default value: false
	PinRequired bool `json:"pin_required"`
	// The color of the discount's display label in Square Register.Default value: 9da2a6
	Color string `json:"color"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateEmployeeReqObject

type UpdateEmployeeReqObject struct {
	// The employee's first name.
	FirstName string `json:"first_name"`
	// The employee's last name.
	LastName string `json:"last_name"`
	// An optional second ID to associate the employee with an entity in another system.
	ExternalID string `json:"external_id"`
	// The employee's associated roles. Currently, you can specify only one or zero roles per
	// employee.
	RoleIDs []string `json:"role_ids"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateFeeReqObject

type UpdateFeeReqObject struct {
	// The fee's name.
	Name string `json:"name"`
	// The rate of the fee, as a string representation of a decimal number. A value of
	// 0.07 corresponds to a rate of 7%.
	Rate string `json:"rate"`
	// Whether the fee is calculated based on a payment's subtotal or total.Default value: FEE_SUBTOTAL_PHASE
	CalculationPhase string `json:"calculation_phase"`
	// The type of adjustment the fee applies to a payment. Currently, this value is
	// TAX for all fees.Default value: TAX
	AdjustmentType string `json:"adjustment_type"`
	// If true, the fee applies to custom amounts entered into Square Register that are
	// not associated with a particular item.Default value: true
	AppliesToCustomAmounts bool `json:"applies_to_custom_amounts"`
	// If true, the fee is applied to all appropriate items. If false, the fee
	// is not applied at all.Default value: true
	Enabled bool `json:"enabled"`
	// Whether the fee is ADDITIVE or INCLUSIVE.Default value: ADDITIVE
	InclusionType string `json:"inclusion_type"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateItemReqObject

type UpdateItemReqObject struct {
	// The item's name.
	Name string `json:"name"`
	// The item's description.
	Description string `json:"description"`
	// The ID of the item's category, if any.If you provide the empty string for this value, any existing category association is
	// removed from the item.
	CategoryID string `json:"category_id"`
	// The color of the item's display label in Square Register.
	Color string `json:"color"`
	// The text of the item's display label in Square Register. Only up to the first five
	// characters of the string are used.
	Abbreviation string `json:"abbreviation"`
	// Indicates whether the item is viewable from the merchant's online store (PUBLIC) or
	// PRIVATE.
	Visibility string `json:"visibility"`
	// If true, the item can be purchased from the merchant's online store.
	AvailableOnline bool `json:"available_online"`
	// If true, the item can be added to pickup orders from the merchant's online
	// store.
	AvailableForPickup bool `json:"available_for_pickup"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateModifierListReqObject

type UpdateModifierListReqObject struct {
	// The modifier list's name.
	Name string `json:"name"`
	// Indicates whether multiple options from the modifier list can be applied to a single
	// item.
	SelectionType string `json:"selection_type"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateModifierOptionReqObject

type UpdateModifierOptionReqObject struct {
	// The modifier option's name.
	Name string `json:"name"`
	// The modifier option's price.
	PriceMoney Money `json:"price_money"`
	// If true, the modifier option is the default option in a modifier list for which
	// selection_type is SINGLE.
	OnByDefault bool `json:"on_by_default"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateOrderReqObject

type UpdateOrderReqObject struct {
	// The action to perform on the order (COMPLETE, CANCEL, or
	// REFUND).
	Action string `json:"action"`
	// The tracking number of the shipment associated with the order. Only valid if
	// action is COMPLETE.
	ShippedTrackingNumber string `json:"shipped_tracking_number"`
	// A merchant-specified note about the completion of the order. Only valid if
	// action is COMPLETE.
	CompletedNote string `json:"completed_note"`
	// A merchant-specified note about the refunding of the order. Only valid if action
	// is REFUND.
	RefundedNote string `json:"refunded_note"`
	// A merchant-specified note about the canceling of the order. Only valid if action
	// is CANCEL.
	CanceledNote string `json:"canceled_note"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdatePageReqObject

type UpdatePageReqObject struct {
	// The page's name.
	Name string `json:"name"`
	// The page's position in the merchant's list of pages. Must be an integer between
	// 0 and 4, inclusive.The page's index is not updated if another page already exists at the specified
	// index.
	PageIndex int `json:"page_index"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateRoleReqObject

type UpdateRoleReqObject struct {
	// The role's name.
	Name string `json:"name"`
	// The role's permissions.
	Permissions []string `json:"permissions"`
	// If true, employees with this role have all permissions, regardless of the
	// values indicated in permissions.
	IsOwner bool `json:"is_owner"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateTimecardReqObject

type UpdateTimecardReqObject struct {
	// The clock-in time for the timecard, in ISO 8601 format.
	ClockinTime string `json:"clockin_time"`
	// The clock-out time for the timecard, in ISO 8601 format.
	ClockoutTime string `json:"clockout_time"`
	// The ID of the location the employee clocked in from, if any.
	ClockinLocationID string `json:"clockin_location_id"`
	// The ID of the location the employee clocked out from, if any.
	ClockoutLocationID string `json:"clockout_location_id"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

type UpdateVariationReqObject

type UpdateVariationReqObject struct {
	// The item variation's name.
	Name string `json:"name"`
	// Indicates whether the item variation's price is fixed or determined at the time of
	// sale.Default value: FIXED_PRICING
	PricingType string `json:"pricing_type"`
	// The item variation's price, if any.
	PriceMoney Money `json:"price_money"`
	// The item variation's SKU, if any.
	Sku string `json:"sku"`
	// If true, inventory tracking is active for the variation.
	TrackInventory bool `json:"track_inventory"`
	// Indicates whether the item variation displays an alert when its inventory quantity goes
	// below its inventory_alert_threshold.
	InventoryAlertType string `json:"inventory_alert_type"`
	// If the inventory quantity for the variation is below this value and
	// inventory_alert_type is LOW_QUANTITY, the variation displays an alert in
	// the merchant dashboard.
	InventoryAlertThreshold int `json:"inventory_alert_threshold"`
	// Arbitrary metadata to associate with the variation. Cannot exceed 255 characters.
	UserData string `json:"user_data"`
}

For POST and PUT endpoints, you provide request parameters as JSON in your request's body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL