SquareClient class

Client for the Square APIs

Constructors

SquareClient({required String? applicationId, required String clientId, required String clientSecret, EnvironmentType environmentType = EnvironmentType.Sandbox})

Properties

applicationId String?
final
clientId String
final
clientSecret String
final
environmentType EnvironmentType
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

acceptDispute({required String disputeId, String? authToken}) Future<Dispute>
Accepts the loss on a dispute.
accumulateLoyaltyPoints({required String accountId, required AccumulateLoyaltyPointRequest request, String? authToken}) Future<LoyaltyEvent>
Adds points to a loyalty account.
addCustomerToGroup({required String customerId, required String groupId, String? authToken}) Future<bool>
Adds a group membership to a customer.
adjustLoyaltyPoints({required String accountId, required AdjustLoyaltyPointRequest request, String? authToken}) Future<LoyaltyEvent>
Adds points to or subtracts points from a buyer's account.
batchCreateTeamMember({required TeamMemberBatchUpsertRequest request, String? authToken}) Future<Map<String, TeamMember>>
Creates multiple TeamMember objects.
batchDeleteCatalog({required List<String> objectIds, String? authToken}) Future<CatalogDeleteResponse>
Deletes a set of CatalogItems based on the provided list of target IDs and returns a set of successfully deleted IDs in the response.
batchInventoryChange({required BatchInventoryChangeRequest request, String? authToken}) Future<InventoryResponse>
Applies adjustments and counts to the provided item quantities.
batchInventoryRead({required BatchInventoryReadRequest request, String? authToken}) Future<InventoryResponse>
Returns historical physical counts and adjustments based on the provided filter criteria.
batchInventoryReadCounts({required BatchInventoryReadCountRequest request, String? authToken}) Future<InventoryResponse>
Returns current counts for the provided CatalogObjects at the requested Locations.
batchOrderRead({required BatchOrderRequest request, String? authToken}) Future<List<Order>>
Retrieves a set of orders by their IDs. If a given order ID does not exist, the ID is ignored instead of generating an error.
batchRetrieveCatalog({required RetrieveCatalogRequest request, String? authToken}) Future<CatalogResponse>
Returns a set of objects based on the provided ID.
batchUpdateTeamMember({required TeamMemberBatchUpsertRequest request, String? authToken}) Future<Map<String, TeamMember>>
Updates multiple TeamMember objects.
batchUpsertCatalog({required BatchUpsertCatalogRequest request, String? authToken}) Future<CatalogResponse>
Creates or updates up to 10,000 target objects based on the provided list of objects.
calculateLoyaltyPoints({required String programId, required CalculateLoyaltyPointsRequest request, String? authToken}) Future<int>
Calculates the points a purchase earns.
calculateLoyaltyReward({required UpsertLoyaltyRewardRequest request, String? authToken}) Future<LoyaltyReward>
Creates a loyalty reward.
calculateOrder({required CalculateOrderRequest request, String? authToken}) Future<Order>
Enables applications to preview order pricing without creating an order.
cancelBooking({required String bookingId, required CancelBookingRequest request, String? authToken}) Future<Booking>
Cancels an existing booking.
cancelInvoice({required int invoiceId, required int version, String? authToken}) Future<Invoice>
Cancels an invoice.
cancelPayment({required String paymentId, String? authToken}) Future<bool>
Cancels (voids) a payment.
cancelPaymentByIdempotencyKey({required String idempotencyKey, String? authToken}) Future<bool>
Cancels (voids) a payment identified by the idempotency key that is specified in the request.
cancelSubscription({required int subscriptionId, String? authToken}) Future<SubscriptionResponse>
Schedules a CANCEL action to cancel an active subscription by setting the canceled_date field to the end of the active billing period and changing the subscription status from ACTIVE to CANCELED after this date.
cancelTerminalCheckout({required String checkoutId, String? authToken}) Future<TerminalCheckout>
Cancels a Terminal checkout request if the status of the request permits it.
cancelTerminalRefund({required String terminalRefundId, String? authToken}) Future<TerminalRefund>
Cancels a Terminal checkout request if the status of the request permits it.
cloneOrder({required CloneOrderRequest request, String? authToken}) Future<Order>
Creates a new order, in the DRAFT state, by duplicating an existing order.
completePayment({required String paymentId, required CompletePaymentRequest request, String? authToken}) Future<Payment>
Completes (captures) a payment.
createBooking({required UpsertBookingRequest request, String? authToken}) Future<Booking>
Creates a booking.
createBreakTypes({required CreateBreakTypeRequest request, String? authToken}) Future<BreakType>
Creates a new BreakType.
createCard({required CreateCardRequest request, String? authToken}) Future<Card>
Adds a card on file to an existing merchant.
createCatalogImage({required CreateCatalogImageRequest request, String? authToken}) Future<CatalogObject>
Uploads an image file to be represented by a CatalogImage object that can be linked to an existing CatalogObject instance.
createCheckout({required String locationId, required CreateCheckoutRequest request, String? authToken}) Future<Checkout>
Links a checkoutId to a checkout_page_url that customers are directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
createCustomer({required CustomerUpsertRequest request, String? authToken}) Future<Customer>
Creates a new customer for a business.
createCustomerGroup({required CreateCustomerGroup request, String? authToken}) Future<CustomerGroup>
Creates a new customer group for a business.
createDisputeEvidenceFile({required String disputeId, required CreateDisputeEvidenceFileRequest request, String? authToken}) Future<DisputeEvidence>
Uploads a file to use as evidence in a dispute challenge.
createDisputeEvidenceText({required String disputeId, required CreateDisputeEvidenceTextRequest request, String? authToken}) Future<DisputeEvidence>
Uploads text to use as evidence for a dispute challenge.
createGiftCard({required CreateGiftCardRequest request, String? authToken}) Future<GiftCard>
Creates a digital gift card or registers a physical (plastic) gift card.
createGiftCardActivities({required CreateGiftCardActivityRequest request, String? authToken}) Future<GiftCardActivity>
Creates a gift card activity.
createInvoice({required CreateInvoiceRequest request, String? authToken}) Future<Invoice>
Creates a draft invoice for an order created using the Orders API.
createLocation({required Location location, String? authToken}) Future<Location>
Creates a location.
createLoyalty({required LoyaltyUpsertRequest request, String? authToken}) Future<LoyaltyAccount>
Creates a loyalty account.
createOrder({required CreateOrderRequest request, String? authToken}) Future<Order>
createPayment({required CreatePaymentRequest request, String? authToken}) Future<Payment>
Creates a payment using the provided source.
createShift({required CreateShiftRequest request, String? authToken}) Future<Shift>
Creates a new Shift.
createSubscription({required CreateSubscriptionRequest request, String? authToken}) Future<Subscription>
Creates a subscription to a subscription plan by a customer.
createTeamMember({required TeamMemberUpsertRequest request, String? authToken}) Future<TeamMember>
Creates a single TeamMember object.
createTerminalCheckout({required CreateTerminalCheckoutRequest request, String? authToken}) Future<TerminalCheckout>
Creates a Terminal checkout request and sends it to the specified device to take a payment for the requested amount.
createTerminalRefund({required CreateRefundRequest request, String? authToken}) Future<TerminalRefund>
Creates a request to refund an Interac payment completed on a Square Terminal.
deleteBreakTypes({required String breakTypeId, String? authToken}) Future<bool>
Deletes an existing BreakType.
deleteCatalog({required String objectId, String? authToken}) Future<CatalogDeleteResponse>
Deletes a single CatalogObject based on the provided ID and returns the set of successfully deleted IDs in the response.
deleteCustomer({required String customerId, String? authToken}) Future<bool>
Deletes a customer profile from a business.
deleteCustomerGroup({required String groupId, String? authToken}) Future<bool>
Deletes a customer group as identified by the group_id value.
deleteDisputeEvidence({required String disputeId, required String evidenceId, String? authToken}) Future<bool>
Removes specified evidence from a dispute.
deleteInvoice({required int invoiceId, required int version, String? authToken}) Future<bool>
Deletes the specified invoice.
deleteLoyaltyReward({required String rewardId, String? authToken}) Future<bool>
Deletes a loyalty reward
deleteShift({required String shiftId, String? authToken}) Future<bool>
Deletes a Shift.
deleteSnippet({required String siteId, String? authToken}) Future<bool>
Removes your snippet from a Square Online site.
deleteSubscription({required int subscriptionId, required String actionId, String? authToken}) Future<Subscription>
Deletes a scheduled action for a subscription.
disableCard({required String cardId, String? authToken}) Future<Card>
Disables the card, preventing any further updates or charges.
getAuthorizationPageUrl({required List<Scope> scopes, required String redirectUrl, required String state}) String
Returns an Authorization URL for presenting the user with a modal authorization.
getAuthToken({required String code, required String redirectUrl}) Future<TokenResponse>
Gets the Authorization Token from the code.
getTeamMemberWages({required String teamMemberId, String? authToken}) Future<TeamMemberWage>
Returns a single TeamMemberWage specified by id.
initialize() Future<void>
Initializes the client
isInitialized() bool
linkGiftCardToCustomer({required String giftCardId, required String customerId, String? authToken}) Future<GiftCard>
Links a customer to a gift card, which is also referred to as adding a card on file.
listBankAccounts({required ListBankAccountsRequest request, String? authToken}) Future<BankAccountResponse>
Returns a list of BankAccount objects linked to a Square account.
listBookings({required ListBookingsRequest request, String? authToken}) Future<BookingsResponse>
Retrieve a collection of bookings.
listBreakTypes({required ListBreakTypesRequest request, String? authToken}) Future<BreakTypeResponse>
Returns a paginated list of BreakType instances for a business.
listCards({required ListCardRequest request, String? authToken}) Future<CardResponse>
Retrieves a list of cards owned by the account making the request.
listCatalog({required ListCatalogRequest request, String? authToken}) Future<CatalogResponse>
Returns a list of all CatalogObjects of the specified types in the catalog.
listCustomer({required ListCustomerRequest request, String? authToken}) Future<List<Customer>>
Lists customer profiles associated with a Square account.
listCustomerGroup({required SearchRequest request, String? authToken}) Future<CustomerGroupResponse>
Retrieves the list of customer groups of a business.
listCustomerSegments({required SearchRequest request, String? authToken}) Future<CustomerSegmentResponse>
Retrieves the list of customer segments of a business.
listDisputeEvidence({required String disputeId, String? cursor, String? authToken}) Future<DisputeEvidenceListResponse>
Returns a list of evidence associated with a dispute.
listDisputes({required ListDisputesRequest request, String? authToken}) Future<DisputeResponse>
Returns a list of disputes associated with a particular account.
listGiftCardActivities({required ListGiftCardActivityRequest request, String? authToken}) Future<GiftCardActivityResponse>
Lists gift card activities.
listGiftCards({required ListGiftCardRequest request, String? authToken}) Future<GiftCardResponse>
Lists all gift cards.
listInvoices({required String locationId, String? cursor, int limit = 200, String? authToken}) Future<InvoiceResponse>
Returns a list of invoices for a given location.
listLocation({required String merchantId, String? authToken}) Future<List<Location>>
Provides details about all of the seller's locations, including those with an inactive status.
listMerchants({String? cursor, String? authToken}) Future<MerchantResponse>
Returns Merchant information for a given access token.
listPayments({required ListPaymentRequest request, String? authToken}) Future<SquarePaymentResponse>
Retrieves a list of payments taken by the account making the request.
listRefunds({required ListRefundsRequest request, String? authToken}) Future<SquareRefundResponse>
Retrieves a list of refunds for the account making the request.
listSites({String? authToken}) Future<List<Site>>
Lists the Square Online sites that belong to a seller.
listSubscriptionEvents({required int subscriptionId, String? cursor, int? limit, String? authToken}) Future<List<SubscriptionEvent>>
Lists all events for a specific subscription.
listTeamMemberBookingProfile({required ReadTeamMemberBookingProfileRequest request, String? authToken}) Future<TeamMemberBookingProfileResponse>
Lists booking profiles for team members.
listTeamMemberWages({required ListTeamMemberWageRequest request, String? authToken}) Future<TeamMemberWageResponse>
Returns a paginated list of TeamMemberWage instances for a business.
listWorkWeekConfigs({required SearchWorkWeekConfigRequest request, String? authToken}) Future<WorkWeekConfigResponse>
Returns a list of WorkweekConfig instances for a business.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pauseSubscription({required String subscriptionId, required SubscriptionStateRequest request, String? authToken}) Future<SubscriptionResponse>
Schedules a PAUSE action to pause an active subscription.
payOrder({required int orderId, required PayOrderRequest request, String? authToken}) Future<Order>
Pay for an order using one or more approved payments or settle an order with a total of 0.
publishInvoice({required String invoiceId, required PublishInvoiceRequest request, String? authToken}) Future<Invoice>
Publishes the specified draft invoice.
readBankAccountById({required String bankAccountId, String? authToken}) Future<BankAccount>
Returns details of a BankAccount linked to a Square account.
readBankAccountByV1Id({required String v1BankAccountId, String? authToken}) Future<BankAccount>
Returns details of a BankAccount identified by V1 bank account ID.
readBooking({required String bookingId, String? authToken}) Future<Booking>
Retrieves a booking.
readBreakTypes({required String breakTypeId, String? authToken}) Future<BreakType>
Returns a single BreakType specified by id.
readBusinessBooking({String? authToken}) Future<BusinessBookingProfile>
Retrieves a seller's booking profile.
readCard({required String cardId, String? authToken}) Future<Card>
Retrieves details for a specific Card.
readCatalog({required String objectId, String? authToken}) Future<CatalogResponse>
Returns a single CatalogItem as a CatalogObject based on the provided ID.
readCatalogInfo({required UpdateCatalogImageRequest request, required String imageId, String? authToken}) Future<CatalogInfoResponse>
Retrieves information about the Square Catalog API, such as batch size limits that can be used by the BatchUpsertCatalogObjects endpoint
readCustomer({required String customerId, String? authToken}) Future<Customer>
Returns details for a single customer.
readCustomerGroup({required String groupId, String? authToken}) Future<CustomerGroup>
Retrieves a specific customer group as identified by the group_id value.
readCustomerSegments({required String segmentId, String? authToken}) Future<CustomerSegment>
Retrieves a specific customer segment as identified by the segment_id value.
readDispute({required String disputeId, String? authToken}) Future<Dispute>
Returns details about a specific dispute.
readDisputeEvidence({required String disputeId, required String evidenceId, String? authToken}) Future<DisputeEvidence>
Returns the evidence metadata specified by the evidence ID in the request URL path
readGiftCard({required String giftCardId, String? authToken}) Future<GiftCard>
Retrieves a gift card using its ID.
readGiftCardFromGan({required String gan, String? authToken}) Future<GiftCard>
Retrieves a gift card using the gift card account number (GAN).
readGiftCardFromNonce({required String nonce, String? authToken}) Future<GiftCard>
Retrieves a gift card using a secure payment token that represents the gift card.
readInventoryAdjustment({required String adjustmentId, String? authToken}) Future<InventoryAdjustment>
Returns the InventoryAdjustment object with the provided adjustment_id.
readInventoryCount({required String catalogObjectId, InventoryCountRequest? request, String? authToken}) Future<InventoryResponse>
Retrieves the current calculated stock count for a given CatalogObject at a given set of Locations.
readInventoryPhysicalCount({required String physicalCountId, String? authToken}) Future<InventoryPhysicalCount>
Returns the InventoryPhysicalCount object with the provided physicalCountId.
readInventoryTransfer({required String transferId, String? authToken}) Future<InventoryTransfer>
Returns the InventoryTransfer object with the provided transfer_id.
readInvoice({required String invoiceId, String? authToken}) Future<Invoice>
Retrieves an invoice by invoice ID.
readLocation({required String locationId, String? authToken}) Future<Location>
Retrieves details of a single location.
readLoyalty({required String accountId, String? authToken}) Future<LoyaltyAccount>
Retrieves a loyalty account.
readLoyaltyProgram({required String programId, String? authToken}) Future<LoyaltyProgram>
Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword main.
readLoyaltyReward({required String rewardId, String? authToken}) Future<LoyaltyReward>
Retrieves a loyalty reward.
readMerchant({required String merchantId, String? authToken}) Future<Merchant>
Retrieve a Merchant object for the given merchant_id.
readOrder({required String orderId, String? authToken}) Future<Order>
Retrieves an Order by ID.
readPayment({required String paymentId, String? authToken}) Future<Payment>
Retrieves details for a specific payment.
readPaymentRefund({required String refundId, String? authToken}) Future<Refund>
Retrieves a specific refund using the refund_id
readShift({required String shiftId, String? authToken}) Future<Shift>
Returns a single Shift specified by id.
readSnippet({required String siteId, String? authToken}) Future<Snippet>
Retrieves your snippet from a Square Online site.
readSubscription({required String subscriptionId, String? authToken}) Future<Subscription>
Retrieves a subscription.
readTeamMember({required String teamMemberId, String? authToken}) Future<TeamMember>
Retrieves a TeamMember object for the given TeamMember.id.
readTeamMemberBookingProfile({required String teamMemberId, String? authToken}) Future<TeamMemberBookingProfile>
Retrieves a team member's booking profile.
readTerminalCheckout({required String checkoutId, String? authToken}) Future<TerminalCheckout>
Retrieves a Terminal checkout request by checkoutId.
readTerminalRefund({required String terminalRefundId, String? authToken}) Future<TerminalRefund>
Retrieves an Interac Terminal refund object by ID.
readWageSetting({required String teamMemberId, String? authToken}) Future<WageSetting>
Retrieves a WageSetting object for a team member specified by TeamMember.id.
redeemLoyaltyReward({required String rewardId, required RedeemLoyaltyRequest request, String? authToken}) Future<LoyaltyEvent>
Redeems a loyalty reward.
refreshToken({String refreshToken = ""}) Future<TokenResponse>
Refreshes the authorization token. Note: If refreshToken is not set it will attempt to use the refresh token from the last token request it cached if any.
refundPayment({required RefundPaymentRequest request, String? authToken}) Future<Refund>
Refunds a payment.
registerApplePayDomain({required String domainName, String? authToken}) Future<RegisterDomainResponseStatus>
Activates a domain for use with Apple Pay on the Web and Square.
removeCustomerFromGroup({required String customerId, required String groupId, String? authToken}) Future<bool>
Removes a group membership from a customer.
resumeSubscription({required String subscriptionId, required SubscriptionStateRequest request, String? authToken}) Future<SubscriptionResponse>
Schedules a RESUME action to resume a paused or a deactivated subscription.
searchBookingAvailability({required SearchAvailabilityQuery query, String? authToken}) Future<List<Availability>>
Searches for availabilities for booking.
searchCatalog({required String objectId, required CatalogSearchRequest request, String? authToken}) Future<CatalogResponse>
Searches for CatalogObject of any type by matching supported search attribute values, excluding custom attribute values on items or item variations, against one or more of the specified query filters.
searchCatalogItems({required String objectId, required CatalogItemsSearchRequest request, String? authToken}) Future<CatalogItemsResponse>
Searches for catalog items or item variations by matching supported search attribute values, including custom attribute values, against one or more of the specified query filters.
searchCustomer({required SearchCustomerRequest request, String? authToken}) Future<CustomerResponse>
Searches the customer profiles associated with a Square account using a supported query filter.
searchInvoice({required SearchInvoiceRequest request, String? authToken}) Future<InvoiceResponse>
Searches for invoices from a location specified in the filter.
searchLoyalty({required SearchLoyaltyRequest request, String? authToken}) Future<LoyaltyResponse>
Searches for loyalty accounts in a loyalty program.
searchLoyaltyEvents({required SearchLoyaltyEventsRequest request, String? authToken}) Future<LoyaltyEventResponse>
Searches for loyalty events.
searchLoyaltyReward({required SearchLoyaltyRewardRequest request, String? authToken}) Future<LoyaltyRewardResponse>
Searches for loyalty rewards in a loyalty account.
searchOrder({required SearchOrderRequest request, String? authToken}) Future<OrderResponse>
Search all orders for one or more locations. Orders include all sales, returns, and exchanges regardless of how or when they entered the Square ecosystem (such as Point of Sale, Invoices, and Connect APIs).
searchShift({required SearchShiftRequest request, String? authToken}) Future<ShiftResponse>
Returns a paginated list of Shift records for a business.
searchSubscription({required SearchSubscriptionRequest request, String? authToken}) Future<SubscriptionResponse>
Searches for subscriptions. Results are ordered chronologically by subscription creation date. If the request specifies more than one location ID, the endpoint orders the result by location ID, and then by creation date within each location. If no locations are given in the query, all locations are searched.
searchTeamMember({required TeamMemberSearchRequest request, String? authToken}) Future<TeamMemberResponse>
Returns a paginated list of TeamMember objects for a business.
searchTerminalCheckout({required SearchTerminalRequest request, String? authToken}) Future<TerminalCheckoutResponse>
Retrieves a filtered list of Terminal checkout requests created by the account making the request.
searchTerminalRefund({required SearchTerminalRequest request, String? authToken}) Future<TerminalRefundResponse>
Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request.
submitDisputeEvidence({required String disputeId, String? authToken}) Future<DisputeEvidence>
Submits evidence to the cardholder's bank.
swapPlan({required String subscriptionId, required String newPlanId, String? authToken}) Future<Subscription>
Schedules a SWAP_PLAN action to swap a subscription plan in an existing subscription.
toString() String
A string representation of this object.
inherited
unlinkGiftCardToCustomer({required String giftCardId, required String customerId, String? authToken}) Future<GiftCard>
Unlinks a customer from a gift card, which is also referred to as removing a card on file.
updateBooking({required String bookingId, required UpsertBookingRequest request, String? authToken}) Future<Booking>
Updates a booking.
updateBreakTypes({required BreakType breakType, String? authToken}) Future<BreakType>
Updates an existing BreakType.
updateCatalogImage({required UpdateCatalogImageRequest request, required String imageId, String? authToken}) Future<CatalogObject>
Uploads a new image file to replace the existing one in the specified CatalogImage object.
updateCatalogItemsModifiers({required String objectId, required UpdateCatalogItemsModifier request, String? authToken}) Future<String>
Updates the CatalogModifierList objects that apply to the targeted CatalogItem without having to perform an upsert on the entire item.
updateCustomer({required String customerId, required CustomerUpsertRequest request, String? authToken}) Future<Customer>
Updates a customer profile.
updateCustomerGroup({required String groupId, required CustomerGroup group, String? authToken}) Future<CustomerGroup>
Updates a customer group as identified by the group_id value.
updateInvoice({required int invoiceId, required UpdateInvoiceRequest request, String? authToken}) Future<Invoice>
Updates an invoice by modifying fields, clearing fields, or both.
updateLocation({required Location location, String? authToken}) Future<Location>
Updates a location.
updateOrder({required int orderId, required UpdateOrderRequest request, String? authToken}) Future<Order>
Updates an open order by adding, replacing, or deleting fields.
updatePayment({required String paymentId, required UpdatePaymentRequest request, String? authToken}) Future<Payment>
Updates a payment with the APPROVED status.
updateShift({required Shift shift, String? authToken}) Future<Shift>
Updates an existing Shift.
updateSubscription({required int subscriptionId, required Subscription request, String? authToken}) Future<Subscription>
Updates a subscription.
updateTeamMember({required TeamMember teamMember, String? authToken}) Future<TeamMember>
Updates a single TeamMember object.
updateWageSetting({required WageSetting wageSetting, String? authToken}) Future<WageSetting>
Creates or updates a WageSetting object.
updateWorkWeekConfigs({required WorkweekConfig config, String? authToken}) Future<WorkweekConfig>
Updates a WorkweekConfig.
upsertCatalog({required UpsertCatalogRequest request, String? authToken}) Future<CatalogResponse>
Creates or updates the target CatalogObject.
upsertSnippet({required Snippet snippet, String? authToken}) Future<Snippet>
Adds a snippet to a Square Online site or updates the existing snippet on the site.

Operators

operator ==(Object other) bool
The equality operator.
inherited