Reference
May 20, 2026 Β· View on GitHub
OAuth
client.oAuth.revokeToken(request) -> RevokeTokenResponse
-
π Description
-
-
Revokes an access token generated with the OAuth flow.
If an account has more than one OAuth access token for your application, this endpoint revokes all of them, regardless of which token you specify.
Important: The
Authorizationheader for this endpoint must have the following format:Authorization: Client APPLICATION_SECRETReplace
APPLICATION_SECRETwith the application secret on the OAuth page for your application in the Developer Dashboard.
-
π Usage
-
-
client.oAuth().revokeToken( RevokeTokenRequest .builder() .clientId("CLIENT_ID") .accessToken("ACCESS_TOKEN") .build() );
-
βοΈ Parameters
-
-
clientId:
Optional<String>The Square-issued ID for your application, which is available on the OAuth page in the Developer Dashboard.
-
accessToken:
Optional<String>The access token of the merchant whose token you want to revoke. Do not provide a value for
merchant_idif you provide this parameter.
-
merchantId:
Optional<String>The ID of the merchant whose token you want to revoke. Do not provide a value for
access_tokenif you provide this parameter.
-
revokeOnlyAccessToken:
Optional<Boolean>If
true, terminate the given single access token, but do not terminate the entire authorization. Default:false
-
-
client.oAuth.obtainToken(request) -> ObtainTokenResponse
-
π Description
-
-
Returns an OAuth access token and refresh token using the
authorization_codeorrefresh_tokengrant type.When
grant_typeisauthorization_code:- With the code flow,
provide
code,client_id, andclient_secret. - With the PKCE flow,
provide
code,client_id, andcode_verifier.
When
grant_typeisrefresh_token:- With the code flow, provide
refresh_token,client_id, andclient_secret. The response returns the same refresh token provided in the request. - With the PKCE flow, provide
refresh_tokenandclient_id. The response returns a new refresh token.
You can use the
scopesparameter to limit the set of permissions authorized by the access token. You can use theshort_livedparameter to create an access token that expires in 24 hours.Important: OAuth tokens should be encrypted and stored on a secure server. Application clients should never interact directly with OAuth tokens.
- With the code flow,
provide
-
π Usage
-
-
client.oAuth().obtainToken( ObtainTokenRequest .builder() .clientId("sq0idp-uaPHILoPzWZk3tlJqlML0g") .grantType("authorization_code") .clientSecret("sq0csp-30a-4C_tVOnTh14Piza2BfTPBXyLafLPWSzY1qAjeBfM") .code("sq0cgb-l0SBqxs4uwxErTVyYOdemg") .build() );
-
βοΈ Parameters
-
-
clientId:
StringThe Square-issued ID of your application, which is available as the Application ID on the OAuth page in the Developer Console.
Required for the code flow and PKCE flow for any grant type.
-
clientSecret:
Optional<String>The secret key for your application, which is available as the Application secret on the OAuth page in the Developer Console.
Required for the code flow for any grant type. Don't confuse your client secret with your personal access token.
-
code:
Optional<String>The authorization code to exchange for an OAuth access token. This is the
codevalue that Square sent to your redirect URL in the authorization response.Required for the code flow and PKCE flow if
grant_typeisauthorization_code.
-
redirectUri:
Optional<String>The redirect URL for your application, which you registered as the Redirect URL on the OAuth page in the Developer Console.
Required for the code flow and PKCE flow if
grant_typeisauthorization_codeand you provided theredirect_uriparameter in your authorization URL.
-
grantType:
StringThe method used to obtain an OAuth access token. The request must include the credential that corresponds to the specified grant type. Valid values are:
authorization_code- Requires thecodefield.refresh_token- Requires therefresh_tokenfield.migration_token- LEGACY for access tokens obtained using a Square API version prior to 2019-03-13. Requires themigration_tokenfield.
-
refreshToken:
Optional<String>A valid refresh token used to generate a new OAuth access token. This is a refresh token that was returned in a previous
ObtainTokenresponse.Required for the code flow and PKCE flow if
grant_typeisrefresh_token.
-
migrationToken:
Optional<String>LEGACY A valid access token (obtained using a Square API version prior to 2019-03-13) used to generate a new OAuth access token.
Required if
grant_typeismigration_token. For more information, see Migrate to Using Refresh Tokens.
-
scopes:
Optional<List<String>>The list of permissions that are explicitly requested for the access token. For example, ["MERCHANT_PROFILE_READ","PAYMENTS_READ","BANK_ACCOUNTS_READ"].
The returned access token is limited to the permissions that are the intersection of these requested permissions and those authorized by the provided
refresh_token.Optional for the code flow and PKCE flow if
grant_typeisrefresh_token.
-
shortLived:
Optional<Boolean>Indicates whether the returned access token should expire in 24 hours.
Optional for the code flow and PKCE flow for any grant type. The default value is
false.
-
codeVerifier:
Optional<String>The secret your application generated for the authorization request used to obtain the authorization code. This is the source of the
code_challengehash you provided in your authorization URL.Required for the PKCE flow if
grant_typeisauthorization_code.
-
useJwt:
Optional<Boolean>Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. When set to
true, the OAuth flow returns a JWT to your application, used in the same way as a regular token. The default value isfalse.
-
-
client.oAuth.retrieveTokenStatus() -> RetrieveTokenStatusResponse
-
π Description
-
-
Returns information about an OAuth access tokenΒ or an applicationβs personal access token.
Add the access token to the Authorization header of the request.
Important: The
Authorizationheader you provide to this endpoint must have the following format:Authorization: Bearer ACCESS_TOKENwhere
ACCESS_TOKENis a valid production authorization credential.If the access token is expired or not a valid access token, the endpoint returns an
UNAUTHORIZEDerror.
-
π Usage
-
-
client.oAuth().retrieveTokenStatus();
-
-
client.oAuth.authorize()
-
π Usage
-
-
client.oAuth().authorize();
-
-
V1Transactions
client.v1Transactions.v1ListOrders(locationId) -> List<V1Order>
-
π Description
-
-
Provides summary information for a merchant's online store orders.
-
π Usage
-
-
client.v1Transactions().v1ListOrders( V1ListOrdersRequest .builder() .locationId("location_id") .order(SortOrder.DESC) .limit(1) .batchToken("batch_token") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the location to list online store orders for.
-
order:
Optional<SortOrder>β The order in which payments are listed in the response.
-
limit:
Optional<Integer>β The maximum number of payments to return in a single response. This value cannot exceed 200.
-
batchToken:
Optional<String>A pagination cursor to retrieve the next set of results for your original query to the endpoint.
-
-
client.v1Transactions.v1RetrieveOrder(locationId, orderId) -> V1Order
-
π Description
-
-
Provides comprehensive information for a single online store order, including the order's history.
-
π Usage
-
-
client.v1Transactions().v1RetrieveOrder( V1RetrieveOrderRequest .builder() .locationId("location_id") .orderId("order_id") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the order's associated location.
-
orderId:
Stringβ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
-
-
client.v1Transactions.v1UpdateOrder(locationId, orderId, request) -> V1Order
-
π Description
-
-
Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:
-
π Usage
-
-
client.v1Transactions().v1UpdateOrder( V1UpdateOrderRequest .builder() .locationId("location_id") .orderId("order_id") .action(V1UpdateOrderRequestAction.COMPLETE) .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the order's associated location.
-
orderId:
Stringβ The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint
-
action:
V1UpdateOrderRequestActionThe action to perform on the order (COMPLETE, CANCEL, or REFUND). See V1UpdateOrderRequestAction for possible values
-
shippedTrackingNumber:
Optional<String>β The tracking number of the shipment associated with the order. Only valid if action is COMPLETE.
-
completedNote:
Optional<String>β A merchant-specified note about the completion of the order. Only valid if action is COMPLETE.
-
refundedNote:
Optional<String>β A merchant-specified note about the refunding of the order. Only valid if action is REFUND.
-
canceledNote:
Optional<String>β A merchant-specified note about the canceling of the order. Only valid if action is CANCEL.
-
-
ApplePay
client.applePay.registerDomain(request) -> RegisterDomainResponse
-
π Description
-
-
Activates a domain for use with Apple Pay on the Web and Square. A validation is performed on this domain by Apple to ensure that it is properly set up as an Apple Pay enabled domain.
This endpoint provides an easy way for platform developers to bulk activate Apple Pay on the Web with Square for merchants using their platform.
Note: You will need to host a valid domain verification file on your domain to support Apple Pay. The current version of this file is always available at https://app.squareup.com/digital-wallets/apple-pay/apple-developer-merchantid-domain-association, and should be hosted at
.well_known/apple-developer-merchantid-domain-associationon your domain. This file is subject to change; we strongly recommend checking for updates regularly and avoiding long-lived caches that might not keep in sync with the correct file version.To learn more about the Web Payments SDK and how to add Apple Pay, see Take an Apple Pay Payment.
-
π Usage
-
-
client.applePay().registerDomain( RegisterDomainRequest .builder() .domainName("example.com") .build() );
-
βοΈ Parameters
-
-
domainName:
Stringβ A domain name as described in RFC-1034 that will be registered with ApplePay.
-
-
BankAccounts
client.bankAccounts.list() -> SyncPagingIterable<BankAccount>
-
π Description
-
-
Returns a list of BankAccount objects linked to a Square account.
-
π Usage
-
-
client.bankAccounts().list( ListBankAccountsRequest .builder() .cursor("cursor") .limit(1) .locationId("location_id") .customerId("customer_id") .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>The pagination cursor returned by a previous call to this endpoint. Use it in the next
ListBankAccountsrequest to retrieve the next set of results.See the Pagination guide for more information.
-
limit:
Optional<Integer>Upper limit on the number of bank accounts to return in the response. Currently, 1000 is the largest supported limit. You can specify a limit of up to 1000 bank accounts. This is also the default limit.
-
locationId:
Optional<String>Location ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific location.
-
customerId:
Optional<String>Customer ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific customer.
-
-
client.bankAccounts.createBankAccount(request) -> CreateBankAccountResponse
-
π Description
-
-
Store a bank account on file for a square account
-
π Usage
-
-
client.bankAccounts().createBankAccount( CreateBankAccountRequest .builder() .idempotencyKey("4e43559a-f0fd-47d3-9da2-7ea1f97d94be") .sourceId("bnon:CA4SEHsQwr0rx6DbWLD5BQaqMnoYAQ") .customerId("HM3B2D5JKGZ69359BTEHXM2V8M") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringUnique ID. For more information, see the Idempotency.
-
sourceId:
StringThe ID of the source that represents the bank account information to be stored. This field accepts the payment token created by WebSDK
-
customerId:
Optional<String>β The ID of the customer associated with the bank account to be stored.
-
-
client.bankAccounts.getByV1Id(v1BankAccountId) -> GetBankAccountByV1IdResponse
-
π Description
-
-
Returns details of a BankAccount identified by V1 bank account ID.
-
π Usage
-
-
client.bankAccounts().getByV1Id( GetByV1IdBankAccountsRequest .builder() .v1BankAccountId("v1_bank_account_id") .build() );
-
βοΈ Parameters
-
-
v1BankAccountId:
StringConnect V1 ID of the desired
BankAccount. For more information, see Retrieve a bank account by using an ID issued by V1 Bank Accounts API.
-
-
client.bankAccounts.get(bankAccountId) -> GetBankAccountResponse
-
π Description
-
-
Retrieve details of a BankAccount bank account linked to a Square account.
-
π Usage
-
-
client.bankAccounts().get( GetBankAccountsRequest .builder() .bankAccountId("bank_account_id") .build() );
-
βοΈ Parameters
-
-
bankAccountId:
Stringβ Square-issued ID of the desiredBankAccount.
-
-
client.bankAccounts.disableBankAccount(bankAccountId) -> DisableBankAccountResponse
-
π Description
-
-
Disable a bank account.
-
π Usage
-
-
client.bankAccounts().disableBankAccount( DisableBankAccountRequest .builder() .bankAccountId("bank_account_id") .build() );
-
βοΈ Parameters
-
-
bankAccountId:
Stringβ The ID of the bank account to disable.
-
-
Bookings
client.bookings.list() -> SyncPagingIterable<Booking>
-
π Description
-
-
Retrieve a collection of bookings.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_READfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_READandAPPOINTMENTS_READfor the OAuth scope.
-
π Usage
-
-
client.bookings().list( ListBookingsRequest .builder() .limit(1) .cursor("cursor") .customerId("customer_id") .teamMemberId("team_member_id") .locationId("location_id") .startAtMin("start_at_min") .startAtMax("start_at_max") .build() );
-
βοΈ Parameters
-
-
limit:
Optional<Integer>β The maximum number of results per page to return in a paged response.
-
cursor:
Optional<String>β The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results.
-
customerId:
Optional<String>β The customer for whom to retrieve bookings. If this is not set, bookings for all customers are retrieved.
-
teamMemberId:
Optional<String>β The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved.
-
locationId:
Optional<String>β The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved.
-
startAtMin:
Optional<String>β The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used.
-
startAtMax:
Optional<String>β The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days afterstart_at_minis used.
-
-
client.bookings.create(request) -> CreateBookingResponse
-
π Description
-
-
Creates a booking.
The required input must include the following:
Booking.location_idBooking.start_atBooking.AppointmentSegment.team_member_idBooking.AppointmentSegment.service_variation_idBooking.AppointmentSegment.service_variation_version
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().create( CreateBookingRequest .builder() .booking( Booking .builder() .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>β A unique key to make this request an idempotent operation.
-
booking:
Bookingβ The details of the booking to be created.
-
-
client.bookings.searchAvailability(request) -> SearchAvailabilityResponse
-
π Description
-
-
Searches for availabilities for booking.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_READfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_READandAPPOINTMENTS_READfor the OAuth scope.
-
π Usage
-
-
client.bookings().searchAvailability( SearchAvailabilityRequest .builder() .query( SearchAvailabilityQuery .builder() .filter( SearchAvailabilityFilter .builder() .startAtRange( TimeRange .builder() .build() ) .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
query:
SearchAvailabilityQueryβ Query conditions used to filter buyer-accessible booking availabilities.
-
-
client.bookings.bulkRetrieveBookings(request) -> BulkRetrieveBookingsResponse
-
π Description
-
-
Bulk-Retrieves a list of bookings by booking IDs.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_READfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_READandAPPOINTMENTS_READfor the OAuth scope.
-
π Usage
-
-
client.bookings().bulkRetrieveBookings( BulkRetrieveBookingsRequest .builder() .bookingIds( Arrays.asList("booking_ids") ) .build() );
-
βοΈ Parameters
-
-
bookingIds:
List<String>β A non-empty list of Booking IDs specifying bookings to retrieve.
-
-
client.bookings.getBusinessProfile() -> GetBusinessBookingProfileResponse
-
π Description
-
-
Retrieves a seller's booking profile.
-
π Usage
-
-
client.bookings().getBusinessProfile();
-
-
client.bookings.retrieveLocationBookingProfile(locationId) -> RetrieveLocationBookingProfileResponse
-
π Description
-
-
Retrieves a seller's location booking profile.
-
π Usage
-
-
client.bookings().retrieveLocationBookingProfile( RetrieveLocationBookingProfileRequest .builder() .locationId("location_id") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the location to retrieve the booking profile.
-
-
client.bookings.bulkRetrieveTeamMemberBookingProfiles(request) -> BulkRetrieveTeamMemberBookingProfilesResponse
-
π Description
-
-
Retrieves one or more team members' booking profiles.
-
π Usage
-
-
client.bookings().bulkRetrieveTeamMemberBookingProfiles( BulkRetrieveTeamMemberBookingProfilesRequest .builder() .teamMemberIds( Arrays.asList("team_member_ids") ) .build() );
-
βοΈ Parameters
-
-
teamMemberIds:
List<String>β A non-empty list of IDs of team members whose booking profiles you want to retrieve.
-
-
client.bookings.get(bookingId) -> GetBookingResponse
-
π Description
-
-
Retrieves a booking.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_READfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_READandAPPOINTMENTS_READfor the OAuth scope.
-
π Usage
-
-
client.bookings().get( GetBookingsRequest .builder() .bookingId("booking_id") .build() );
-
βοΈ Parameters
-
-
bookingId:
Stringβ The ID of the Booking object representing the to-be-retrieved booking.
-
-
client.bookings.update(bookingId, request) -> UpdateBookingResponse
-
π Description
-
-
Updates a booking.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().update( UpdateBookingRequest .builder() .bookingId("booking_id") .booking( Booking .builder() .build() ) .build() );
-
βοΈ Parameters
-
-
bookingId:
Stringβ The ID of the Booking object representing the to-be-updated booking.
-
idempotencyKey:
Optional<String>β A unique key to make this request an idempotent operation.
-
booking:
Bookingβ The booking to be updated. Individual attributes explicitly specified here override the corresponding values of the existing booking.
-
-
client.bookings.cancel(bookingId, request) -> CancelBookingResponse
-
π Description
-
-
Cancels an existing booking.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().cancel( CancelBookingRequest .builder() .bookingId("booking_id") .build() );
-
βοΈ Parameters
-
-
bookingId:
Stringβ The ID of the Booking object representing the to-be-cancelled booking.
-
idempotencyKey:
Optional<String>β A unique key to make this request an idempotent operation.
-
bookingVersion:
Optional<Integer>β The revision number for the booking used for optimistic concurrency.
-
-
Cards
client.cards.list() -> SyncPagingIterable<Card>
-
π Description
-
-
Retrieves a list of cards owned by the account making the request. A max of 25 cards will be returned.
-
π Usage
-
-
client.cards().list( ListCardsRequest .builder() .cursor("cursor") .customerId("customer_id") .includeDisabled(true) .referenceId("reference_id") .sortOrder(SortOrder.DESC) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query.
See Pagination for more information.
-
customerId:
Optional<String>Limit results to cards associated with the customer supplied. By default, all cards owned by the merchant are returned.
-
includeDisabled:
Optional<Boolean>Includes disabled cards. By default, all enabled cards owned by the merchant are returned.
-
referenceId:
Optional<String>β Limit results to cards associated with the reference_id supplied.
-
sortOrder:
Optional<SortOrder>Sorts the returned list by when the card was created with the specified order. This field defaults to ASC.
-
-
client.cards.create(request) -> CreateCardResponse
-
π Description
-
-
Adds a card on file to an existing merchant.
-
π Usage
-
-
client.cards().create( CreateCardRequest .builder() .idempotencyKey("4935a656-a929-4792-b97c-8848be85c27c") .sourceId("cnon:uIbfJXhXETSP197M3GB") .card( Card .builder() .cardholderName("Amelia Earhart") .billingAddress( Address .builder() .addressLine1("500 Electric Ave") .addressLine2("Suite 600") .locality("New York") .administrativeDistrictLevel1("NY") .postalCode("10003") .country(Country.US) .build() ) .customerId("VDKXEEKPJN48QDG3BGGFAK05P8") .referenceId("user-id-1") .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA unique string that identifies this CreateCard request. Keys can be any valid string and must be unique for every request.
Max: 45 characters
See Idempotency keys for more information.
-
sourceId:
Stringβ The ID of the source which represents the card information to be stored. This can be a card nonce or a payment id.
-
verificationToken:
Optional<String>An identifying token generated by Payments.verifyBuyer(). Verification tokens encapsulate customer device information and 3-D Secure challenge results to indicate that Square has verified the buyer identity.
See the SCA Overview.
-
card:
Cardβ Payment details associated with the card to be stored.
-
-
client.cards.get(cardId) -> GetCardResponse
-
π Description
-
-
Retrieves details for a specific Card.
-
π Usage
-
-
client.cards().get( GetCardsRequest .builder() .cardId("card_id") .build() );
-
βοΈ Parameters
-
-
cardId:
Stringβ Unique ID for the desired Card.
-
-
client.cards.disable(cardId) -> DisableCardResponse
-
π Description
-
-
Disables the card, preventing any further updates or charges. Disabling an already disabled card is allowed but has no effect.
-
π Usage
-
-
client.cards().disable( DisableCardsRequest .builder() .cardId("card_id") .build() );
-
βοΈ Parameters
-
-
cardId:
Stringβ Unique ID for the desired Card.
-
-
Catalog
client.catalog.batchDelete(request) -> BatchDeleteCatalogObjectsResponse
-
π Description
-
-
Deletes a set of CatalogItems based on the provided list of target IDs and returns a set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its CatalogItemVariation children.
BatchDeleteCatalogObjectssucceeds even if only a portion of the targeted IDs can be deleted. The response will only include IDs that were actually deleted.To ensure consistency, only one delete request is processed at a time per seller account. While one (batch or non-batch) delete request is being processed, other (batched and non-batched) delete requests are rejected with the
429error code.
-
π Usage
-
-
client.catalog().batchDelete( BatchDeleteCatalogObjectsRequest .builder() .objectIds( Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK") ) .build() );
-
βοΈ Parameters
-
-
objectIds:
List<String>The IDs of the CatalogObjects to be deleted. When an object is deleted, other objects in the graph that depend on that object will be deleted as well (for example, deleting a CatalogItem will delete its CatalogItemVariation.
-
-
client.catalog.batchGet(request) -> BatchGetCatalogObjectsResponse
-
π Description
-
-
Returns a set of objects based on the provided ID. Each CatalogItem returned in the set includes all of its child information including: all of its CatalogItemVariation objects, references to its CatalogModifierList objects, and the ids of any CatalogTax objects that apply to it.
-
π Usage
-
-
client.catalog().batchGet( BatchGetCatalogObjectsRequest .builder() .objectIds( Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK") ) .includeRelatedObjects(true) .build() );
-
βοΈ Parameters
-
-
objectIds:
List<String>β The IDs of the CatalogObjects to be retrieved.
-
includeRelatedObjects:
Optional<Boolean>If
true, the response will include additional objects that are related to the requested objects. Related objects are defined as any objects referenced by ID by the results in theobjectsfield of the response. These objects are put in therelated_objectsfield. Setting this totrueis helpful when the objects are needed for immediate display to a user. This process only goes one level deep. Objects referenced by the related objects will not be included. For example,if the
objectsfield of the response contains a CatalogItem, its associated CatalogCategory objects, CatalogTax objects, CatalogImage objects and CatalogModifierLists will be returned in therelated_objectsfield of the response. If theobjectsfield of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in therelated_objectsfield of the response.Default value:
false
-
catalogVersion:
Optional<Long>The specific version of the catalog objects to be included in the response. This allows you to retrieve historical versions of objects. The specified version value is matched against the CatalogObjects'
versionattribute. If not included, results will be from the current version of the catalog.
-
includeDeletedObjects:
Optional<Boolean>β Indicates whether to include (true) or not (false) in the response deleted objects, namely, those with theis_deletedattribute set totrue.
-
includeCategoryPathToRoot:
Optional<Boolean>Specifies whether or not to include the
path_to_rootlist for each returned category instance. Thepath_to_rootlist consists ofCategoryPathToRootNodeobjects and specifies the path that starts with the immediate parent category of the returned category and ends with its root category. If the returned category is a top-level category, thepath_to_rootlist is empty and is not returned in the response payload.
-
-
client.catalog.batchUpsert(request) -> BatchUpsertCatalogObjectsResponse
-
π Description
-
-
Creates or updates up to 10,000 target objects based on the provided list of objects. The target objects are grouped into batches and each batch is inserted/updated in an all-or-nothing manner. If an object within a batch is malformed in some way, or violates a database constraint, the entire batch containing that item will be disregarded. However, other batches in the same request may still succeed. Each batch may contain up to 1,000 objects, and batches will be processed in order as long as the total object count for the request (items, variations, modifier lists, discounts, and taxes) is no more than 10,000.
To ensure consistency, only one update request is processed at a time per seller account. While one (batch or non-batch) update request is being processed, other (batched and non-batched) update requests are rejected with the
429error code.
-
π Usage
-
-
client.catalog().batchUpsert( BatchUpsertCatalogObjectsRequest .builder() .idempotencyKey("789ff020-f723-43a9-b4b5-43b5dc1fa3dc") .batches( Arrays.asList( CatalogObjectBatch .builder() .objects( Arrays.asList( CatalogObject.item( CatalogObjectItem .builder() .id("id") .build() ), CatalogObject.item( CatalogObjectItem .builder() .id("id") .build() ), CatalogObject.item( CatalogObjectItem .builder() .id("id") .build() ), CatalogObject.tax( CatalogObjectTax .builder() .id("id") .build() ) ) ) .build() ) ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA value you specify that uniquely identifies this request among all your requests. A common way to create a valid idempotency key is to use a Universally unique identifier (UUID).
If you're unsure whether a particular request was successful, you can reattempt it with the same idempotency key without worrying about creating duplicate objects.
See Idempotency for more information.
-
batches:
List<CatalogObjectBatch>A batch of CatalogObjects to be inserted/updated atomically. The objects within a batch will be inserted in an all-or-nothing fashion, i.e., if an error occurs attempting to insert or update an object within a batch, the entire batch will be rejected. However, an error in one batch will not affect other batches within the same request.
For each object, its
updated_atfield is ignored and replaced with a current timestamp, and itsis_deletedfield must not be set totrue.To modify an existing object, supply its ID. To create a new object, use an ID starting with
#. These IDs may be used to create relationships between an object and attributes of other objects that reference it. For example, you can create a CatalogItem with ID#ABCand a CatalogItemVariation with itsitem_idattribute set to#ABCin order to associate the CatalogItemVariation with its parent CatalogItem.Any
#-prefixed IDs are valid only within a single atomic batch, and will be replaced by server-generated IDs.Each batch may contain up to 1,000 objects. The total number of objects across all batches for a single request may not exceed 10,000. If either of these limits is violated, an error will be returned and no objects will be inserted or updated.
-
-
client.catalog.info() -> CatalogInfoResponse
-
π Description
-
-
Retrieves information about the Square Catalog API, such as batch size limits that can be used by the
BatchUpsertCatalogObjectsendpoint.
-
π Usage
-
-
client.catalog().info();
-
-
client.catalog.list() -> SyncPagingIterable<CatalogObject>
-
π Description
-
-
Returns a list of all CatalogObjects of the specified types in the catalog.
The
typesparameter is specified as a comma-separated list of the CatalogObjectType values, for example, "ITEM,ITEM_VARIATION,MODIFIER,MODIFIER_LIST,CATEGORY,DISCOUNT,TAX,IMAGE".Important: ListCatalog does not return deleted catalog items. To retrieve deleted catalog items, use SearchCatalogObjects and set the
include_deleted_objectsattribute value totrue.
-
π Usage
-
-
client.catalog().list( ListCatalogRequest .builder() .cursor("cursor") .types("types") .catalogVersion(1000000L) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>The pagination cursor returned in the previous response. Leave unset for an initial request. The page size is currently set to be 100. See Pagination for more information.
-
types:
Optional<String>An optional case-insensitive, comma-separated list of object types to retrieve.
The valid values are defined in the CatalogObjectType enum, for example,
ITEM,ITEM_VARIATION,CATEGORY,DISCOUNT,TAX,MODIFIER,MODIFIER_LIST,IMAGE, etc.If this is unspecified, the operation returns objects of all the top level types at the version of the Square API used to make the request. Object types that are nested onto other object types are not included in the defaults.
At the current API version the default object types are: ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS.
-
catalogVersion:
Optional<Long>The specific version of the catalog objects to be included in the response. This allows you to retrieve historical versions of objects. The specified version value is matched against the CatalogObjects'
versionattribute. If not included, results will be from the current version of the catalog.
-
-
client.catalog.search(request) -> SearchCatalogObjectsResponse
-
π Description
-
-
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.
This (
SearchCatalogObjects) endpoint differs from the SearchCatalogItems endpoint in the following aspects:SearchCatalogItemscan only search for items or item variations, whereasSearchCatalogObjectscan search for any type of catalog objects.SearchCatalogItemssupports the custom attribute query filters to return items or item variations that contain custom attribute values, whereSearchCatalogObjectsdoes not.SearchCatalogItemsdoes not support theinclude_deleted_objectsfilter to search for deleted items or item variations, whereasSearchCatalogObjectsdoes.- The both endpoints have different call conventions, including the query filter formats.
-
π Usage
-
-
client.catalog().search( SearchCatalogObjectsRequest .builder() .objectTypes( Optional.of( Arrays.asList(CatalogObjectType.ITEM) ) ) .query( CatalogQuery .builder() .prefixQuery( CatalogQueryPrefix .builder() .attributeName("name") .attributePrefix("tea") .build() ) .build() ) .limit(100) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>The pagination cursor returned in the previous response. Leave unset for an initial request. See Pagination for more information.
-
objectTypes:
Optional<List<CatalogObjectType>>The desired set of object types to appear in the search results.
If this is unspecified, the operation returns objects of all the top level types at the version of the Square API used to make the request. Object types that are nested onto other object types are not included in the defaults.
At the current API version the default object types are: ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS.
Note that if you wish for the query to return objects belonging to nested types (i.e., COMPONENT, IMAGE, ITEM_OPTION_VAL, ITEM_VARIATION, or MODIFIER), you must explicitly include all the types of interest in this field.
-
includeDeletedObjects:
Optional<Boolean>β Iftrue, deleted objects will be included in the results. Defaults tofalse. Deleted objects will have theiris_deletedfield set totrue. Ifinclude_deleted_objectsistrue, then theinclude_category_path_to_rootrequest parameter must befalse. Both properties cannot betrueat the same time.
-
includeRelatedObjects:
Optional<Boolean>If
true, the response will include additional objects that are related to the requested objects. Related objects are objects that are referenced by object ID by the objects in the response. This is helpful if the objects are being fetched for immediate display to a user. This process only goes one level deep. Objects referenced by the related objects will not be included. For example:If the
objectsfield of the response contains a CatalogItem, its associated CatalogCategory objects, CatalogTax objects, CatalogImage objects and CatalogModifierLists will be returned in therelated_objectsfield of the response. If theobjectsfield of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in therelated_objectsfield of the response.Default value:
false
-
beginTime:
Optional<String>Return objects modified after this timestamp, in RFC 3339 format, e.g.,
2016-09-04T23:59:33.123Z. The timestamp is exclusive - objects with a timestamp equal tobegin_timewill not be included in the response.
-
query:
Optional<CatalogQuery>β A query to be used to filter or sort the results. If no query is specified, the entire catalog will be returned.
-
limit:
Optional<Integer>A limit on the number of results to be returned in a single page. The limit is advisory - the implementation may return more or fewer results. If the supplied limit is negative, zero, or is higher than the maximum limit of 1,000, it will be ignored.
-
includeCategoryPathToRoot:
Optional<Boolean>β Specifies whether or not to include thepath_to_rootlist for each returned category instance. Thepath_to_rootlist consists ofCategoryPathToRootNodeobjects and specifies the path that starts with the immediate parent category of the returned category and ends with its root category. If the returned category is a top-level category, thepath_to_rootlist is empty and is not returned in the response payload. Ifinclude_category_path_to_rootistrue, then theinclude_deleted_objectsrequest parameter must befalse. Both properties cannot betrueat the same time.
-
-
client.catalog.searchItems(request) -> SearchCatalogItemsResponse
-
π Description
-
-
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.
This (
SearchCatalogItems) endpoint differs from the SearchCatalogObjects endpoint in the following aspects:SearchCatalogItemscan only search for items or item variations, whereasSearchCatalogObjectscan search for any type of catalog objects.SearchCatalogItemssupports the custom attribute query filters to return items or item variations that contain custom attribute values, whereSearchCatalogObjectsdoes not.SearchCatalogItemsdoes not support theinclude_deleted_objectsfilter to search for deleted items or item variations, whereasSearchCatalogObjectsdoes.- The both endpoints use different call conventions, including the query filter formats.
-
π Usage
-
-
client.catalog().searchItems( SearchCatalogItemsRequest .builder() .textFilter("red") .categoryIds( Optional.of( Arrays.asList("WINE_CATEGORY_ID") ) ) .stockLevels( Optional.of( Arrays.asList(SearchCatalogItemsRequestStockLevel.OUT, SearchCatalogItemsRequestStockLevel.LOW) ) ) .enabledLocationIds( Optional.of( Arrays.asList("ATL_LOCATION_ID") ) ) .limit(100) .sortOrder(SortOrder.ASC) .productTypes( Optional.of( Arrays.asList(CatalogItemProductType.REGULAR) ) ) .customAttributeFilters( Optional.of( Arrays.asList( CustomAttributeFilter .builder() .customAttributeDefinitionId("VEGAN_DEFINITION_ID") .boolFilter(true) .build(), CustomAttributeFilter .builder() .customAttributeDefinitionId("BRAND_DEFINITION_ID") .stringFilter("Dark Horse") .build(), CustomAttributeFilter .builder() .key("VINTAGE") .numberFilter( Range .builder() .min("min") .max("max") .build() ) .build(), CustomAttributeFilter .builder() .customAttributeDefinitionId("VARIETAL_DEFINITION_ID") .build() ) ) ) .build() );
-
βοΈ Parameters
-
-
textFilter:
Optional<String>The text filter expression to return items or item variations containing specified text in the
name,description, orabbreviationattribute value of an item, or in thename,sku, orupcattribute value of an item variation.
-
categoryIds:
Optional<List<String>>β The category id query expression to return items containing the specified category IDs.
-
stockLevels:
Optional<List<SearchCatalogItemsRequestStockLevel>>The stock-level query expression to return item variations with the specified stock levels. See SearchCatalogItemsRequestStockLevel for possible values
-
enabledLocationIds:
Optional<List<String>>β The enabled-location query expression to return items and item variations having specified enabled locations.
-
cursor:
Optional<String>β The pagination token, returned in the previous response, used to fetch the next batch of pending results.
-
limit:
Optional<Integer>β The maximum number of results to return per page. The default value is 100.
-
sortOrder:
Optional<SortOrder>The order to sort the results by item names. The default sort order is ascending (
ASC). See SortOrder for possible values
-
productTypes:
Optional<List<CatalogItemProductType>>β The product types query expression to return items or item variations having the specified product types.
-
customAttributeFilters:
Optional<List<CustomAttributeFilter>>The customer-attribute filter to return items or item variations matching the specified custom attribute expressions. A maximum number of 10 custom attribute expressions are supported in a single call to the SearchCatalogItems endpoint.
-
archivedState:
Optional<ArchivedState>β The query filter to return not archived (ARCHIVED_STATE_NOT_ARCHIVED), archived (ARCHIVED_STATE_ARCHIVED), or either type (ARCHIVED_STATE_ALL) of items.
-
-
client.catalog.updateItemModifierLists(request) -> UpdateItemModifierListsResponse
-
π Description
-
-
Updates the CatalogModifierList objects that apply to the targeted CatalogItem without having to perform an upsert on the entire item.
-
π Usage
-
-
client.catalog().updateItemModifierLists( UpdateItemModifierListsRequest .builder() .itemIds( Arrays.asList("H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6") ) .modifierListsToEnable( Optional.of( Arrays.asList("H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6") ) ) .modifierListsToDisable( Optional.of( Arrays.asList("7WRC16CJZDVLSNDQ35PP6YAD") ) ) .build() );
-
βοΈ Parameters
-
-
itemIds:
List<String>β The IDs of the catalog items associated with the CatalogModifierList objects being updated.
-
modifierListsToEnable:
Optional<List<String>>The IDs of the CatalogModifierList objects to enable for the CatalogItem. At least one of
modifier_lists_to_enableormodifier_lists_to_disablemust be specified.
-
modifierListsToDisable:
Optional<List<String>>The IDs of the CatalogModifierList objects to disable for the CatalogItem. At least one of
modifier_lists_to_enableormodifier_lists_to_disablemust be specified.
-
-
client.catalog.updateItemTaxes(request) -> UpdateItemTaxesResponse
-
π Description
-
-
Updates the CatalogTax objects that apply to the targeted CatalogItem without having to perform an upsert on the entire item.
-
π Usage
-
-
client.catalog().updateItemTaxes( UpdateItemTaxesRequest .builder() .itemIds( Arrays.asList("H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6") ) .taxesToEnable( Optional.of( Arrays.asList("4WRCNHCJZDVLSNDQ35PP6YAD") ) ) .taxesToDisable( Optional.of( Arrays.asList("AQCEGCEBBQONINDOHRGZISEX") ) ) .build() );
-
βοΈ Parameters
-
-
itemIds:
List<String>IDs for the CatalogItems associated with the CatalogTax objects being updated. No more than 1,000 IDs may be provided.
-
taxesToEnable:
Optional<List<String>>IDs of the CatalogTax objects to enable. At least one of
taxes_to_enableortaxes_to_disablemust be specified.
-
taxesToDisable:
Optional<List<String>>IDs of the CatalogTax objects to disable. At least one of
taxes_to_enableortaxes_to_disablemust be specified.
-
-
Channels
client.channels.list() -> SyncPagingIterable<Channel>
-
π Description
π Usage
-
-
client.channels().list( ListChannelsRequest .builder() .referenceType(ReferenceType.UNKNOWN_TYPE) .referenceId("reference_id") .status(ChannelStatus.ACTIVE) .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
referenceType:
Optional<ReferenceType>β Type of reference associated to channel
-
referenceId:
Optional<String>β id of reference associated to channel
-
status:
Optional<ChannelStatus>β Status of channel
-
cursor:
Optional<String>β Cursor to fetch the next result
-
limit:
Optional<Integer>Maximum number of results to return. When not provided the returned results will be cap at 100 channels.
-
-
client.channels.bulkRetrieve(request) -> BulkRetrieveChannelsResponse
-
π Description
π Usage
-
-
client.channels().bulkRetrieve( BulkRetrieveChannelsRequest .builder() .channelIds( Arrays.asList("CH_9C03D0B59", "CH_6X139B5MN", "NOT_EXISTING") ) .build() );
-
βοΈ Parameters
-
-
channelIds:
List<String>
-
-
client.channels.get(channelId) -> RetrieveChannelResponse
-
π Description
π Usage
-
-
client.channels().get( GetChannelsRequest .builder() .channelId("channel_id") .build() );
-
βοΈ Parameters
-
-
channelId:
Stringβ A channel id
-
-
Customers
client.customers.list() -> SyncPagingIterable<Customer>
-
π Description
-
-
Lists customer profiles associated with a Square account.
Under normal operating conditions, newly created or updated customer profiles become available for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated profiles can take closer to one minute or longer, especially during network incidents and outages.
-
π Usage
-
-
client.customers().list( ListCustomersRequest .builder() .cursor("cursor") .limit(1) .sortField(CustomerSortField.DEFAULT) .sortOrder(SortOrder.DESC) .count(true) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for your original query.
For more information, see Pagination.
-
limit:
Optional<Integer>The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. If the specified limit is less than 1 or greater than 100, Square returns a
400 VALUE_TOO_LOWor400 VALUE_TOO_HIGHerror. The default value is 100.For more information, see Pagination.
-
sortField:
Optional<CustomerSortField>Indicates how customers should be sorted.
The default value is
DEFAULT.
-
sortOrder:
Optional<SortOrder>Indicates whether customers should be sorted in ascending (
ASC) or descending (DESC) order.The default value is
ASC.
-
count:
Optional<Boolean>Indicates whether to return the total count of customers in the
countfield of the response.The default value is
false.
-
-
client.customers.create(request) -> CreateCustomerResponse
-
π Description
-
-
Creates a new customer for a business.
You must provide at least one of the following values in your request to this endpoint:
given_namefamily_namecompany_nameemail_addressphone_number
-
π Usage
-
-
client.customers().create( CreateCustomerRequest .builder() .givenName("Amelia") .familyName("Earhart") .emailAddress("Amelia.Earhart@example.com") .address( Address .builder() .addressLine1("500 Electric Ave") .addressLine2("Suite 600") .locality("New York") .administrativeDistrictLevel1("NY") .postalCode("10003") .country(Country.US) .build() ) .phoneNumber("+1-212-555-4240") .referenceId("YOUR_REFERENCE_ID") .note("a customer") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>The idempotency key for the request. For more information, see Idempotency.
-
givenName:
Optional<String>The given name (that is, the first name) associated with the customer profile.
The maximum length for this value is 300 characters.
-
familyName:
Optional<String>The family name (that is, the last name) associated with the customer profile.
The maximum length for this value is 300 characters.
-
companyName:
Optional<String>A business name associated with the customer profile.
The maximum length for this value is 500 characters.
-
nickname:
Optional<String>A nickname for the customer profile.
The maximum length for this value is 100 characters.
-
emailAddress:
Optional<String>The email address associated with the customer profile.
The maximum length for this value is 254 characters.
-
address:
Optional<Address>The physical address associated with the customer profile. For maximum length constraints, see Customer addresses. The
first_nameandlast_namefields are ignored if they are present in the request.
-
phoneNumber:
Optional<String>The phone number associated with the customer profile. The phone number must be valid and can contain 9β16 digits, with an optional
+prefix and country code. For more information, see Customer phone numbers.
-
referenceId:
Optional<String>An optional second ID used to associate the customer profile with an entity in another system.
The maximum length for this value is 100 characters.
-
note:
Optional<String>β A custom note associated with the customer profile.
-
birthday:
Optional<String>The birthday associated with the customer profile, in
YYYY-MM-DDorMM-DDformat. For example, specify1998-09-21for September 21, 1998, or09-21for September 21. Birthdays are returned inYYYY-MM-DDformat, whereYYYYis the specified birth year or0000if a birth year is not specified.
-
taxIds:
Optional<CustomerTaxIds>The tax ID associated with the customer profile. This field is available only for customers of sellers in EU countries or the United Kingdom. For more information, see Customer tax IDs.
-
-
client.customers.batchCreate(request) -> BulkCreateCustomersResponse
-
π Description
-
-
Creates multiple customer profiles for a business.
This endpoint takes a map of individual create requests and returns a map of responses.
You must provide at least one of the following values in each create request:
given_namefamily_namecompany_nameemail_addressphone_number
-
π Usage
-
-
client.customers().batchCreate( BulkCreateCustomersRequest .builder() .customers( new HashMap<String, BulkCreateCustomerData>() {{ put("8bb76c4f-e35d-4c5b-90de-1194cd9179f0", BulkCreateCustomerData .builder() .givenName(Optional.of("Amelia")) .familyName(Optional.of("Earhart")) .emailAddress(Optional.of("Amelia.Earhart@example.com")) .address( Optional.of( Address .builder() .addressLine1(Optional.of("500 Electric Ave")) .addressLine2(Optional.of("Suite 600")) .locality(Optional.of("New York")) .administrativeDistrictLevel1(Optional.of("NY")) .postalCode(Optional.of("10003")) .country(Optional.of(Country.US)) .build() ) ) .phoneNumber(Optional.of("+1-212-555-4240")) .referenceId(Optional.of("YOUR_REFERENCE_ID")) .note(Optional.of("a customer")) .build()); put("d1689f23-b25d-4932-b2f0-aed00f5e2029", BulkCreateCustomerData .builder() .givenName(Optional.of("Marie")) .familyName(Optional.of("Curie")) .emailAddress(Optional.of("Marie.Curie@example.com")) .address( Optional.of( Address .builder() .addressLine1(Optional.of("500 Electric Ave")) .addressLine2(Optional.of("Suite 601")) .locality(Optional.of("New York")) .administrativeDistrictLevel1(Optional.of("NY")) .postalCode(Optional.of("10003")) .country(Optional.of(Country.US)) .build() ) ) .phoneNumber(Optional.of("+1-212-444-4240")) .referenceId(Optional.of("YOUR_REFERENCE_ID")) .note(Optional.of("another customer")) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
customers:
Map<String, BulkCreateCustomerData>A map of 1 to 100 individual create requests, represented by
idempotency key: { customer data }key-value pairs.Each key is an idempotency key that uniquely identifies the create request. Each value contains the customer data used to create the customer profile.
-
-
client.customers.bulkDeleteCustomers(request) -> BulkDeleteCustomersResponse
-
π Description
-
-
Deletes multiple customer profiles.
The endpoint takes a list of customer IDs and returns a map of responses.
-
π Usage
-
-
client.customers().bulkDeleteCustomers( BulkDeleteCustomersRequest .builder() .customerIds( Arrays.asList("8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8") ) .build() );
-
βοΈ Parameters
-
-
customerIds:
List<String>β The IDs of the customer profiles to delete.
-
-
client.customers.bulkRetrieveCustomers(request) -> BulkRetrieveCustomersResponse
-
π Description
-
-
Retrieves multiple customer profiles.
This endpoint takes a list of customer IDs and returns a map of responses.
-
π Usage
-
-
client.customers().bulkRetrieveCustomers( BulkRetrieveCustomersRequest .builder() .customerIds( Arrays.asList("8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8") ) .build() );
-
βοΈ Parameters
-
-
customerIds:
List<String>β The IDs of the customer profiles to retrieve.
-
-
client.customers.bulkUpdateCustomers(request) -> BulkUpdateCustomersResponse
-
π Description
-
-
Updates multiple customer profiles.
This endpoint takes a map of individual update requests and returns a map of responses.
-
π Usage
-
-
client.customers().bulkUpdateCustomers( BulkUpdateCustomersRequest .builder() .customers( new HashMap<String, BulkUpdateCustomerData>() {{ put("8DDA5NZVBZFGAX0V3HPF81HHE0", BulkUpdateCustomerData .builder() .emailAddress(Optional.of("New.Amelia.Earhart@example.com")) .note(Optional.of("updated customer note")) .version(Optional.of(2L)) .build()); put("N18CPRVXR5214XPBBA6BZQWF3C", BulkUpdateCustomerData .builder() .givenName(Optional.of("Marie")) .familyName(Optional.of("Curie")) .version(Optional.of(0L)) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
customers:
Map<String, BulkUpdateCustomerData>A map of 1 to 100 individual update requests, represented by
customer ID: { customer data }key-value pairs.Each key is the ID of the customer profile to update. To update a customer profile that was created by merging existing profiles, provide the ID of the newly created profile.
Each value contains the updated customer data. Only new or changed fields are required. To add or update a field, specify the new value. To remove a field, specify
null.
-
-
client.customers.search(request) -> SearchCustomersResponse
-
π Description
-
-
Searches the customer profiles associated with a Square account using one or more supported query filters.
Calling
SearchCustomerswithout any explicit query filter returns all customer profiles ordered alphabetically based ongiven_nameandfamily_name.Under normal operating conditions, newly created or updated customer profiles become available for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated profiles can take closer to one minute or longer, especially during network incidents and outages.
-
π Usage
-
-
client.customers().search( SearchCustomersRequest .builder() .limit(2L) .query( CustomerQuery .builder() .filter( CustomerFilter .builder() .creationSource( CustomerCreationSourceFilter .builder() .values( Optional.of( Arrays.asList(CustomerCreationSource.THIRD_PARTY) ) ) .rule(CustomerInclusionExclusion.INCLUDE) .build() ) .createdAt( TimeRange .builder() .startAt("2018-01-01T00:00:00-00:00") .endAt("2018-02-01T00:00:00-00:00") .build() ) .emailAddress( CustomerTextFilter .builder() .fuzzy("example.com") .build() ) .groupIds( FilterValue .builder() .all( Optional.of( Arrays.asList("545AXB44B4XXWMVQ4W8SBT3HHF") ) ) .build() ) .build() ) .sort( CustomerSort .builder() .field(CustomerSortField.CREATED_AT) .order(SortOrder.ASC) .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>Include the pagination cursor in subsequent calls to this endpoint to retrieve the next set of results associated with the original query.
For more information, see Pagination.
-
limit:
Optional<Long>The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. If the specified limit is invalid, Square returns a
400 VALUE_TOO_LOWor400 VALUE_TOO_HIGHerror. The default value is 100.For more information, see Pagination.
-
query:
Optional<CustomerQuery>The filtering and sorting criteria for the search request. If a query is not specified, Square returns all customer profiles ordered alphabetically by
given_nameandfamily_name.
-
count:
Optional<Boolean>Indicates whether to return the total count of matching customers in the
countfield of the response.The default value is
false.
-
-
client.customers.get(customerId) -> GetCustomerResponse
-
π Description
-
-
Returns details for a single customer.
-
π Usage
-
-
client.customers().get( GetCustomersRequest .builder() .customerId("customer_id") .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the customer to retrieve.
-
-
client.customers.update(customerId, request) -> UpdateCustomerResponse
-
π Description
-
-
Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. To add or update a field, specify the new value. To remove a field, specify
null.To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
-
π Usage
-
-
client.customers().update( UpdateCustomerRequest .builder() .customerId("customer_id") .emailAddress("New.Amelia.Earhart@example.com") .note("updated customer note") .version(2L) .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the customer to update.
-
givenName:
Optional<String>The given name (that is, the first name) associated with the customer profile.
The maximum length for this value is 300 characters.
-
familyName:
Optional<String>The family name (that is, the last name) associated with the customer profile.
The maximum length for this value is 300 characters.
-
companyName:
Optional<String>A business name associated with the customer profile.
The maximum length for this value is 500 characters.
-
nickname:
Optional<String>A nickname for the customer profile.
The maximum length for this value is 100 characters.
-
emailAddress:
Optional<String>The email address associated with the customer profile.
The maximum length for this value is 254 characters.
-
address:
Optional<Address>The physical address associated with the customer profile. Only new or changed fields are required in the request.
For maximum length constraints, see Customer addresses. The
first_nameandlast_namefields are ignored if they are present in the request.
-
phoneNumber:
Optional<String>The phone number associated with the customer profile. The phone number must be valid and can contain 9β16 digits, with an optional
+prefix and country code. For more information, see Customer phone numbers.
-
referenceId:
Optional<String>An optional second ID used to associate the customer profile with an entity in another system.
The maximum length for this value is 100 characters.
-
note:
Optional<String>β A custom note associated with the customer profile.
-
birthday:
Optional<String>The birthday associated with the customer profile, in
YYYY-MM-DDorMM-DDformat. For example, specify1998-09-21for September 21, 1998, or09-21for September 21. Birthdays are returned inYYYY-MM-DDformat, whereYYYYis the specified birth year or0000if a birth year is not specified.
-
version:
Optional<Long>The current version of the customer profile.
As a best practice, you should include this field to enable optimistic concurrency control. For more information, see Update a customer profile.
-
taxIds:
Optional<CustomerTaxIds>The tax ID associated with the customer profile. This field is available only for customers of sellers in EU countries or the United Kingdom. For more information, see Customer tax IDs.
-
-
client.customers.delete(customerId) -> DeleteCustomerResponse
-
π Description
-
-
Deletes a customer profile from a business.
To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
-
π Usage
-
-
client.customers().delete( DeleteCustomersRequest .builder() .customerId("customer_id") .version(1000000L) .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the customer to delete.
-
version:
Optional<Long>The current version of the customer profile.
As a best practice, you should include this parameter to enable optimistic concurrency control. For more information, see Delete a customer profile.
-
-
Devices
client.devices.list() -> SyncPagingIterable<Device>
-
π Description
-
-
List devices associated with the merchant. Currently, only Terminal API devices are supported.
-
π Usage
-
-
client.devices().list( ListDevicesRequest .builder() .cursor("cursor") .sortOrder(SortOrder.DESC) .limit(1) .locationId("location_id") .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. See Pagination for more information.
-
sortOrder:
Optional<SortOrder>The order in which results are listed.
ASC- Oldest to newest.DESC- Newest to oldest (default).
-
limit:
Optional<Integer>β The number of results to return in a single page.
-
locationId:
Optional<String>β If present, only returns devices at the target location.
-
-
client.devices.get(deviceId) -> GetDeviceResponse
-
π Description
-
-
Retrieves Device with the associated
device_id.
-
π Usage
-
-
client.devices().get( GetDevicesRequest .builder() .deviceId("device_id") .build() );
-
βοΈ Parameters
-
-
deviceId:
Stringβ The unique ID for the desiredDevice.
-
-
Disputes
client.disputes.list() -> SyncPagingIterable<Dispute>
-
π Description
-
-
Returns a list of disputes associated with a particular account.
-
π Usage
-
-
client.disputes().list( ListDisputesRequest .builder() .cursor("cursor") .states(DisputeState.INQUIRY_EVIDENCE_REQUIRED) .locationId("location_id") .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. For more information, see Pagination.
-
states:
Optional<DisputeState>β The dispute states used to filter the result. If not specified, the endpoint returns all disputes.
-
locationId:
Optional<String>The ID of the location for which to return a list of disputes. If not specified, the endpoint returns disputes associated with all locations.
-
-
client.disputes.get(disputeId) -> GetDisputeResponse
-
π Description
-
-
Returns details about a specific dispute.
-
π Usage
-
-
client.disputes().get( GetDisputesRequest .builder() .disputeId("dispute_id") .build() );
-
βοΈ Parameters
-
-
disputeId:
Stringβ The ID of the dispute you want more details about.
-
-
client.disputes.accept(disputeId) -> AcceptDisputeResponse
-
π Description
-
-
Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and updates the dispute state to ACCEPTED.
Square debits the disputed amount from the sellerβs Square account. If the Square account does not have sufficient funds, Square debits the associated bank account.
-
π Usage
-
-
client.disputes().accept( AcceptDisputesRequest .builder() .disputeId("dispute_id") .build() );
-
βοΈ Parameters
-
-
disputeId:
Stringβ The ID of the dispute you want to accept.
-
-
client.disputes.createEvidenceFile(disputeId, request) -> CreateDisputeEvidenceFileResponse
-
π Description
-
-
Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats.
-
π Usage
-
-
client.disputes().createEvidenceFile( CreateEvidenceFileDisputesRequest .builder() .disputeId("dispute_id") .build() );
-
βοΈ Parameters
-
-
disputeId:
Stringβ The ID of the dispute for which you want to upload evidence.
-
-
client.disputes.createEvidenceText(disputeId, request) -> CreateDisputeEvidenceTextResponse
-
π Description
-
-
Uploads text to use as evidence for a dispute challenge.
-
π Usage
-
-
client.disputes().createEvidenceText( CreateDisputeEvidenceTextRequest .builder() .disputeId("dispute_id") .idempotencyKey("ed3ee3933d946f1514d505d173c82648") .evidenceText("1Z8888888888888888") .evidenceType(DisputeEvidenceType.TRACKING_NUMBER) .build() );
-
βοΈ Parameters
-
-
disputeId:
Stringβ The ID of the dispute for which you want to upload evidence.
-
idempotencyKey:
Stringβ A unique key identifying the request. For more information, see Idempotency.
-
evidenceType:
Optional<DisputeEvidenceType>The type of evidence you are uploading. See DisputeEvidenceType for possible values
-
evidenceText:
Stringβ The evidence string.
-
-
client.disputes.submitEvidence(disputeId) -> SubmitEvidenceResponse
-
π Description
-
-
Submits evidence to the cardholder's bank.
The evidence submitted by this endpoint includes evidence uploaded using the CreateDisputeEvidenceFile and CreateDisputeEvidenceText endpoints and evidence automatically provided by Square, when available. Evidence cannot be removed from a dispute after submission.
-
π Usage
-
-
client.disputes().submitEvidence( SubmitEvidenceDisputesRequest .builder() .disputeId("dispute_id") .build() );
-
βοΈ Parameters
-
-
disputeId:
Stringβ The ID of the dispute for which you want to submit evidence.
-
-
Employees
client.employees.list() -> SyncPagingIterable<Employee>
-
π Description
π Usage
-
-
client.employees().list( ListEmployeesRequest .builder() .locationId("location_id") .status(EmployeeStatus.ACTIVE) .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
locationId:
Optional<String>β
-
status:
Optional<EmployeeStatus>β Specifies the EmployeeStatus to filter the employee by.
-
limit:
Optional<Integer>β The number of employees to be returned on each page.
-
cursor:
Optional<String>β The token required to retrieve the specified page of results.
-
-
client.employees.get(id) -> GetEmployeeResponse
-
π Description
π Usage
-
-
client.employees().get( GetEmployeesRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ UUID for the employee that was requested.
-
-
Events
client.events.searchEvents(request) -> SearchEventsResponse
-
π Description
-
-
Search for Square API events that occur within a 28-day timeframe.
-
π Usage
-
-
client.events().searchEvents( SearchEventsRequest .builder() .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of events for your original query.
For more information, see Pagination.
-
limit:
Optional<Integer>The maximum number of events to return in a single page. The response might contain fewer events. The default value is 100, which is also the maximum allowed value.
For more information, see Pagination.
Default: 100
-
query:
Optional<SearchEventsQuery>β The filtering and sorting criteria for the search request. To retrieve additional pages using a cursor, you must use the original query.
-
-
client.events.disableEvents() -> DisableEventsResponse
-
π Description
-
-
Disables events to prevent them from being searchable. All events are disabled by default. You must enable events to make them searchable. Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
-
π Usage
-
-
client.events().disableEvents();
-
-
client.events.enableEvents() -> EnableEventsResponse
-
π Description
-
-
Enables events to make them searchable. Only events that occur while in the enabled state are searchable.
-
π Usage
-
-
client.events().enableEvents();
-
-
client.events.listEventTypes() -> ListEventTypesResponse
-
π Description
-
-
Lists all event types that you can subscribe to as webhooks or query using the Events API.
-
π Usage
-
-
client.events().listEventTypes( ListEventTypesRequest .builder() .apiVersion("api_version") .build() );
-
βοΈ Parameters
-
-
apiVersion:
Optional<String>β The API version for which to list event types. Setting this field overrides the default version used by the application.
-
-
GiftCards
client.giftCards.list() -> SyncPagingIterable<GiftCard>
-
π Description
-
-
Lists all gift cards. You can specify optional filters to retrieve a subset of the gift cards. Results are sorted by
created_atin ascending order.
-
π Usage
-
-
client.giftCards().list( ListGiftCardsRequest .builder() .type("type") .state("state") .limit(1) .cursor("cursor") .customerId("customer_id") .build() );
-
βοΈ Parameters
-
-
type:
Optional<String>If a type is provided, the endpoint returns gift cards of the specified type. Otherwise, the endpoint returns gift cards of all types.
-
state:
Optional<String>If a state is provided, the endpoint returns the gift cards in the specified state. Otherwise, the endpoint returns the gift cards of all states.
-
limit:
Optional<Integer>If a limit is provided, the endpoint returns only the specified number of results per page. The maximum value is 200. The default value is 30. For more information, see Pagination.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. If a cursor is not provided, the endpoint returns the first page of the results. For more information, see Pagination.
-
customerId:
Optional<String>β If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer.
-
-
client.giftCards.create(request) -> CreateGiftCardResponse
-
π Description
-
-
Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card has a
PENDINGstate. To activate a gift card so that it can be redeemed for purchases, call CreateGiftCardActivity and create anACTIVATEactivity with the initial balance. Alternatively, you can use RefundPayment to refund a payment to the new gift card.
-
π Usage
-
-
client.giftCards().create( CreateGiftCardRequest .builder() .idempotencyKey("NC9Tm69EjbjtConu") .locationId("81FN9BNFZTKS4") .giftCard( GiftCard .builder() .type(GiftCardType.DIGITAL) .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
locationId:
StringThe ID of the location where the gift card should be registered for reporting purposes. Gift cards can be redeemed at any of the seller's locations.
-
giftCard:
GiftCardThe gift card to create. The
typefield is required for this request. Thegan_sourceandganfields are included as follows:To direct Square to generate a 16-digit GAN, omit
gan_sourceandgan.To provide a custom GAN, include
gan_sourceandgan.- For
gan_source, specifyOTHER. - For
gan, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be unique for the seller and cannot start with the same bank identification number (BIN) as major credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly increase the risk of fraud. It is the responsibility of the developer to ensure the security of their custom GANs. For more information, see Custom GANs.
To register an unused, physical gift card that the seller previously ordered from Square, include
ganand provide the GAN that is printed on the gift card. - For
-
-
client.giftCards.getFromGan(request) -> GetGiftCardFromGanResponse
-
π Description
-
-
Retrieves a gift card using the gift card account number (GAN).
-
π Usage
-
-
client.giftCards().getFromGan( GetGiftCardFromGanRequest .builder() .gan("7783320001001635") .build() );
-
βοΈ Parameters
-
-
gan:
StringThe gift card account number (GAN) of the gift card to retrieve. The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported. Square-issued gift cards have 16-digit GANs.
-
-
client.giftCards.getFromNonce(request) -> GetGiftCardFromNonceResponse
-
π Description
-
-
Retrieves a gift card using a secure payment token that represents the gift card.
-
π Usage
-
-
client.giftCards().getFromNonce( GetGiftCardFromNonceRequest .builder() .nonce("cnon:7783322135245171") .build() );
-
βοΈ Parameters
-
-
nonce:
StringThe payment token of the gift card to retrieve. Payment tokens are generated by the Web Payments SDK or In-App Payments SDK.
-
-
client.giftCards.linkCustomer(giftCardId, request) -> LinkCustomerToGiftCardResponse
-
π Description
-
-
Links a customer to a gift card, which is also referred to as adding a card on file.
-
π Usage
-
-
client.giftCards().linkCustomer( LinkCustomerToGiftCardRequest .builder() .giftCardId("gift_card_id") .customerId("GKY0FZ3V717AH8Q2D821PNT2ZW") .build() );
-
βοΈ Parameters
-
-
giftCardId:
Stringβ The ID of the gift card to be linked.
-
customerId:
Stringβ The ID of the customer to link to the gift card.
-
-
client.giftCards.unlinkCustomer(giftCardId, request) -> UnlinkCustomerFromGiftCardResponse
-
π Description
-
-
Unlinks a customer from a gift card, which is also referred to as removing a card on file.
-
π Usage
-
-
client.giftCards().unlinkCustomer( UnlinkCustomerFromGiftCardRequest .builder() .giftCardId("gift_card_id") .customerId("GKY0FZ3V717AH8Q2D821PNT2ZW") .build() );
-
βοΈ Parameters
-
-
giftCardId:
Stringβ The ID of the gift card to be unlinked.
-
customerId:
Stringβ The ID of the customer to unlink from the gift card.
-
-
client.giftCards.get(id) -> GetGiftCardResponse
-
π Description
-
-
Retrieves a gift card using the gift card ID.
-
π Usage
-
-
client.giftCards().get( GetGiftCardsRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of the gift card to retrieve.
-
-
Inventory
client.inventory.deprecatedGetAdjustment(adjustmentId) -> GetInventoryAdjustmentResponse
-
π Description
-
-
Deprecated version of RetrieveInventoryAdjustment after the endpoint URL is updated to conform to the standard convention.
-
π Usage
-
-
client.inventory().deprecatedGetAdjustment( DeprecatedGetAdjustmentInventoryRequest .builder() .adjustmentId("adjustment_id") .build() );
-
βοΈ Parameters
-
-
adjustmentId:
Stringβ ID of the InventoryAdjustment to retrieve.
-
-
client.inventory.getAdjustment(adjustmentId) -> GetInventoryAdjustmentResponse
-
π Description
-
-
Returns the InventoryAdjustment object with the provided
adjustment_id.
-
π Usage
-
-
client.inventory().getAdjustment( GetAdjustmentInventoryRequest .builder() .adjustmentId("adjustment_id") .build() );
-
βοΈ Parameters
-
-
adjustmentId:
Stringβ ID of the InventoryAdjustment to retrieve.
-
-
client.inventory.deprecatedBatchChange(request) -> BatchChangeInventoryResponse
-
π Description
-
-
Deprecated version of BatchChangeInventory after the endpoint URL is updated to conform to the standard convention.
-
π Usage
-
-
client.inventory().deprecatedBatchChange( BatchChangeInventoryRequest .builder() .idempotencyKey("8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe") .changes( Optional.of( Arrays.asList( InventoryChange .builder() .type(InventoryChangeType.PHYSICAL_COUNT) .physicalCount( InventoryPhysicalCount .builder() .referenceId("1536bfbf-efed-48bf-b17d-a197141b2a92") .catalogObjectId("W62UWFY35CWMYGVWK6TWJDNI") .state(InventoryState.IN_STOCK) .locationId("C6W5YS5QM06F5") .quantity("53") .teamMemberId("LRK57NSQ5X7PUD05") .occurredAt("2016-11-16T22:25:24.878Z") .build() ) .build() ) ) ) .ignoreUnchangedCounts(true) .build() );
-
βοΈ Parameters
-
-
request:
BatchChangeInventoryRequest
-
-
client.inventory.deprecatedBatchGetChanges(request) -> BatchGetInventoryChangesResponse
-
π Description
-
-
Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL is updated to conform to the standard convention.
-
π Usage
-
-
client.inventory().deprecatedBatchGetChanges( BatchRetrieveInventoryChangesRequest .builder() .catalogObjectIds( Optional.of( Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI") ) ) .locationIds( Optional.of( Arrays.asList("C6W5YS5QM06F5") ) ) .types( Optional.of( Arrays.asList(InventoryChangeType.PHYSICAL_COUNT) ) ) .states( Optional.of( Arrays.asList(InventoryState.IN_STOCK) ) ) .updatedAfter("2016-11-01T00:00:00.000Z") .updatedBefore("2016-12-01T00:00:00.000Z") .build() );
-
βοΈ Parameters
-
-
request:
BatchRetrieveInventoryChangesRequest
-
-
client.inventory.deprecatedBatchGetCounts(request) -> BatchGetInventoryCountsResponse
-
π Description
-
-
Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL is updated to conform to the standard convention.
-
π Usage
-
-
client.inventory().deprecatedBatchGetCounts( BatchGetInventoryCountsRequest .builder() .catalogObjectIds( Optional.of( Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI") ) ) .locationIds( Optional.of( Arrays.asList("59TNP9SA8VGDA") ) ) .updatedAfter("2016-11-16T00:00:00.000Z") .build() );
-
βοΈ Parameters
-
-
request:
BatchGetInventoryCountsRequest
-
-
client.inventory.batchCreateChanges(request) -> BatchChangeInventoryResponse
-
π Description
-
-
Applies adjustments and counts to the provided item quantities.
On success: returns the current calculated counts for all objects referenced in the request. On failure: returns a list of related errors.
-
π Usage
-
-
client.inventory().batchCreateChanges( BatchChangeInventoryRequest .builder() .idempotencyKey("8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe") .changes( Optional.of( Arrays.asList( InventoryChange .builder() .type(InventoryChangeType.PHYSICAL_COUNT) .physicalCount( InventoryPhysicalCount .builder() .referenceId("1536bfbf-efed-48bf-b17d-a197141b2a92") .catalogObjectId("W62UWFY35CWMYGVWK6TWJDNI") .state(InventoryState.IN_STOCK) .locationId("C6W5YS5QM06F5") .quantity("53") .teamMemberId("LRK57NSQ5X7PUD05") .occurredAt("2016-11-16T22:25:24.878Z") .build() ) .build() ) ) ) .ignoreUnchangedCounts(true) .build() );
-
βοΈ Parameters
-
-
request:
BatchChangeInventoryRequest
-
-
client.inventory.batchGetChanges(request) -> SyncPagingIterable<InventoryChange>
-
π Description
-
-
Returns historical physical counts and adjustments based on the provided filter criteria.
Results are paginated and sorted in ascending order according their
occurred_attimestamp (oldest first).BatchRetrieveInventoryChanges is a catch-all query endpoint for queries that cannot be handled by other, simpler endpoints.
-
π Usage
-
-
client.inventory().batchGetChanges( BatchRetrieveInventoryChangesRequest .builder() .catalogObjectIds( Optional.of( Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI") ) ) .locationIds( Optional.of( Arrays.asList("C6W5YS5QM06F5") ) ) .types( Optional.of( Arrays.asList(InventoryChangeType.PHYSICAL_COUNT) ) ) .states( Optional.of( Arrays.asList(InventoryState.IN_STOCK) ) ) .updatedAfter("2016-11-01T00:00:00.000Z") .updatedBefore("2016-12-01T00:00:00.000Z") .build() );
-
βοΈ Parameters
-
-
request:
BatchRetrieveInventoryChangesRequest
-
-
client.inventory.batchGetCounts(request) -> SyncPagingIterable<InventoryCount>
-
π Description
-
-
Returns current counts for the provided CatalogObjects at the requested Locations.
Results are paginated and sorted in descending order according to their
calculated_attimestamp (newest first).When
updated_afteris specified, only counts that have changed since that time (based on the server timestamp for the most recent change) are returned. This allows clients to perform a "sync" operation, for example in response to receiving a Webhook notification.
-
π Usage
-
-
client.inventory().batchGetCounts( BatchGetInventoryCountsRequest .builder() .catalogObjectIds( Optional.of( Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI") ) ) .locationIds( Optional.of( Arrays.asList("59TNP9SA8VGDA") ) ) .updatedAfter("2016-11-16T00:00:00.000Z") .build() );
-
βοΈ Parameters
-
-
request:
BatchGetInventoryCountsRequest
-
-
client.inventory.deprecatedGetPhysicalCount(physicalCountId) -> GetInventoryPhysicalCountResponse
-
π Description
-
-
Deprecated version of RetrieveInventoryPhysicalCount after the endpoint URL is updated to conform to the standard convention.
-
π Usage
-
-
client.inventory().deprecatedGetPhysicalCount( DeprecatedGetPhysicalCountInventoryRequest .builder() .physicalCountId("physical_count_id") .build() );
-
βοΈ Parameters
-
-
physicalCountId:
StringID of the InventoryPhysicalCount to retrieve.
-
-
client.inventory.getPhysicalCount(physicalCountId) -> GetInventoryPhysicalCountResponse
-
π Description
-
-
Returns the InventoryPhysicalCount object with the provided
physical_count_id.
-
π Usage
-
-
client.inventory().getPhysicalCount( GetPhysicalCountInventoryRequest .builder() .physicalCountId("physical_count_id") .build() );
-
βοΈ Parameters
-
-
physicalCountId:
StringID of the InventoryPhysicalCount to retrieve.
-
-
client.inventory.getTransfer(transferId) -> GetInventoryTransferResponse
-
π Description
-
-
Returns the InventoryTransfer object with the provided
transfer_id.
-
π Usage
-
-
client.inventory().getTransfer( GetTransferInventoryRequest .builder() .transferId("transfer_id") .build() );
-
βοΈ Parameters
-
-
transferId:
Stringβ ID of the InventoryTransfer to retrieve.
-
-
client.inventory.get(catalogObjectId) -> SyncPagingIterable<InventoryCount>
-
π Description
-
-
Retrieves the current calculated stock count for a given CatalogObject at a given set of Locations. Responses are paginated and unsorted. For more sophisticated queries, use a batch endpoint.
-
π Usage
-
-
client.inventory().get( GetInventoryRequest .builder() .catalogObjectId("catalog_object_id") .locationIds("location_ids") .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
catalogObjectId:
Stringβ ID of the CatalogObject to retrieve.
-
locationIds:
Optional<String>The Location IDs to look up as a comma-separated list. An empty list queries all locations.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query.
See the Pagination guide for more information.
-
-
client.inventory.changes(catalogObjectId) -> SyncPagingIterable<InventoryChange>
-
π Description
-
-
Returns a set of physical counts and inventory adjustments for the provided CatalogObject at the requested Locations.
You can achieve the same result by calling BatchRetrieveInventoryChanges and having the
catalog_object_idslist contain a single element of theCatalogObjectID.Results are paginated and sorted in descending order according to their
occurred_attimestamp (newest first).There are no limits on how far back the caller can page. This endpoint can be used to display recent changes for a specific item. For more sophisticated queries, use a batch endpoint.
-
π Usage
-
-
client.inventory().changes( ChangesInventoryRequest .builder() .catalogObjectId("catalog_object_id") .locationIds("location_ids") .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
catalogObjectId:
Stringβ ID of the CatalogObject to retrieve.
-
locationIds:
Optional<String>The Location IDs to look up as a comma-separated list. An empty list queries all locations.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query.
See the Pagination guide for more information.
-
-
Invoices
client.invoices.list() -> SyncPagingIterable<Invoice>
-
π Description
-
-
Returns a list of invoices for a given location. The response is paginated. If truncated, the response includes a
cursorthat you
use in a subsequent request to retrieve the next set of invoices.
-
π Usage
-
-
client.invoices().list( ListInvoicesRequest .builder() .locationId("location_id") .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the location for which to list invoices.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for your original query.
For more information, see Pagination.
-
limit:
Optional<Integer>The maximum number of invoices to return (200 is the maximum
limit). If not provided, the server uses a default limit of 100 invoices.
-
-
client.invoices.create(request) -> CreateInvoiceResponse
-
π Description
-
-
Creates a draft invoice for an order created using the Orders API.
A draft invoice remains in your account and no action is taken. You must publish the invoice before Square can process it (send it to the customer's email address or charge the customerβs card on file).
-
π Usage
-
-
client.invoices().create( CreateInvoiceRequest .builder() .invoice( Invoice .builder() .locationId("ES0RJRZYEC39A") .orderId("CAISENgvlJ6jLWAzERDzjyHVybY") .primaryRecipient( InvoiceRecipient .builder() .customerId("JDKYHBWT1D4F8MFH63DBMEN8Y4") .build() ) .paymentRequests( Optional.of( Arrays.asList( InvoicePaymentRequest .builder() .requestType(InvoiceRequestType.BALANCE) .dueDate("2030-01-24") .tippingEnabled(true) .automaticPaymentSource(InvoiceAutomaticPaymentSource.NONE) .reminders( Optional.of( Arrays.asList( InvoicePaymentReminder .builder() .relativeScheduledDays(-1) .message("Your invoice is due tomorrow") .build() ) ) ) .build() ) ) ) .deliveryMethod(InvoiceDeliveryMethod.EMAIL) .invoiceNumber("inv-100") .title("Event Planning Services") .description("We appreciate your business!") .scheduledAt("2030-01-13T10:00:00Z") .acceptedPaymentMethods( InvoiceAcceptedPaymentMethods .builder() .card(true) .squareGiftCard(false) .bankAccount(false) .buyNowPayLater(false) .cashAppPay(false) .build() ) .customFields( Optional.of( Arrays.asList( InvoiceCustomField .builder() .label("Event Reference Number") .value("Ref. #1234") .placement(InvoiceCustomFieldPlacement.ABOVE_LINE_ITEMS) .build(), InvoiceCustomField .builder() .label("Terms of Service") .value("The terms of service are...") .placement(InvoiceCustomFieldPlacement.BELOW_LINE_ITEMS) .build() ) ) ) .saleOrServiceDate("2030-01-24") .storePaymentMethodEnabled(false) .build() ) .idempotencyKey("ce3748f9-5fc1-4762-aa12-aae5e843f1f4") .build() );
-
βοΈ Parameters
-
-
invoice:
Invoiceβ The invoice to create.
-
idempotencyKey:
Optional<String>A unique string that identifies the
CreateInvoicerequest. If you do not provideidempotency_key(or provide an empty string as the value), the endpoint treats each request as independent.For more information, see Idempotency.
-
-
client.invoices.search(request) -> SearchInvoicesResponse
-
π Description
-
-
Searches for invoices from a location specified in the filter. You can optionally specify customers in the filter for whom to retrieve invoices. In the current implementation, you can only specify one location and optionally one customer.
The response is paginated. If truncated, the response includes a
cursorthat you use in a subsequent request to retrieve the next set of invoices.
-
π Usage
-
-
client.invoices().search( SearchInvoicesRequest .builder() .query( InvoiceQuery .builder() .filter( InvoiceFilter .builder() .locationIds( Arrays.asList("ES0RJRZYEC39A") ) .customerIds( Optional.of( Arrays.asList("JDKYHBWT1D4F8MFH63DBMEN8Y4") ) ) .build() ) .sort( InvoiceSort .builder() .field("INVOICE_SORT_DATE") .order(SortOrder.DESC) .build() ) .build() ) .limit(100) .build() );
-
βοΈ Parameters
-
-
query:
InvoiceQueryβ Describes the query criteria for searching invoices.
-
limit:
Optional<Integer>The maximum number of invoices to return (200 is the maximum
limit). If not provided, the server uses a default limit of 100 invoices.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for your original query.
For more information, see Pagination.
-
-
client.invoices.get(invoiceId) -> GetInvoiceResponse
-
π Description
-
-
Retrieves an invoice by invoice ID.
-
π Usage
-
-
client.invoices().get( GetInvoicesRequest .builder() .invoiceId("invoice_id") .build() );
-
βοΈ Parameters
-
-
invoiceId:
Stringβ The ID of the invoice to retrieve.
-
-
client.invoices.update(invoiceId, request) -> UpdateInvoiceResponse
-
π Description
-
-
Updates an invoice. This endpoint supports sparse updates, so you only need to specify the fields you want to change along with the required
versionfield. Some restrictions apply to updating invoices. For example, you cannot change theorder_idorlocation_idfield.
-
π Usage
-
-
client.invoices().update( UpdateInvoiceRequest .builder() .invoiceId("invoice_id") .invoice( Invoice .builder() .version(1) .paymentRequests( Optional.of( Arrays.asList( InvoicePaymentRequest .builder() .uid("2da7964f-f3d2-4f43-81e8-5aa220bf3355") .tippingEnabled(false) .build() ) ) ) .build() ) .idempotencyKey("4ee82288-0910-499e-ab4c-5d0071dad1be") .build() );
-
βοΈ Parameters
-
-
invoiceId:
Stringβ The ID of the invoice to update.
-
invoice:
InvoiceThe invoice fields to add, change, or clear. Fields can be cleared using null values or the
removefield (for individual payment requests or reminders). The current invoiceversionis also required. For more information, including requirements, limitations, and more examples, see Update an Invoice.
-
idempotencyKey:
Optional<String>A unique string that identifies the
UpdateInvoicerequest. If you do not provideidempotency_key(or provide an empty string as the value), the endpoint treats each request as independent.For more information, see Idempotency.
-
fieldsToClear:
Optional<List<String>>The list of fields to clear. Although this field is currently supported, we recommend using null values or the
removefield when possible. For examples, see Update an Invoice.
-
-
client.invoices.delete(invoiceId) -> DeleteInvoiceResponse
-
π Description
-
-
Deletes the specified invoice. When an invoice is deleted, the associated order status changes to CANCELED. You can only delete a draft invoice (you cannot delete a published invoice, including one that is scheduled for processing).
-
π Usage
-
-
client.invoices().delete( DeleteInvoicesRequest .builder() .invoiceId("invoice_id") .version(1) .build() );
-
βοΈ Parameters
-
-
invoiceId:
Stringβ The ID of the invoice to delete.
-
version:
Optional<Integer>The version of the invoice to delete. If you do not know the version, you can call GetInvoice or ListInvoices.
-
-
client.invoices.createInvoiceAttachment(invoiceId, request) -> CreateInvoiceAttachmentResponse
-
π Description
-
-
Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads with a JSON
requestpart and afilepart. Thefilepart must be areadable streamthat contains a file in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF.Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices in the
DRAFT,SCHEDULED,UNPAID, orPARTIALLY_PAIDstate.NOTE: When testing in the Sandbox environment, the total file size is limited to 1 KB.
-
π Usage
-
-
client.invoices().createInvoiceAttachment( CreateInvoiceAttachmentRequest .builder() .invoiceId("invoice_id") .build() );
-
βοΈ Parameters
-
-
invoiceId:
Stringβ The ID of the invoice to attach the file to.
-
-
client.invoices.deleteInvoiceAttachment(invoiceId, attachmentId) -> DeleteInvoiceAttachmentResponse
-
π Description
-
-
Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only from invoices in the
DRAFT,SCHEDULED,UNPAID, orPARTIALLY_PAIDstate.
-
π Usage
-
-
client.invoices().deleteInvoiceAttachment( DeleteInvoiceAttachmentRequest .builder() .invoiceId("invoice_id") .attachmentId("attachment_id") .build() );
-
βοΈ Parameters
-
-
invoiceId:
Stringβ The ID of the invoice to delete the attachment from.
-
attachmentId:
Stringβ The ID of the attachment to delete.
-
-
client.invoices.cancel(invoiceId, request) -> CancelInvoiceResponse
-
π Description
-
-
Cancels an invoice. The seller cannot collect payments for the canceled invoice.
You cannot cancel an invoice in the
DRAFTstate or in a terminal state:PAID,REFUNDED,CANCELED, orFAILED.
-
π Usage
-
-
client.invoices().cancel( CancelInvoiceRequest .builder() .invoiceId("invoice_id") .version(0) .build() );
-
βοΈ Parameters
-
-
invoiceId:
Stringβ The ID of the invoice to cancel.
-
version:
IntegerThe version of the invoice to cancel. If you do not know the version, you can call GetInvoice or ListInvoices.
-
-
client.invoices.publish(invoiceId, request) -> PublishInvoiceResponse
-
π Description
-
-
Publishes the specified draft invoice.
After an invoice is published, Square follows up based on the invoice configuration. For example, Square sends the invoice to the customer's email address, charges the customer's card on file, or does nothing. Square also makes the invoice available on a Square-hosted invoice page.
The invoice
statusalso changes fromDRAFTto a status based on the invoice configuration. For example, the status changes toUNPAIDif Square emails the invoice orPARTIALLY_PAIDif Square charges a card on file for a portion of the invoice amount.In addition to the required
ORDERS_WRITEandINVOICES_WRITEpermissions,CUSTOMERS_READandPAYMENTS_WRITEare required when publishing invoices configured for card-on-file payments.
-
π Usage
-
-
client.invoices().publish( PublishInvoiceRequest .builder() .invoiceId("invoice_id") .version(1) .idempotencyKey("32da42d0-1997-41b0-826b-f09464fc2c2e") .build() );
-
βοΈ Parameters
-
-
invoiceId:
Stringβ The ID of the invoice to publish.
-
version:
IntegerThe version of the invoice to publish. This must match the current version of the invoice; otherwise, the request is rejected.
-
idempotencyKey:
Optional<String>A unique string that identifies the
PublishInvoicerequest. If you do not provideidempotency_key(or provide an empty string as the value), the endpoint treats each request as independent.For more information, see Idempotency.
-
-
Labor
client.labor.createScheduledShift(request) -> CreateScheduledShiftResponse
-
π Description
-
-
Creates a scheduled shift by providing draft shift details such as job ID, team member assignment, and start and end times.
The following
draft_shift_detailsfields are required:location_idjob_idstart_atend_at
-
π Usage
-
-
client.labor().createScheduledShift( CreateScheduledShiftRequest .builder() .scheduledShift( ScheduledShift .builder() .draftShiftDetails( ScheduledShiftDetails .builder() .teamMemberId("ormj0jJJZ5OZIzxrZYJI") .locationId("PAA1RJZZKXBFG") .jobId("FzbJAtt9qEWncK1BWgVCxQ6M") .startAt("2019-01-25T03:11:00-05:00") .endAt("2019-01-25T13:11:00-05:00") .notes("Dont forget to prep the vegetables") .isDeleted(false) .build() ) .build() ) .idempotencyKey("HIDSNG5KS478L") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>A unique identifier for the
CreateScheduledShiftrequest, used to ensure the idempotency of the operation.
-
scheduledShift:
ScheduledShiftThe scheduled shift with
draft_shift_details. If needed, call ListLocations to get location IDs, ListJobs to get job IDs, and SearchTeamMembers to get team member IDs and current job assignments.The
start_atandend_attimestamps must be provided in the time zone + offset of the shift location specified inlocation_id. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00
-
-
client.labor.bulkPublishScheduledShifts(request) -> BulkPublishScheduledShiftsResponse
-
π Description
-
-
Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish requests and returns a map of responses. When a scheduled shift is published, Square keeps the
draft_shift_detailsfield as is and copies it to thepublished_shift_detailsfield.The minimum
start_atand maximumend_attimestamps of all shifts in aBulkPublishScheduledShiftsrequest must fall within a two-week period.
-
π Usage
-
-
client.labor().bulkPublishScheduledShifts( BulkPublishScheduledShiftsRequest .builder() .scheduledShifts( new HashMap<String, BulkPublishScheduledShiftsData>() {{ put("key", BulkPublishScheduledShiftsData .builder() .build()); }} ) .scheduledShiftNotificationAudience(ScheduledShiftNotificationAudience.AFFECTED) .build() );
-
βοΈ Parameters
-
-
scheduledShifts:
Map<String, BulkPublishScheduledShiftsData>A map of 1 to 100 key-value pairs that represent individual publish requests.
- Each key is the ID of a scheduled shift you want to publish.
- Each value is a
BulkPublishScheduledShiftsDataobject that contains theversionfield or is an empty object.
-
scheduledShiftNotificationAudience:
Optional<ScheduledShiftNotificationAudience>Indicates whether Square should send email notifications to team members and which team members should receive the notifications. This setting applies to all shifts specified in the bulk operation. The default value is
AFFECTED. See ScheduledShiftNotificationAudience for possible values
-
-
client.labor.searchScheduledShifts(request) -> SearchScheduledShiftsResponse
-
π Description
-
-
Returns a paginated list of scheduled shifts, with optional filter and sort settings. By default, results are sorted by
start_atin ascending order.
-
π Usage
-
-
client.labor().searchScheduledShifts( SearchScheduledShiftsRequest .builder() .query( ScheduledShiftQuery .builder() .filter( ScheduledShiftFilter .builder() .assignmentStatus(ScheduledShiftFilterAssignmentStatus.ASSIGNED) .build() ) .sort( ScheduledShiftSort .builder() .field(ScheduledShiftSortField.CREATED_AT) .order(SortOrder.ASC) .build() ) .build() ) .limit(2) .cursor("xoxp-1234-5678-90123") .build() );
-
βοΈ Parameters
-
-
query:
Optional<ScheduledShiftQuery>β Query conditions used to filter and sort the results.
-
limit:
Optional<Integer>β The maximum number of results to return in a single response page. The default value is 50.
-
cursor:
Optional<String>The pagination cursor returned by the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
-
client.labor.retrieveScheduledShift(id) -> RetrieveScheduledShiftResponse
-
π Description
-
-
Retrieves a scheduled shift by ID.
-
π Usage
-
-
client.labor().retrieveScheduledShift( RetrieveScheduledShiftRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of the scheduled shift to retrieve.
-
-
client.labor.updateScheduledShift(id, request) -> UpdateScheduledShiftResponse
-
π Description
-
-
Updates the draft shift details for a scheduled shift. This endpoint supports sparse updates, so only new, changed, or removed fields are required in the request. You must publish the shift to make updates public.
You can make the following updates to
draft_shift_details:- Change the
location_id,job_id,start_at, andend_atfields. - Add, change, or clear the
team_member_idandnotesfields. To clear these fields, set the value to null. - Change the
is_deletedfield. To delete a scheduled shift, setis_deletedto true and then publish the shift.
- Change the
-
π Usage
-
-
client.labor().updateScheduledShift( UpdateScheduledShiftRequest .builder() .id("id") .scheduledShift( ScheduledShift .builder() .draftShiftDetails( ScheduledShiftDetails .builder() .teamMemberId("ormj0jJJZ5OZIzxrZYJI") .locationId("PAA1RJZZKXBFG") .jobId("FzbJAtt9qEWncK1BWgVCxQ6M") .startAt("2019-03-25T03:11:00-05:00") .endAt("2019-03-25T13:18:00-05:00") .notes("Dont forget to prep the vegetables") .isDeleted(false) .build() ) .version(1) .build() ) .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of the scheduled shift to update.
-
scheduledShift:
ScheduledShiftThe scheduled shift with any updates in the
draft_shift_detailsfield. If needed, call ListLocations to get location IDs, ListJobs to get job IDs, and SearchTeamMembers to get team member IDs and current job assignments. Updates made topublished_shift_detailsare ignored.If provided, the
start_atandend_attimestamps must be in the time zone + offset of the shift location specified inlocation_id. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00To enable optimistic concurrency control for the request, provide the current version of the shift in the
versionfield. If the provided version doesn't match the server version, the request fails. Ifversionis omitted, Square executes a blind write, potentially overwriting data from another publish request.
-
-
client.labor.publishScheduledShift(id, request) -> PublishScheduledShiftResponse
-
π Description
-
-
Publishes a scheduled shift. When a scheduled shift is published, Square keeps the
draft_shift_detailsfield as is and copies it to thepublished_shift_detailsfield.
-
π Usage
-
-
client.labor().publishScheduledShift( PublishScheduledShiftRequest .builder() .id("id") .idempotencyKey("HIDSNG5KS478L") .version(2) .scheduledShiftNotificationAudience(ScheduledShiftNotificationAudience.ALL) .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of the scheduled shift to publish.
-
idempotencyKey:
StringA unique identifier for the
PublishScheduledShiftrequest, used to ensure the idempotency of the operation.
-
version:
Optional<Integer>The current version of the scheduled shift, used to enable optimistic concurrency control. If the provided version doesn't match the server version, the request fails. If omitted, Square executes a blind write, potentially overwriting data from another publish request.
-
scheduledShiftNotificationAudience:
Optional<ScheduledShiftNotificationAudience>Indicates whether Square should send an email notification to team members and which team members should receive the notification. The default value is
AFFECTED. See ScheduledShiftNotificationAudience for possible values
-
-
client.labor.createTimecard(request) -> CreateTimecardResponse
-
π Description
-
-
Creates a new
Timecard.A
Timecardrepresents a complete workday for a single team member. You must provide the following values in your request to this endpoint:location_idteam_member_idstart_at
An attempt to create a new
Timecardcan result in aBAD_REQUESTerror when:- The
statusof the newTimecardisOPENand the team member has another timecard with anOPENstatus. - The
start_atdate is in the future. - The
start_atorend_atdate overlaps another timecard for the same team member. - The
Breakinstances are set in the request and a breakstart_atis before theTimecard.start_at, a breakend_atis after theTimecard.end_at, or both.
-
π Usage
-
-
client.labor().createTimecard( CreateTimecardRequest .builder() .timecard( Timecard .builder() .locationId("PAA1RJZZKXBFG") .startAt("2019-01-25T03:11:00-05:00") .teamMemberId("ormj0jJJZ5OZIzxrZYJI") .endAt("2019-01-25T13:11:00-05:00") .wage( TimecardWage .builder() .title("Barista") .hourlyRate( Money .builder() .amount(1100L) .currency(Currency.USD) .build() ) .tipEligible(true) .build() ) .breaks( Optional.of( Arrays.asList( Break .builder() .startAt("2019-01-25T06:11:00-05:00") .breakTypeId("REGS1EQR1TPZ5") .name("Tea Break") .expectedDuration("PT5M") .isPaid(true) .endAt("2019-01-25T06:16:00-05:00") .build() ) ) ) .declaredCashTipMoney( Money .builder() .amount(500L) .currency(Currency.USD) .build() ) .build() ) .idempotencyKey("HIDSNG5KS478L") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>β A unique string value to ensure the idempotency of the operation.
-
timecard:
Timecardβ TheTimecardto be created.
-
-
client.labor.searchTimecards(request) -> SearchTimecardsResponse
-
π Description
-
-
Returns a paginated list of
Timecardrecords for a business. The list to be returned can be filtered by:- Location IDs
- Team member IDs
- Timecard status (
OPENorCLOSED) - Timecard start
- Timecard end
- Workday details
The list can be sorted by:
START_ATEND_ATCREATED_ATUPDATED_AT
-
π Usage
-
-
client.labor().searchTimecards( SearchTimecardsRequest .builder() .query( TimecardQuery .builder() .filter( TimecardFilter .builder() .workday( TimecardWorkday .builder() .dateRange( DateRange .builder() .startDate("2019-01-20") .endDate("2019-02-03") .build() ) .matchTimecardsBy(TimecardWorkdayMatcher.START_AT) .defaultTimezone("America/Los_Angeles") .build() ) .build() ) .build() ) .limit(100) .build() );
-
βοΈ Parameters
-
-
query:
Optional<TimecardQuery>β Query filters.
-
limit:
Optional<Integer>β The number of resources in a page (200 by default).
-
cursor:
Optional<String>β An opaque cursor for fetching the next page.
-
-
client.labor.retrieveTimecard(id) -> RetrieveTimecardResponse
-
π Description
-
-
Returns a single
Timecardspecified byid.
-
π Usage
-
-
client.labor().retrieveTimecard( RetrieveTimecardRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theTimecardbeing retrieved.
-
-
client.labor.updateTimecard(id, request) -> UpdateTimecardResponse
-
π Description
-
-
Updates an existing
Timecard.When adding a
Breakto aTimecard, any earlierBreakinstances in theTimecardhave theend_atproperty set to a valid RFC-3339 datetime string.When closing a
Timecard, allBreakinstances in theTimecardmust be complete withend_atset on eachBreak.
-
π Usage
-
-
client.labor().updateTimecard( UpdateTimecardRequest .builder() .id("id") .timecard( Timecard .builder() .locationId("PAA1RJZZKXBFG") .startAt("2019-01-25T03:11:00-05:00") .teamMemberId("ormj0jJJZ5OZIzxrZYJI") .endAt("2019-01-25T13:11:00-05:00") .wage( TimecardWage .builder() .title("Bartender") .hourlyRate( Money .builder() .amount(1500L) .currency(Currency.USD) .build() ) .tipEligible(true) .build() ) .breaks( Optional.of( Arrays.asList( Break .builder() .startAt("2019-01-25T06:11:00-05:00") .breakTypeId("REGS1EQR1TPZ5") .name("Tea Break") .expectedDuration("PT5M") .isPaid(true) .id("X7GAQYVVRRG6P") .endAt("2019-01-25T06:16:00-05:00") .build() ) ) ) .status(TimecardStatus.CLOSED) .version(1) .declaredCashTipMoney( Money .builder() .amount(500L) .currency(Currency.USD) .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of the object being updated.
-
timecard:
Timecardβ The updatedTimecardobject.
-
-
client.labor.deleteTimecard(id) -> DeleteTimecardResponse
-
π Description
-
-
Deletes a
Timecard.
-
π Usage
-
-
client.labor().deleteTimecard( DeleteTimecardRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theTimecardbeing deleted.
-
-
Locations
client.locations.list() -> ListLocationsResponse
-
π Description
-
-
Provides details about all of the seller's locations, including those with an inactive status. Locations are listed alphabetically by
name.
-
π Usage
-
-
client.locations().list();
-
-
client.locations.create(request) -> CreateLocationResponse
-
π Description
-
-
Creates a location. Creating new locations allows for separate configuration of receipt layouts, item prices, and sales reports. Developers can use locations to separate sales activity through applications that integrate with Square from sales activity elsewhere in a seller's account. Locations created programmatically with the Locations API last forever and are visible to the seller for their own management. Therefore, ensure that each location has a sensible and unique name.
-
π Usage
-
-
client.locations().create( CreateLocationRequest .builder() .location( Location .builder() .name("Midtown") .address( Address .builder() .addressLine1("1234 Peachtree St. NE") .locality("Atlanta") .administrativeDistrictLevel1("GA") .postalCode("30309") .build() ) .description("Midtown Atlanta store") .build() ) .build() );
-
βοΈ Parameters
-
-
location:
Optional<Location>The initial values of the location being created. The
namefield is required and must be unique within a seller account. All other fields are optional, but any information you care about for the location should be included. The remaining fields are automatically added based on the data from the main location.
-
-
client.locations.get(locationId) -> GetLocationResponse
-
π Description
-
-
Retrieves details of a single location. Specify "main" as the location ID to retrieve details of the main location.
-
π Usage
-
-
client.locations().get( GetLocationsRequest .builder() .locationId("location_id") .build() );
-
βοΈ Parameters
-
-
locationId:
StringThe ID of the location to retrieve. Specify the string "main" to return the main location.
-
-
client.locations.update(locationId, request) -> UpdateLocationResponse
-
π Description
-
-
Updates a location.
-
π Usage
-
-
client.locations().update( UpdateLocationRequest .builder() .locationId("location_id") .location( Location .builder() .businessHours( BusinessHours .builder() .periods( Optional.of( Arrays.asList( BusinessHoursPeriod .builder() .dayOfWeek(DayOfWeek.FRI) .startLocalTime("07:00") .endLocalTime("18:00") .build(), BusinessHoursPeriod .builder() .dayOfWeek(DayOfWeek.SAT) .startLocalTime("07:00") .endLocalTime("18:00") .build(), BusinessHoursPeriod .builder() .dayOfWeek(DayOfWeek.SUN) .startLocalTime("09:00") .endLocalTime("15:00") .build() ) ) ) .build() ) .description("Midtown Atlanta store - Open weekends") .build() ) .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the location to update.
-
location:
Optional<Location>β TheLocationobject with only the fields to update.
-
-
client.locations.checkouts(locationId, request) -> CreateCheckoutResponse
-
π Description
-
-
Links a
checkoutIdto acheckout_page_urlthat customers are directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.NOTE: The Checkout API has been updated with new features. For more information, see Checkout API highlights.
-
π Usage
-
-
client.locations().checkouts( CreateCheckoutRequest .builder() .locationId("location_id") .idempotencyKey("86ae1696-b1e3-4328-af6d-f1e04d947ad6") .order( CreateOrderRequest .builder() .order( Order .builder() .locationId("location_id") .referenceId("reference_id") .customerId("customer_id") .lineItems( Optional.of( Arrays.asList( OrderLineItem .builder() .quantity("2") .name("Printed T Shirt") .appliedTaxes( Optional.of( Arrays.asList( OrderLineItemAppliedTax .builder() .taxUid("38ze1696-z1e3-5628-af6d-f1e04d947fg3") .build() ) ) ) .appliedDiscounts( Optional.of( Arrays.asList( OrderLineItemAppliedDiscount .builder() .discountUid("56ae1696-z1e3-9328-af6d-f1e04d947gd4") .build() ) ) ) .basePriceMoney( Money .builder() .amount(1500L) .currency(Currency.USD) .build() ) .build(), OrderLineItem .builder() .quantity("1") .name("Slim Jeans") .basePriceMoney( Money .builder() .amount(2500L) .currency(Currency.USD) .build() ) .build(), OrderLineItem .builder() .quantity("3") .name("Woven Sweater") .basePriceMoney( Money .builder() .amount(3500L) .currency(Currency.USD) .build() ) .build() ) ) ) .taxes( Optional.of( Arrays.asList( OrderLineItemTax .builder() .uid("38ze1696-z1e3-5628-af6d-f1e04d947fg3") .type(OrderLineItemTaxType.INCLUSIVE) .percentage("7.75") .scope(OrderLineItemTaxScope.LINE_ITEM) .build() ) ) ) .discounts( Optional.of( Arrays.asList( OrderLineItemDiscount .builder() .uid("56ae1696-z1e3-9328-af6d-f1e04d947gd4") .type(OrderLineItemDiscountType.FIXED_AMOUNT) .amountMoney( Money .builder() .amount(100L) .currency(Currency.USD) .build() ) .scope(OrderLineItemDiscountScope.LINE_ITEM) .build() ) ) ) .build() ) .idempotencyKey("12ae1696-z1e3-4328-af6d-f1e04d947gd4") .build() ) .askForShippingAddress(true) .merchantSupportEmail("merchant+support@website.com") .prePopulateBuyerEmail("example@email.com") .prePopulateShippingAddress( Address .builder() .addressLine1("1455 Market St.") .addressLine2("Suite 600") .locality("San Francisco") .administrativeDistrictLevel1("CA") .postalCode("94103") .country(Country.US) .firstName("Jane") .lastName("Doe") .build() ) .redirectUrl("https://merchant.website.com/order-confirm") .additionalRecipients( Optional.of( Arrays.asList( ChargeRequestAdditionalRecipient .builder() .locationId("057P5VYJ4A5X1") .description("Application fees") .amountMoney( Money .builder() .amount(60L) .currency(Currency.USD) .build() ) .build() ) ) ) .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the business location to associate the checkout with.
-
idempotencyKey:
StringA unique string that identifies this checkout among others you have created. It can be any valid string but must be unique for every order sent to Square Checkout for a given location ID.
The idempotency key is used to avoid processing the same order more than once. If you are unsure whether a particular checkout was created successfully, you can attempt it again with the same idempotency key and all the same other parameters without worrying about creating duplicates.
You should use a random number/string generator native to the language you are working in to generate strings for your idempotency keys.
For more information, see Idempotency.
-
order:
CreateOrderRequestβ The order including line items to be checked out.
-
askForShippingAddress:
Optional<Boolean>If
true, Square Checkout collects shipping information on your behalf and stores that information with the transaction information in the Square Seller Dashboard.Default:
false.
-
merchantSupportEmail:
Optional<String>The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the seller.
If this value is not set, the confirmation page and email display the primary email address associated with the seller's Square account.
Default: none; only exists if explicitly set.
-
prePopulateBuyerEmail:
Optional<String>If provided, the buyer's email is prepopulated on the checkout page as an editable text field.
Default: none; only exists if explicitly set.
-
prePopulateShippingAddress:
Optional<Address>If provided, the buyer's shipping information is prepopulated on the checkout page as editable text fields.
Default: none; only exists if explicitly set.
-
redirectUrl:
Optional<String>The URL to redirect to after the checkout is completed with
checkoutId,transactionId, andreferenceIdappended as URL parameters. For example, if the provided redirect URL ishttp://www.example.com/order-complete, a successful transaction redirects the customer to:http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxxIf you do not provide a redirect URL, Square Checkout displays an order confirmation page on your behalf; however, it is strongly recommended that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow.
Default: none; only exists if explicitly set.
-
additionalRecipients:
Optional<List<ChargeRequestAdditionalRecipient>>The basic primitive of a multi-party transaction. The value is optional. The transaction facilitated by you can be split from here.
If you provide this value, the
amount_moneyvalue in youradditional_recipientsfield cannot be more than 90% of thetotal_moneycalculated by Square for your order. Thelocation_idmust be a valid seller location where the checkout is occurring.This field requires
PAYMENTS_WRITE_ADDITIONAL_RECIPIENTSOAuth permission.This field is currently not supported in the Square Sandbox.
-
note:
Optional<String>An optional note to associate with the
checkoutobject.This value cannot exceed 60 characters.
-
-
Loyalty
client.loyalty.searchEvents(request) -> SearchLoyaltyEventsResponse
-
π Description
-
-
Searches for loyalty events.
A Square loyalty program maintains a ledger of events that occur during the lifetime of a buyer's loyalty account. Each change in the point balance (for example, points earned, points redeemed, and points expired) is recorded in the ledger. Using this endpoint, you can search the ledger for events.
Search results are sorted by
created_atin descending order.
-
π Usage
-
-
client.loyalty().searchEvents( SearchLoyaltyEventsRequest .builder() .query( LoyaltyEventQuery .builder() .filter( LoyaltyEventFilter .builder() .orderFilter( LoyaltyEventOrderFilter .builder() .orderId("PyATxhYLfsMqpVkcKJITPydgEYfZY") .build() ) .build() ) .build() ) .limit(30) .build() );
-
βοΈ Parameters
-
-
query:
Optional<LoyaltyEventQuery>A set of one or more predefined query filters to apply when searching for loyalty events. The endpoint performs a logical AND to evaluate multiple filters and performs a logical OR on arrays
that specifies multiple field values.
-
limit:
Optional<Integer>The maximum number of results to include in the response. The last page might contain fewer events. The default is 30 events.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. For more information, see Pagination.
-
-
Merchants
client.merchants.list() -> SyncPagingIterable<Merchant>
-
π Description
-
-
Provides details about the merchant associated with a given access token.
The access token used to connect your application to a Square seller is associated with a single merchant. That means that
ListMerchantsreturns a list with a singleMerchantobject. You can specify your personal access token to get your own merchant information or specify an OAuth token to get the information for the merchant that granted your application access.If you know the merchant ID, you can also use the RetrieveMerchant endpoint to retrieve the merchant information.
-
π Usage
-
-
client.merchants().list( ListMerchantsRequest .builder() .cursor(1) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<Integer>β The cursor generated by the previous response.
-
-
client.merchants.get(merchantId) -> GetMerchantResponse
-
π Description
-
-
Retrieves the
Merchantobject for the givenmerchant_id.
-
π Usage
-
-
client.merchants().get( GetMerchantsRequest .builder() .merchantId("merchant_id") .build() );
-
βοΈ Parameters
-
-
merchantId:
StringThe ID of the merchant to retrieve. If the string "me" is supplied as the ID, then retrieve the merchant that is currently accessible to this call.
-
-
Checkout
client.checkout.retrieveLocationSettings(locationId) -> RetrieveLocationSettingsResponse
-
π Description
-
-
Retrieves the location-level settings for a Square-hosted checkout page.
-
π Usage
-
-
client.checkout().retrieveLocationSettings( RetrieveLocationSettingsRequest .builder() .locationId("location_id") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the location for which to retrieve settings.
-
-
client.checkout.updateLocationSettings(locationId, request) -> UpdateLocationSettingsResponse
-
π Description
-
-
Updates the location-level settings for a Square-hosted checkout page.
-
π Usage
-
-
client.checkout().updateLocationSettings( UpdateLocationSettingsRequest .builder() .locationId("location_id") .locationSettings( CheckoutLocationSettings .builder() .build() ) .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the location for which to retrieve settings.
-
locationSettings:
CheckoutLocationSettingsβ Describe your updates using thelocation_settingsobject. Make sure it contains only the fields that have changed.
-
-
client.checkout.retrieveMerchantSettings() -> RetrieveMerchantSettingsResponse
-
π Description
-
-
Retrieves the merchant-level settings for a Square-hosted checkout page.
-
π Usage
-
-
client.checkout().retrieveMerchantSettings();
-
-
client.checkout.updateMerchantSettings(request) -> UpdateMerchantSettingsResponse
-
π Description
-
-
Updates the merchant-level settings for a Square-hosted checkout page.
-
π Usage
-
-
client.checkout().updateMerchantSettings( UpdateMerchantSettingsRequest .builder() .merchantSettings( CheckoutMerchantSettings .builder() .build() ) .build() );
-
βοΈ Parameters
-
-
merchantSettings:
CheckoutMerchantSettingsβ Describe your updates using themerchant_settingsobject. Make sure it contains only the fields that have changed.
-
-
Orders
client.orders.create(request) -> CreateOrderResponse
-
π Description
-
-
Creates a new order that can include information about products for purchase and settings to apply to the purchase.
To pay for a created order, see Pay for Orders.
You can modify open orders using the UpdateOrder endpoint.
-
π Usage
-
-
client.orders().create( CreateOrderRequest .builder() .order( Order .builder() .locationId("057P5VYJ4A5X1") .referenceId("my-order-001") .lineItems( Optional.of( Arrays.asList( OrderLineItem .builder() .quantity("1") .name("New York Strip Steak") .basePriceMoney( Money .builder() .amount(1599L) .currency(Currency.USD) .build() ) .build(), OrderLineItem .builder() .quantity("2") .catalogObjectId("BEMYCSMIJL46OCDV4KYIKXIB") .modifiers( Optional.of( Arrays.asList( OrderLineItemModifier .builder() .catalogObjectId("CHQX7Y4KY6N5KINJKZCFURPZ") .build() ) ) ) .appliedDiscounts( Optional.of( Arrays.asList( OrderLineItemAppliedDiscount .builder() .discountUid("one-dollar-off") .build() ) ) ) .build() ) ) ) .taxes( Optional.of( Arrays.asList( OrderLineItemTax .builder() .uid("state-sales-tax") .name("State Sales Tax") .percentage("9") .scope(OrderLineItemTaxScope.ORDER) .build() ) ) ) .discounts( Optional.of( Arrays.asList( OrderLineItemDiscount .builder() .uid("labor-day-sale") .name("Labor Day Sale") .percentage("5") .scope(OrderLineItemDiscountScope.ORDER) .build(), OrderLineItemDiscount .builder() .uid("membership-discount") .catalogObjectId("DB7L55ZH2BGWI4H23ULIWOQ7") .scope(OrderLineItemDiscountScope.ORDER) .build(), OrderLineItemDiscount .builder() .uid("one-dollar-off") .name("Sale - \$1.00 off") .amountMoney( Money .builder() .amount(100L) .currency(Currency.USD) .build() ) .scope(OrderLineItemDiscountScope.LINE_ITEM) .build() ) ) ) .build() ) .idempotencyKey("8193148c-9586-11e6-99f9-28cfe92138cf") .build() );
-
βοΈ Parameters
-
-
request:
CreateOrderRequest
-
-
client.orders.batchGet(request) -> BatchGetOrdersResponse
-
π Description
-
-
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.
-
π Usage
-
-
client.orders().batchGet( BatchGetOrdersRequest .builder() .orderIds( Arrays.asList("CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY") ) .locationId("057P5VYJ4A5X1") .build() );
-
βοΈ Parameters
-
-
locationId:
Optional<String>The ID of the location for these orders. This field is optional: omit it to retrieve orders within the scope of the current authorization's merchant ID.
-
orderIds:
List<String>β The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request.
-
-
client.orders.calculate(request) -> CalculateOrderResponse
-
π Description
-
-
Enables applications to preview order pricing without creating an order.
-
π Usage
-
-
client.orders().calculate( CalculateOrderRequest .builder() .order( Order .builder() .locationId("D7AVYMEAPJ3A3") .lineItems( Optional.of( Arrays.asList( OrderLineItem .builder() .quantity("1") .name("Item 1") .basePriceMoney( Money .builder() .amount(500L) .currency(Currency.USD) .build() ) .build(), OrderLineItem .builder() .quantity("2") .name("Item 2") .basePriceMoney( Money .builder() .amount(300L) .currency(Currency.USD) .build() ) .build() ) ) ) .discounts( Optional.of( Arrays.asList( OrderLineItemDiscount .builder() .name("50% Off") .percentage("50") .scope(OrderLineItemDiscountScope.ORDER) .build() ) ) ) .build() ) .build() );
-
βοΈ Parameters
-
-
order:
Orderβ The order to be calculated. Expects the entire order, not a sparse update.
-
proposedRewards:
Optional<List<OrderReward>>Identifies one or more loyalty reward tiers to apply during the order calculation. The discounts defined by the reward tiers are added to the order only to preview the effect of applying the specified rewards. The rewards do not correspond to actual redemptions; that is, no
rewards are created. Therefore, the rewardids are random strings used only to reference the reward tier.
-
-
client.orders.clone(request) -> CloneOrderResponse
-
π Description
-
-
Creates a new order, in the
DRAFTstate, by duplicating an existing order. The newly created order has only the core fields (such as line items, taxes, and discounts) copied from the original order.
-
π Usage
-
-
client.orders().clone( CloneOrderRequest .builder() .orderId("ZAISEM52YcpmcWAzERDOyiWS123") .version(3) .idempotencyKey("UNIQUE_STRING") .build() );
-
βοΈ Parameters
-
-
orderId:
Stringβ The ID of the order to clone.
-
version:
Optional<Integer>An optional order version for concurrency protection.
If a version is provided, it must match the latest stored version of the order to clone. If a version is not provided, the API clones the latest version.
-
idempotencyKey:
Optional<String>A value you specify that uniquely identifies this clone request.
If you are unsure whether a particular order was cloned successfully, you can reattempt the call with the same idempotency key without worrying about creating duplicate cloned orders. The originally cloned order is returned.
For more information, see Idempotency.
-
-
client.orders.search(request) -> SearchOrdersResponse
-
π Description
-
-
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).
SearchOrdersrequests need to specify which locations to search and define a SearchOrdersQuery object that controls how to sort or filter the results. YourSearchOrdersQuerycan:Set filter criteria. Set the sort order. Determine whether to return results as complete
Orderobjects or as OrderEntry objects.Note that details for orders processed with Square Point of Sale while in offline mode might not be transmitted to Square for up to 72 hours. Offline orders have a
created_atvalue that reflects the time the order was created, not the time it was subsequently transmitted to Square.
-
π Usage
-
-
client.orders().search( SearchOrdersRequest .builder() .locationIds( Optional.of( Arrays.asList("057P5VYJ4A5X1", "18YC4JDH91E1H") ) ) .query( SearchOrdersQuery .builder() .filter( SearchOrdersFilter .builder() .stateFilter( SearchOrdersStateFilter .builder() .states( Arrays.asList(OrderState.COMPLETED) ) .build() ) .dateTimeFilter( SearchOrdersDateTimeFilter .builder() .closedAt( TimeRange .builder() .startAt("2018-03-03T20:00:00+00:00") .endAt("2019-03-04T21:54:45+00:00") .build() ) .build() ) .build() ) .sort( SearchOrdersSort .builder() .sortField(SearchOrdersSortField.CLOSED_AT) .sortOrder(SortOrder.DESC) .build() ) .build() ) .limit(3) .returnEntries(true) .build() );
-
βοΈ Parameters
-
-
locationIds:
Optional<List<String>>The location IDs for the orders to query. All locations must belong to the same merchant.
Max: 10 location IDs.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for your original query. For more information, see Pagination.
-
query:
Optional<SearchOrdersQuery>Query conditions used to filter or sort the results. Note that when retrieving additional pages using a cursor, you must use the original query.
-
limit:
Optional<Integer>The maximum number of results to be returned in a single page.
Default:
500Max:1000
-
returnEntries:
Optional<Boolean>A Boolean that controls the format of the search results. If
true,SearchOrdersreturns OrderEntry objects. Iffalse,SearchOrdersreturns complete order objects.Default:
false.
-
-
client.orders.get(orderId) -> GetOrderResponse
-
π Description
-
-
Retrieves an Order by ID.
-
π Usage
-
-
client.orders().get( GetOrdersRequest .builder() .orderId("order_id") .build() );
-
βοΈ Parameters
-
-
orderId:
Stringβ The ID of the order to retrieve.
-
-
client.orders.update(orderId, request) -> UpdateOrderResponse
-
π Description
-
-
Updates an open order by adding, replacing, or deleting fields. Orders with a
COMPLETEDorCANCELEDstate cannot be updated.An
UpdateOrderrequest requires the following:- The
order_idin the endpoint path, identifying the order to update. - The latest
versionof the order to update. - The sparse order containing only the fields to update and the version to which the update is being applied.
- If deleting fields, the dot notation paths identifying the fields to clear.
To pay for an order, see Pay for Orders.
- The
-
π Usage
-
-
client.orders().update( UpdateOrderRequest .builder() .orderId("order_id") .order( Order .builder() .locationId("location_id") .lineItems( Optional.of( Arrays.asList( OrderLineItem .builder() .quantity("2") .uid("cookie_uid") .name("COOKIE") .basePriceMoney( Money .builder() .amount(200L) .currency(Currency.USD) .build() ) .build() ) ) ) .version(1) .build() ) .fieldsToClear( Optional.of( Arrays.asList("discounts") ) ) .idempotencyKey("UNIQUE_STRING") .build() );
-
βοΈ Parameters
-
-
orderId:
Stringβ The ID of the order to update.
-
order:
Optional<Order>The sparse order containing only the fields to update and the version to which the update is being applied.
-
fieldsToClear:
Optional<List<String>>The dot notation paths fields to clear. For example,
line_items[uid].note. For more information, see Deleting fields.
-
idempotencyKey:
Optional<String>A value you specify that uniquely identifies this update request.
If you are unsure whether a particular update was applied to an order successfully, you can reattempt it with the same idempotency key without worrying about creating duplicate updates to the order. The latest order version is returned.
For more information, see Idempotency.
-
-
client.orders.pay(orderId, request) -> PayOrderResponse
-
π Description
-
-
Pay for an order using one or more approved payments or settle an order with a total of
0.The total of the
payment_idslisted in the request must be equal to the order total. Orders with a total amount of0can be marked as paid by specifying an empty array ofpayment_idsin the request.To be used with
PayOrder, a payment must:- Reference the order by specifying the
order_idwhen creating the payment. Any approved payments that reference the sameorder_idnot specified in thepayment_idsis canceled. - Be approved with delayed capture.
Using a delayed capture payment with
PayOrdercompletes the approved payment.
- Reference the order by specifying the
-
π Usage
-
-
client.orders().pay( PayOrderRequest .builder() .orderId("order_id") .idempotencyKey("c043a359-7ad9-4136-82a9-c3f1d66dcbff") .paymentIds( Optional.of( Arrays.asList("EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB") ) ) .build() );
-
βοΈ Parameters
-
-
orderId:
Stringβ The ID of the order being paid.
-
idempotencyKey:
StringA value you specify that uniquely identifies this request among requests you have sent. If you are unsure whether a particular payment request was completed successfully, you can reattempt it with the same idempotency key without worrying about duplicate payments.
For more information, see Idempotency.
-
orderVersion:
Optional<Integer>β The version of the order being paid. If not supplied, the latest version will be paid.
-
paymentIds:
Optional<List<String>>The IDs of the payments to collect. The payment total must match the order total.
-
-
Payments
client.payments.list() -> SyncPagingIterable<Payment>
-
π Description
-
-
Retrieves a list of payments taken by the account making the request.
Results are eventually consistent, and new payments or changes to payments might take several seconds to appear.
The maximum results per page is 100.
-
π Usage
-
-
client.payments().list( ListPaymentsRequest .builder() .beginTime("begin_time") .endTime("end_time") .sortOrder("sort_order") .cursor("cursor") .locationId("location_id") .total(1000000L) .last4("last_4") .cardBrand("card_brand") .limit(1) .isOfflinePayment(true) .offlineBeginTime("offline_begin_time") .offlineEndTime("offline_end_time") .updatedAtBeginTime("updated_at_begin_time") .updatedAtEndTime("updated_at_end_time") .sortField(ListPaymentsRequestSortField.CREATED_AT) .build() );
-
βοΈ Parameters
-
-
beginTime:
Optional<String>Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The range is determined using the
created_atfield for each Payment. Inclusive. Default: The current time minus one year.
-
endTime:
Optional<String>Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The range is determined using the
created_atfield for each Payment.Default: The current time.
-
sortOrder:
Optional<String>The order in which results are listed by
ListPaymentsRequest.sort_field:ASC- Oldest to newest.DESC- Newest to oldest (default).
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query.
For more information, see Pagination.
-
locationId:
Optional<String>Limit results to the location supplied. By default, results are returned for the default (main) location associated with the seller.
-
total:
Optional<Long>β The exact amount in thetotal_moneyfor a payment.
-
last4:
Optional<String>β The last four digits of a payment card.
-
cardBrand:
Optional<String>β The brand of the payment card (for example, VISA).
-
limit:
Optional<Integer>The maximum number of results to be returned in a single page. It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is greater than 100, it is ignored and the default value is used instead.
Default:
100
-
isOfflinePayment:
Optional<Boolean>β Whether the payment was taken offline or not.
-
offlineBeginTime:
Optional<String>Indicates the start of the time range for which to retrieve offline payments, in RFC 3339 format for timestamps. The range is determined using the
offline_payment_details.client_created_atfield for each Payment. If set, payments without a value set inoffline_payment_details.client_created_atwill not be returned.Default: The current time.
-
offlineEndTime:
Optional<String>Indicates the end of the time range for which to retrieve offline payments, in RFC 3339 format for timestamps. The range is determined using the
offline_payment_details.client_created_atfield for each Payment. If set, payments without a value set inoffline_payment_details.client_created_atwill not be returned.Default: The current time.
-
updatedAtBeginTime:
Optional<String>Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The range is determined using the
updated_atfield for each Payment.
-
updatedAtEndTime:
Optional<String>Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The range is determined using the
updated_atfield for each Payment.
-
sortField:
Optional<ListPaymentsRequestSortField>β The field used to sort results by. The default isCREATED_AT.
-
-
client.payments.create(request) -> CreatePaymentResponse
-
π Description
-
-
Creates a payment using the provided source. You can use this endpoint to charge a card (credit/debit card or
Square gift card) or record a payment that the seller received outside of Square (cash payment from a buyer or a payment that an external entity processed on behalf of the seller).The endpoint creates a
Paymentobject and returns it in the response.
-
π Usage
-
-
client.payments().create( CreatePaymentRequest .builder() .sourceId("ccof:GaJGNaZa8x4OgDJn4GB") .idempotencyKey("7b0f3ec5-086a-4871-8f13-3c81b3875218") .amountMoney( Money .builder() .amount(1000L) .currency(Currency.USD) .build() ) .appFeeMoney( Money .builder() .amount(10L) .currency(Currency.USD) .build() ) .autocomplete(true) .customerId("W92WH6P11H4Z77CTET0RNTGFW8") .locationId("L88917AVBK2S5") .referenceId("123456") .note("Brief description") .build() );
-
βοΈ Parameters
-
-
sourceId:
StringThe ID for the source of funds for this payment. This could be a payment token generated by the Web Payments SDK for any of its supported methods, including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment that the seller received outside of Square, specify either "CASH" or "EXTERNAL". For more information, see Take Payments.
-
idempotencyKey:
StringA unique string that identifies this
CreatePaymentrequest. Keys can be any valid string but must be unique for everyCreatePaymentrequest.Note: The number of allowed characters might be less than the stated maximum, if multi-byte characters are used.
For more information, see Idempotency.
-
amountMoney:
Optional<Money>The amount of money to accept for this payment, not including
tip_money.The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see Working with Monetary Amounts.
The currency code must match the currency associated with the business that is accepting the payment.
-
tipMoney:
Optional<Money>The amount designated as a tip, in addition to
amount_money.The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see Working with Monetary Amounts.
Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.
The currency code must match the currency associated with the business that is accepting the payment.
-
appFeeMoney:
Optional<Money>The amount of money that the developer is taking as a fee for facilitating the payment on behalf of the seller.
The amount cannot be more than 90% of the total amount of the payment.
The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see Working with Monetary Amounts.
The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller.
For more information about the application fee scenario, see Take Payments and Collect Fees.
To set this field,
PAYMENTS_WRITE_ADDITIONAL_RECIPIENTSOAuth permission is required. For more information, see Permissions.
-
appFeeAllocations:
Optional<List<Object>>Details pertaining to recipients of the application fee. The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if present. If populated, an allocation must be present for every party that expects to receive a portion of the application fee, including the application developer.
-
delayDuration:
Optional<String>The duration of time after the payment's creation when Square automatically either completes or cancels the payment depending on the
delay_actionfield value. For more information, see Time threshold.This parameter should be specified as a time duration, in RFC 3339 format.
Note: This feature is only supported for card payments. This parameter can only be set for a delayed capture payment (
autocomplete=false).Default:
- Card-present payments: "PT36H" (36 hours) from the creation time.
- Card-not-present payments: "P7D" (7 days) from the creation time.
-
delayAction:
Optional<String>The action to be applied to the payment when the
delay_durationhas elapsed. The action must be CANCEL or COMPLETE. For more information, see Time Threshold.Default: CANCEL
-
autocomplete:
Optional<Boolean>If set to
true, this payment will be completed when possible. If set tofalse, this payment is held in an approved state until either explicitly completed (captured) or canceled (voided). For more information, see Delayed capture.Default: true
-
orderId:
Optional<String>β Associates a previously created order with this payment.
-
customerId:
Optional<String>The Customer ID of the customer associated with the payment.
This is required if the
source_idrefers to a card on file created using the Cards API.
-
locationId:
Optional<String>The location ID to associate with the payment. If not specified, the main location is used.
-
teamMemberId:
Optional<String>An optional TeamMember ID to associate with this payment.
-
referenceId:
Optional<String>A user-defined ID to associate with the payment.
You can use this field to associate the payment to an entity in an external system (for example, you might specify an order ID that is generated by a third-party shopping cart).
-
verificationToken:
Optional<String>An identifying token generated by payments.verifyBuyer(). Verification tokens encapsulate customer device information and 3-D Secure challenge results to indicate that Square has verified the buyer identity.
For more information, see SCA Overview.
-
acceptPartialAuthorization:
Optional<Boolean>If set to
trueand charging a Square Gift Card, a payment might be returned withamount_moneyequal to less than what was requested. For example, a request for $20 when charging a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card payment. This field cannot betruewhenautocomplete = true.For more information, see Partial amount with Square Gift Cards.
Default: false
-
buyerEmailAddress:
Optional<String>β The buyer's email address.
-
buyerPhoneNumber:
Optional<String>The buyer's phone number. Must follow the following format:
- A leading + symbol (followed by a country code)
- The phone number can contain spaces and the special characters
(,),-, and.. Alphabetical characters aren't allowed. - The phone number must contain between 9 and 16 digits.
-
billingAddress:
Optional<Address>β The buyer's billing address.
-
shippingAddress:
Optional<Address>β The buyer's shipping address.
-
note:
Optional<String>β An optional note to be entered by the developer when creating a payment.
-
statementDescriptionIdentifier:
Optional<String>Optional additional payment information to include on the customer's card statement as part of the statement description. This can be, for example, an invoice number, ticket number, or short description that uniquely identifies the purchase.
Note that the
statement_description_identifiermight get truncated on the statement description to fit the required information including the Square identifier (SQ *) and name of the seller taking the payment.
-
cashDetails:
Optional<CashPaymentDetails>β Additional details required when recording a cash payment (source_idis CASH).
-
externalDetails:
Optional<ExternalPaymentDetails>β Additional details required when recording an external payment (source_idis EXTERNAL).
-
customerDetails:
Optional<CustomerDetails>β Details about the customer making the payment.
-
offlinePaymentDetails:
Optional<OfflinePaymentDetails>An optional field for specifying the offline payment details. This is intended for internal 1st-party callers only.
-
-
client.payments.cancelByIdempotencyKey(request) -> CancelPaymentByIdempotencyKeyResponse
-
π Description
-
-
Cancels (voids) a payment identified by the idempotency key that is specified in the request.
Use this method when the status of a
CreatePaymentrequest is unknown (for example, after you send aCreatePaymentrequest, a network error occurs and you do not get a response). In this case, you can direct Square to cancel the payment using this endpoint. In the request, you provide the same idempotency key that you provided in yourCreatePaymentrequest that you want to cancel. After canceling the payment, you can submit yourCreatePaymentrequest again.Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint returns successfully.
-
π Usage
-
-
client.payments().cancelByIdempotencyKey( CancelPaymentByIdempotencyKeyRequest .builder() .idempotencyKey("a7e36d40-d24b-11e8-b568-0800200c9a66") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Stringβ Theidempotency_keyidentifying the payment to be canceled.
-
-
client.payments.get(paymentId) -> GetPaymentResponse
-
π Description
-
-
Retrieves details for a specific payment.
-
π Usage
-
-
client.payments().get( GetPaymentsRequest .builder() .paymentId("payment_id") .build() );
-
βοΈ Parameters
-
-
paymentId:
Stringβ A unique ID for the desired payment.
-
-
client.payments.update(paymentId, request) -> UpdatePaymentResponse
-
π Description
-
-
Updates a payment with the APPROVED status. You can update the
amount_moneyandtip_moneyusing this endpoint.
-
π Usage
-
-
client.payments().update( UpdatePaymentRequest .builder() .paymentId("payment_id") .idempotencyKey("956f8b13-e4ec-45d6-85e8-d1d95ef0c5de") .payment( Payment .builder() .amountMoney( Money .builder() .amount(1000L) .currency(Currency.USD) .build() ) .tipMoney( Money .builder() .amount(100L) .currency(Currency.USD) .build() ) .versionToken("ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o") .build() ) .build() );
-
βοΈ Parameters
-
-
paymentId:
Stringβ The ID of the payment to update.
-
payment:
Optional<Payment>β The updatedPaymentobject.
-
idempotencyKey:
StringA unique string that identifies this
UpdatePaymentrequest. Keys can be any valid string but must be unique for everyUpdatePaymentrequest.For more information, see Idempotency.
-
-
client.payments.cancel(paymentId) -> CancelPaymentResponse
-
π Description
-
-
Cancels (voids) a payment. You can use this endpoint to cancel a payment with the APPROVED
status.
-
π Usage
-
-
client.payments().cancel( CancelPaymentsRequest .builder() .paymentId("payment_id") .build() );
-
βοΈ Parameters
-
-
paymentId:
Stringβ The ID of the payment to cancel.
-
-
client.payments.complete(paymentId, request) -> CompletePaymentResponse
-
π Description
-
-
Completes (captures) a payment. By default, payments are set to complete immediately after they are created.
You can use this endpoint to complete a payment with the APPROVED
status.
-
π Usage
-
-
client.payments().complete( CompletePaymentRequest .builder() .paymentId("payment_id") .build() );
-
βοΈ Parameters
-
-
paymentId:
Stringβ The unique ID identifying the payment to be completed.
-
versionToken:
Optional<String>Used for optimistic concurrency. This opaque token identifies the current
Paymentversion that the caller expects. If the server has a different version of the Payment, the update fails and a response with a VERSION_MISMATCH error is returned.
-
-
Payouts
client.payouts.list() -> SyncPagingIterable<Payout>
-
π Description
-
-
Retrieves a list of all payouts for the default location. You can filter payouts by location ID, status, time range, and order them in ascending or descending order. To call this endpoint, set
PAYOUTS_READfor the OAuth scope.
-
π Usage
-
-
client.payouts().list( ListPayoutsRequest .builder() .locationId("location_id") .status(PayoutStatus.SENT) .beginTime("begin_time") .endTime("end_time") .sortOrder(SortOrder.DESC) .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
locationId:
Optional<String>The ID of the location for which to list the payouts. By default, payouts are returned for the default (main) location associated with the seller.
-
status:
Optional<PayoutStatus>β If provided, only payouts with the given status are returned.
-
beginTime:
Optional<String>The timestamp for the beginning of the payout creation time, in RFC 3339 format. Inclusive. Default: The current time minus one year.
-
endTime:
Optional<String>The timestamp for the end of the payout creation time, in RFC 3339 format. Default: The current time.
-
sortOrder:
Optional<SortOrder>β The order in which payouts are listed.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. For more information, see Pagination. If request parameters change between requests, subsequent results may contain duplicates or missing records.
-
limit:
Optional<Integer>The maximum number of results to be returned in a single page. It is possible to receive fewer results than the specified limit on a given page. The default value of 100 is also the maximum allowed value. If the provided value is greater than 100, it is ignored and the default value is used instead. Default:
100
-
-
client.payouts.get(payoutId) -> GetPayoutResponse
-
π Description
-
-
Retrieves details of a specific payout identified by a payout ID. To call this endpoint, set
PAYOUTS_READfor the OAuth scope.
-
π Usage
-
-
client.payouts().get( GetPayoutsRequest .builder() .payoutId("payout_id") .build() );
-
βοΈ Parameters
-
-
payoutId:
Stringβ The ID of the payout to retrieve the information for.
-
-
client.payouts.listEntries(payoutId) -> SyncPagingIterable<PayoutEntry>
-
π Description
-
-
Retrieves a list of all payout entries for a specific payout. To call this endpoint, set
PAYOUTS_READfor the OAuth scope.
-
π Usage
-
-
client.payouts().listEntries( ListEntriesPayoutsRequest .builder() .payoutId("payout_id") .sortOrder(SortOrder.DESC) .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
payoutId:
Stringβ The ID of the payout to retrieve the information for.
-
sortOrder:
Optional<SortOrder>β The order in which payout entries are listed.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. For more information, see Pagination. If request parameters change between requests, subsequent results may contain duplicates or missing records.
-
limit:
Optional<Integer>The maximum number of results to be returned in a single page. It is possible to receive fewer results than the specified limit on a given page. The default value of 100 is also the maximum allowed value. If the provided value is greater than 100, it is ignored and the default value is used instead. Default:
100
-
-
Refunds
client.refunds.list() -> SyncPagingIterable<PaymentRefund>
-
π Description
-
-
Retrieves a list of refunds for the account making the request.
Results are eventually consistent, and new refunds or changes to refunds might take several seconds to appear.
The maximum results per page is 100.
-
π Usage
-
-
client.refunds().list( ListRefundsRequest .builder() .beginTime("begin_time") .endTime("end_time") .sortOrder("sort_order") .cursor("cursor") .locationId("location_id") .status("status") .sourceType("source_type") .limit(1) .updatedAtBeginTime("updated_at_begin_time") .updatedAtEndTime("updated_at_end_time") .sortField(ListPaymentRefundsRequestSortField.CREATED_AT) .build() );
-
βοΈ Parameters
-
-
beginTime:
Optional<String>Indicates the start of the time range to retrieve each
PaymentRefundfor, in RFC 3339 format. The range is determined using thecreated_atfield for eachPaymentRefund.Default: The current time minus one year.
-
endTime:
Optional<String>Indicates the end of the time range to retrieve each
PaymentRefundfor, in RFC 3339 format. The range is determined using thecreated_atfield for eachPaymentRefund.Default: The current time.
-
sortOrder:
Optional<String>The order in which results are listed by
PaymentRefund.created_at:ASC- Oldest to newest.DESC- Newest to oldest (default).
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query.
For more information, see Pagination.
-
locationId:
Optional<String>Limit results to the location supplied. By default, results are returned for all locations associated with the seller.
-
status:
Optional<String>If provided, only refunds with the given status are returned. For a list of refund status values, see PaymentRefund.
Default: If omitted, refunds are returned regardless of their status.
-
sourceType:
Optional<String>If provided, only returns refunds whose payments have the indicated source type. Current values include
CARD,BANK_ACCOUNT,WALLET,CASH, andEXTERNAL. For information about these payment source types, see Take Payments.Default: If omitted, refunds are returned regardless of the source type.
-
limit:
Optional<Integer>The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
If the supplied value is greater than 100, no more than 100 results are returned.
Default: 100
-
updatedAtBeginTime:
Optional<String>Indicates the start of the time range to retrieve each
PaymentRefundfor, in RFC 3339 format. The range is determined using theupdated_atfield for eachPaymentRefund.Default: If omitted, the time range starts at
begin_time.
-
updatedAtEndTime:
Optional<String>Indicates the end of the time range to retrieve each
PaymentRefundfor, in RFC 3339 format. The range is determined using theupdated_atfield for eachPaymentRefund.Default: The current time.
-
sortField:
Optional<ListPaymentRefundsRequestSortField>β The field used to sort results by. The default isCREATED_AT.
-
-
client.refunds.refundPayment(request) -> RefundPaymentResponse
-
π Description
-
-
Refunds a payment. You can refund the entire payment amount or a portion of it. You can use this endpoint to refund a card payment or record a refund of a cash or external payment. For more information, see Refund Payment.
-
π Usage
-
-
client.refunds().refundPayment( RefundPaymentRequest .builder() .idempotencyKey("9b7f2dcf-49da-4411-b23e-a2d6af21333a") .amountMoney( Money .builder() .amount(1000L) .currency(Currency.USD) .build() ) .appFeeMoney( Money .builder() .amount(10L) .currency(Currency.USD) .build() ) .paymentId("R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY") .reason("Example") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA unique string that identifies this
RefundPaymentrequest. The key can be any valid string but must be unique for everyRefundPaymentrequest.Keys are limited to a max of 45 characters - however, the number of allowed characters might be less than 45, if multi-byte characters are used.
For more information, see Idempotency.
-
amountMoney:
MoneyThe amount of money to refund.
This amount cannot be more than the
total_moneyvalue of the payment minus the total amount of all previously completed refunds for this payment.This amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see Working with Monetary Amounts.
The currency code must match the currency associated with the business that is charging the card.
-
appFeeMoney:
Optional<Money>The amount of money the developer contributes to help cover the refunded amount. This amount is specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents).
The value cannot be more than the
amount_money.You can specify this parameter in a refund request only if the same parameter was also included when taking the payment. This is part of the application fee scenario the API supports. For more information, see Take Payments and Collect Fees.
To set this field,
PAYMENTS_WRITE_ADDITIONAL_RECIPIENTSOAuth permission is required. For more information, see Permissions.
-
appFeeAllocations:
Optional<List<Object>>Details pertaining to contributors to the refund of the application fee. The sum of the amounts in the app_fee_allocations must equal the app_fee_money amount, if present. If populated, an allocation must be present for every party that expects to contribute a portion of the refunded application fee, including the application developer.
-
paymentId:
Optional<String>The unique ID of the payment being refunded. Required when unlinked=false, otherwise must not be set.
-
destinationId:
Optional<String>The ID indicating where funds will be refunded to. Required for unlinked refunds. For more information, see Process an Unlinked Refund.
For refunds linked to Square payments,
destination_idis usually omitted; in this case, funds will be returned to the original payment source. The field may be specified in order to request a cross-method refund to a gift card. For more information, see Cross-method refunds to gift cards.
-
unlinked:
Optional<Boolean>Indicates that the refund is not linked to a Square payment. If set to true,
destination_idandlocation_idmust be supplied whilepayment_idmust not be provided.
-
locationId:
Optional<String>The location ID associated with the unlinked refund. Required for requests specifying
unlinked=true. Otherwise, if included whenunlinked=false, will throw an error.
-
customerId:
Optional<String>The Customer ID of the customer associated with the refund. This is required if the
destination_idrefers to a card on file created using the Cards API. Only allowed whenunlinked=true.
-
reason:
Optional<String>β A description of the reason for the refund.
-
paymentVersionToken:
Optional<String>Used for optimistic concurrency. This opaque token identifies the current
Paymentversion that the caller expects. If the server has a different version of the Payment, the update fails and a response with a VERSION_MISMATCH error is returned. If the versions match, or the field is not provided, the refund proceeds as normal.
-
teamMemberId:
Optional<String>β An optional TeamMember ID to associate with this refund.
-
cashDetails:
Optional<DestinationDetailsCashRefundDetails>β Additional details required when recording an unlinked cash refund (destination_idis CASH).
-
externalDetails:
Optional<DestinationDetailsExternalRefundDetails>Additional details required when recording an unlinked external refund (
destination_idis EXTERNAL).
-
-
client.refunds.get(refundId) -> GetPaymentRefundResponse
-
π Description
-
-
Retrieves a specific refund using the
refund_id.
-
π Usage
-
-
client.refunds().get( GetRefundsRequest .builder() .refundId("refund_id") .build() );
-
βοΈ Parameters
-
-
refundId:
Stringβ The unique ID for the desiredPaymentRefund.
-
-
Sites
client.sites.list() -> ListSitesResponse
-
π Description
-
-
Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the
created_atdate.Note: Square Online APIs are publicly available as part of an early access program. For more information, see Early access program for Square Online APIs.
-
π Usage
-
-
client.sites().list();
-
-
Snippets
client.snippets.get(siteId) -> GetSnippetResponse
-
π Description
-
-
Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application.
You can call ListSites to get the IDs of the sites that belong to a seller.
Note: Square Online APIs are publicly available as part of an early access program. For more information, see Early access program for Square Online APIs.
-
π Usage
-
-
client.snippets().get( GetSnippetsRequest .builder() .siteId("site_id") .build() );
-
βοΈ Parameters
-
-
siteId:
Stringβ The ID of the site that contains the snippet.
-
-
client.snippets.upsert(siteId, request) -> UpsertSnippetResponse
-
π Description
-
-
Adds a snippet to a Square Online site or updates the existing snippet on the site. The snippet code is appended to the end of the
headelement on every page of the site, except checkout pages. A snippet application can add one snippet to a given site.You can call ListSites to get the IDs of the sites that belong to a seller.
Note: Square Online APIs are publicly available as part of an early access program. For more information, see Early access program for Square Online APIs.
-
π Usage
-
-
client.snippets().upsert( UpsertSnippetRequest .builder() .siteId("site_id") .snippet( Snippet .builder() .content("<script>var js = 1;</script>") .build() ) .build() );
-
βοΈ Parameters
-
-
siteId:
Stringβ The ID of the site where you want to add or update the snippet.
-
snippet:
Snippetβ The snippet for the site.
-
-
client.snippets.delete(siteId) -> DeleteSnippetResponse
-
π Description
-
-
Removes your snippet from a Square Online site.
You can call ListSites to get the IDs of the sites that belong to a seller.
Note: Square Online APIs are publicly available as part of an early access program. For more information, see Early access program for Square Online APIs.
-
π Usage
-
-
client.snippets().delete( DeleteSnippetsRequest .builder() .siteId("site_id") .build() );
-
βοΈ Parameters
-
-
siteId:
Stringβ The ID of the site that contains the snippet.
-
-
Subscriptions
client.subscriptions.create(request) -> CreateSubscriptionResponse
-
π Description
-
-
Enrolls a customer in a subscription.
If you provide a card on file in the request, Square charges the card for the subscription. Otherwise, Square sends an invoice to the customer's email address. The subscription starts immediately, unless the request includes the optional
start_date. Each individual subscription is associated with a particular location.For more information, see Create a subscription.
-
π Usage
-
-
client.subscriptions().create( CreateSubscriptionRequest .builder() .locationId("S8GWD5R9QB376") .customerId("CHFGVKYY8RSV93M5KCYTG4PN0G") .idempotencyKey("8193148c-9586-11e6-99f9-28cfe92138cf") .planVariationId("6JHXF3B2CW3YKHDV4XEM674H") .startDate("2023-06-20") .cardId("ccof:qy5x8hHGYsgLrp4Q4GB") .timezone("America/Los_Angeles") .source( SubscriptionSource .builder() .name("My Application") .build() ) .phases( Optional.of( Arrays.asList( Phase .builder() .ordinal(0L) .orderTemplateId("U2NaowWxzXwpsZU697x7ZHOAnCNZY") .build() ) ) ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>A unique string that identifies this
CreateSubscriptionrequest. If you do not provide a unique string (or provide an empty string as the value), the endpoint treats each request as independent.For more information, see Idempotency keys.
-
locationId:
Stringβ The ID of the location the subscription is associated with.
-
planVariationId:
Optional<String>β The ID of the subscription plan variation created using the Catalog API.
-
customerId:
Stringβ The ID of the customer subscribing to the subscription plan variation.
-
startDate:
Optional<String>The
YYYY-MM-DD-formatted date to start the subscription. If it is unspecified, the subscription starts immediately.
-
canceledDate:
Optional<String>The
YYYY-MM-DD-formatted date when the newly created subscription is scheduled for cancellation.This date overrides the cancellation date set in the plan variation configuration. If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops at the canceled date and the subscriber is sent a prorated invoice at the beginning of the canceled cycle.
When the subscription plan of the newly created subscription has a fixed number of cycles and the
canceled_dateoccurs before the subscription plan completes, the specifiedcanceled_datesets the date when the subscription stops through the end of the last cycle.
-
taxPercentage:
Optional<String>The tax to add when billing the subscription. The percentage is expressed in decimal form, using a
'.'as the decimal separator and without a'%'sign. For example, a value of 7.5 corresponds to 7.5%.
-
priceOverrideMoney:
Optional<Money>A custom price which overrides the cost of a subscription plan variation with
STATICpricing. This field does not affect itemized subscriptions withRELATIVEpricing. Instead, you should edit the Subscription's order template.
-
cardId:
Optional<String>The ID of the subscriber's card to charge. If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription.
-
timezone:
Optional<String>The timezone that is used in date calculations for the subscription. If unset, defaults to the location timezone. If a timezone is not configured for the location, defaults to "America/New_York". Format: the IANA Timezone Database identifier for the location timezone. For a list of time zones, see List of tz database time zones.
-
source:
Optional<SubscriptionSource>β The origination details of the subscription.
-
monthlyBillingAnchorDate:
Optional<Integer>β The day-of-the-month to change the billing date to.
-
phases:
Optional<List<Phase>>β array of phases for this subscription
-
-
client.subscriptions.bulkSwapPlan(request) -> BulkSwapPlanResponse
-
π Description
-
-
Schedules a plan variation change for all active subscriptions under a given plan variation. For more information, see Swap Subscription Plan Variations.
-
π Usage
-
-
client.subscriptions().bulkSwapPlan( BulkSwapPlanRequest .builder() .newPlanVariationId("FQ7CDXXWSLUJRPM3GFJSJGZ7") .oldPlanVariationId("6JHXF3B2CW3YKHDV4XEM674H") .locationId("S8GWD5R9QB376") .build() );
-
βοΈ Parameters
-
-
newPlanVariationId:
StringThe ID of the new subscription plan variation.
This field is required.
-
oldPlanVariationId:
StringThe ID of the plan variation whose subscriptions should be swapped. Active subscriptions using this plan variation will be subscribed to the new plan variation on their next billing day.
-
locationId:
Stringβ The ID of the location to associate with the swapped subscriptions.
-
-
client.subscriptions.search(request) -> SearchSubscriptionsResponse
-
π Description
-
-
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.
You can also optionally specify
customer_idsto search by customer. If left unset, all customers associated with the specified locations are returned. If the request specifies customer IDs, the endpoint orders results first by location, within location by customer ID, and within customer by subscription creation date.
-
π Usage
-
-
client.subscriptions().search( SearchSubscriptionsRequest .builder() .query( SearchSubscriptionsQuery .builder() .filter( SearchSubscriptionsFilter .builder() .customerIds( Optional.of( Arrays.asList("CHFGVKYY8RSV93M5KCYTG4PN0G") ) ) .locationIds( Optional.of( Arrays.asList("S8GWD5R9QB376") ) ) .sourceNames( Optional.of( Arrays.asList("My App") ) ) .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>When the total number of resulting subscriptions exceeds the limit of a paged response, specify the cursor returned from a preceding response here to fetch the next set of results. If the cursor is unset, the response contains the last page of the results.
For more information, see Pagination.
-
limit:
Optional<Integer>The upper limit on the number of subscriptions to return in a paged response.
-
query:
Optional<SearchSubscriptionsQuery>A subscription query consisting of specified filtering conditions.
If this
queryfield is unspecified, theSearchSubscriptionscall will return all subscriptions.
-
include:
Optional<List<String>>An option to include related information in the response.
The supported values are:
actions: to include scheduled actions on the targeted subscriptions.
-
-
client.subscriptions.get(subscriptionId) -> GetSubscriptionResponse
-
π Description
-
-
Retrieves a specific subscription.
-
π Usage
-
-
client.subscriptions().get( GetSubscriptionsRequest .builder() .subscriptionId("subscription_id") .include("include") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription to retrieve.
-
include:
Optional<String>A query parameter to specify related information to be included in the response.
The supported query parameter values are:
actions: to include scheduled actions on the targeted subscription.
-
-
client.subscriptions.update(subscriptionId, request) -> UpdateSubscriptionResponse
-
π Description
-
-
Updates a subscription by modifying or clearing
subscriptionfield values. To clear a field, set its value tonull.
-
π Usage
-
-
client.subscriptions().update( UpdateSubscriptionRequest .builder() .subscriptionId("subscription_id") .subscription( Subscription .builder() .cardId("{NEW CARD ID}") .build() ) .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription to update.
-
subscription:
Optional<Subscription>The subscription object containing the current version, and fields to update. Unset fields will be left at their current server values, and JSON
nullvalues will be treated as a request to clear the relevant data.
-
-
client.subscriptions.deleteAction(subscriptionId, actionId) -> DeleteSubscriptionActionResponse
-
π Description
-
-
Deletes a scheduled action for a subscription.
-
π Usage
-
-
client.subscriptions().deleteAction( DeleteActionSubscriptionsRequest .builder() .subscriptionId("subscription_id") .actionId("action_id") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription the targeted action is to act upon.
-
actionId:
Stringβ The ID of the targeted action to be deleted.
-
-
client.subscriptions.changeBillingAnchorDate(subscriptionId, request) -> ChangeBillingAnchorDateResponse
-
π Description
-
-
Changes the billing anchor date for a subscription.
-
π Usage
-
-
client.subscriptions().changeBillingAnchorDate( ChangeBillingAnchorDateRequest .builder() .subscriptionId("subscription_id") .monthlyBillingAnchorDate(1) .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription to update the billing anchor date.
-
monthlyBillingAnchorDate:
Optional<Integer>β The anchor day for the billing cycle.
-
effectiveDate:
Optional<String>The
YYYY-MM-DD-formatted date when the scheduledBILLING_ANCHOR_CHANGEaction takes place on the subscription.When this date is unspecified or falls within the current billing cycle, the billing anchor date is changed immediately.
-
-
client.subscriptions.cancel(subscriptionId) -> CancelSubscriptionResponse
-
π Description
-
-
Schedules a
CANCELaction to cancel an active subscription. This sets thecanceled_datefield to the end of the active billing period. After this date, the subscription status changes from ACTIVE to CANCELED.
-
π Usage
-
-
client.subscriptions().cancel( CancelSubscriptionsRequest .builder() .subscriptionId("subscription_id") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription to cancel.
-
-
client.subscriptions.listEvents(subscriptionId) -> SyncPagingIterable<SubscriptionEvent>
-
π Description
-
-
Lists all events for a specific subscription.
-
π Usage
-
-
client.subscriptions().listEvents( ListEventsSubscriptionsRequest .builder() .subscriptionId("subscription_id") .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription to retrieve the events for.
-
cursor:
Optional<String>When the total number of resulting subscription events exceeds the limit of a paged response, specify the cursor returned from a preceding response here to fetch the next set of results. If the cursor is unset, the response contains the last page of the results.
For more information, see Pagination.
-
limit:
Optional<Integer>The upper limit on the number of subscription events to return in a paged response.
-
-
client.subscriptions.pause(subscriptionId, request) -> PauseSubscriptionResponse
-
π Description
-
-
Schedules a
PAUSEaction to pause an active subscription.
-
π Usage
-
-
client.subscriptions().pause( PauseSubscriptionRequest .builder() .subscriptionId("subscription_id") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription to pause.
-
pauseEffectiveDate:
Optional<String>The
YYYY-MM-DD-formatted date when the scheduledPAUSEaction takes place on the subscription.When this date is unspecified or falls within the current billing cycle, the subscription is paused on the starting date of the next billing cycle.
-
pauseCycleDuration:
Optional<Long>The number of billing cycles the subscription will be paused before it is reactivated.
When this is set, a
RESUMEaction is also scheduled to take place on the subscription at the end of the specified pause cycle duration. In this case, neitherresume_effective_datenorresume_change_timingmay be specified.
-
resumeEffectiveDate:
Optional<String>The date when the subscription is reactivated by a scheduled
RESUMEaction. This date must be at least one billing cycle ahead ofpause_effective_date.
-
resumeChangeTiming:
Optional<ChangeTiming>The timing whether the subscription is reactivated immediately or at the end of the billing cycle, relative to
resume_effective_date. See ChangeTiming for possible values
-
pauseReason:
Optional<String>β The user-provided reason to pause the subscription.
-
-
client.subscriptions.resume(subscriptionId, request) -> ResumeSubscriptionResponse
-
π Description
-
-
Schedules a
RESUMEaction to resume a paused or a deactivated subscription.
-
π Usage
-
-
client.subscriptions().resume( ResumeSubscriptionRequest .builder() .subscriptionId("subscription_id") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription to resume.
-
resumeEffectiveDate:
Optional<String>β TheYYYY-MM-DD-formatted date when the subscription reactivated.
-
resumeChangeTiming:
Optional<ChangeTiming>The timing to resume a subscription, relative to the specified
resume_effective_dateattribute value. See ChangeTiming for possible values
-
-
client.subscriptions.swapPlan(subscriptionId, request) -> SwapPlanResponse
-
π Description
-
-
Schedules a
SWAP_PLANaction to swap a subscription plan variation in an existing subscription. For more information, see Swap Subscription Plan Variations.
-
π Usage
-
-
client.subscriptions().swapPlan( SwapPlanRequest .builder() .subscriptionId("subscription_id") .newPlanVariationId("FQ7CDXXWSLUJRPM3GFJSJGZ7") .phases( Optional.of( Arrays.asList( PhaseInput .builder() .ordinal(0L) .orderTemplateId("uhhnjH9osVv3shUADwaC0b3hNxQZY") .build() ) ) ) .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ The ID of the subscription to swap the subscription plan for.
-
newPlanVariationId:
Optional<String>The ID of the new subscription plan variation.
This field is required.
-
phases:
Optional<List<PhaseInput>>β A list of PhaseInputs, to pass phase-specific information used in the swap.
-
-
TeamMembers
client.teamMembers.create(request) -> CreateTeamMemberResponse
-
π Description
-
-
Creates a single
TeamMemberobject. TheTeamMemberobject is returned on successful creates. You must provide the following values in your request to this endpoint:given_namefamily_name
Learn about Troubleshooting the Team API.
-
π Usage
-
-
client.teamMembers().create( CreateTeamMemberRequest .builder() .idempotencyKey("idempotency-key-0") .teamMember( TeamMember .builder() .referenceId("reference_id_1") .status(TeamMemberStatus.ACTIVE) .givenName("Joe") .familyName("Doe") .emailAddress("joe_doe@gmail.com") .phoneNumber("+14159283333") .assignedLocations( TeamMemberAssignedLocations .builder() .assignmentType(TeamMemberAssignedLocationsAssignmentType.EXPLICIT_LOCATIONS) .locationIds( Optional.of( Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT") ) ) .build() ) .wageSetting( WageSetting .builder() .jobAssignments( Optional.of( Arrays.asList( JobAssignment .builder() .payType(JobAssignmentPayType.SALARY) .annualRate( Money .builder() .amount(3000000L) .currency(Currency.USD) .build() ) .weeklyHours(40) .jobId("FjS8x95cqHiMenw4f1NAUH4P") .build(), JobAssignment .builder() .payType(JobAssignmentPayType.HOURLY) .hourlyRate( Money .builder() .amount(2000L) .currency(Currency.USD) .build() ) .jobId("VDNpRv8da51NU8qZFC5zDWpF") .build() ) ) ) .isOvertimeExempt(true) .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
request:
CreateTeamMemberRequest
-
-
client.teamMembers.batchCreate(request) -> BatchCreateTeamMembersResponse
-
π Description
-
-
Creates multiple
TeamMemberobjects. The createdTeamMemberobjects are returned on successful creates. This process is non-transactional and processes as much of the request as possible. If one of the creates in the request cannot be successfully processed, the request is not marked as failed, but the body of the response contains explicit error information for the failed create.Learn about Troubleshooting the Team API.
-
π Usage
-
-
client.teamMembers().batchCreate( BatchCreateTeamMembersRequest .builder() .teamMembers( new HashMap<String, CreateTeamMemberRequest>() {{ put("idempotency-key-1", CreateTeamMemberRequest .builder() .teamMember( Optional.of( TeamMember .builder() .referenceId(Optional.of("reference_id_1")) .givenName(Optional.of("Joe")) .familyName(Optional.of("Doe")) .emailAddress(Optional.of("joe_doe@gmail.com")) .phoneNumber(Optional.of("+14159283333")) .assignedLocations( Optional.of( TeamMemberAssignedLocations .builder() .assignmentType(Optional.of(TeamMemberAssignedLocationsAssignmentType.EXPLICIT_LOCATIONS)) .locationIds( Optional.of( Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT") ) ) .build() ) ) .build() ) ) .build()); put("idempotency-key-2", CreateTeamMemberRequest .builder() .teamMember( Optional.of( TeamMember .builder() .referenceId(Optional.of("reference_id_2")) .givenName(Optional.of("Jane")) .familyName(Optional.of("Smith")) .emailAddress(Optional.of("jane_smith@gmail.com")) .phoneNumber(Optional.of("+14159223334")) .assignedLocations( Optional.of( TeamMemberAssignedLocations .builder() .assignmentType(Optional.of(TeamMemberAssignedLocationsAssignmentType.ALL_CURRENT_AND_FUTURE_LOCATIONS)) .build() ) ) .build() ) ) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
teamMembers:
Map<String, CreateTeamMemberRequest>The data used to create the
TeamMemberobjects. Each key is theidempotency_keythat maps to theCreateTeamMemberRequest. The maximum number of create objects is 25.If you include a team member's
wage_setting, you must providejob_idfor each job assignment. To get job IDs, call ListJobs.
-
-
client.teamMembers.batchUpdate(request) -> BatchUpdateTeamMembersResponse
-
π Description
-
-
Updates multiple
TeamMemberobjects. The updatedTeamMemberobjects are returned on successful updates. This process is non-transactional and processes as much of the request as possible. If one of the updates in the request cannot be successfully processed, the request is not marked as failed, but the body of the response contains explicit error information for the failed update. Learn about Troubleshooting the Team API.
-
π Usage
-
-
client.teamMembers().batchUpdate( BatchUpdateTeamMembersRequest .builder() .teamMembers( new HashMap<String, UpdateTeamMemberRequest>() {{ put("AFMwA08kR-MIF-3Vs0OE", UpdateTeamMemberRequest .builder() .teamMember( Optional.of( TeamMember .builder() .referenceId(Optional.of("reference_id_2")) .isOwner(Optional.of(false)) .status(Optional.of(TeamMemberStatus.ACTIVE)) .givenName(Optional.of("Jane")) .familyName(Optional.of("Smith")) .emailAddress(Optional.of("jane_smith@gmail.com")) .phoneNumber(Optional.of("+14159223334")) .assignedLocations( Optional.of( TeamMemberAssignedLocations .builder() .assignmentType(Optional.of(TeamMemberAssignedLocationsAssignmentType.ALL_CURRENT_AND_FUTURE_LOCATIONS)) .build() ) ) .build() ) ) .build()); put("fpgteZNMaf0qOK-a4t6P", UpdateTeamMemberRequest .builder() .teamMember( Optional.of( TeamMember .builder() .referenceId(Optional.of("reference_id_1")) .isOwner(Optional.of(false)) .status(Optional.of(TeamMemberStatus.ACTIVE)) .givenName(Optional.of("Joe")) .familyName(Optional.of("Doe")) .emailAddress(Optional.of("joe_doe@gmail.com")) .phoneNumber(Optional.of("+14159283333")) .assignedLocations( Optional.of( TeamMemberAssignedLocations .builder() .assignmentType(Optional.of(TeamMemberAssignedLocationsAssignmentType.EXPLICIT_LOCATIONS)) .locationIds( Optional.of( Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT") ) ) .build() ) ) .build() ) ) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
teamMembers:
Map<String, UpdateTeamMemberRequest>The data used to update the
TeamMemberobjects. Each key is theteam_member_idthat maps to theUpdateTeamMemberRequest. The maximum number of update objects is 25.For each team member, include the fields to add, change, or clear. Fields can be cleared using a null value. To update
wage_setting.job_assignments, you must provide the complete list of job assignments. If needed, call ListJobs to get the requiredjob_idvalues.
-
-
client.teamMembers.search(request) -> SearchTeamMembersResponse
-
π Description
-
-
Returns a paginated list of
TeamMemberobjects for a business. The list can be filtered by location IDs,ACTIVEorINACTIVEstatus, or whether the team member is the Square account owner.
-
π Usage
-
-
client.teamMembers().search( SearchTeamMembersRequest .builder() .query( SearchTeamMembersQuery .builder() .filter( SearchTeamMembersFilter .builder() .locationIds( Optional.of( Arrays.asList("0G5P3VGACMMQZ") ) ) .status(TeamMemberStatus.ACTIVE) .build() ) .build() ) .limit(10) .build() );
-
βοΈ Parameters
-
-
query:
Optional<SearchTeamMembersQuery>β The query parameters.
-
limit:
Optional<Integer>β The maximum number ofTeamMemberobjects in a page (100 by default).
-
cursor:
Optional<String>The opaque cursor for fetching the next page. For more information, see pagination.
-
-
client.teamMembers.get(teamMemberId) -> GetTeamMemberResponse
-
π Description
-
-
Retrieves a
TeamMemberobject for the givenTeamMember.id. Learn about Troubleshooting the Team API.
-
π Usage
-
-
client.teamMembers().get( GetTeamMembersRequest .builder() .teamMemberId("team_member_id") .build() );
-
βοΈ Parameters
-
-
teamMemberId:
Stringβ The ID of the team member to retrieve.
-
-
client.teamMembers.update(teamMemberId, request) -> UpdateTeamMemberResponse
-
π Description
-
-
Updates a single
TeamMemberobject. TheTeamMemberobject is returned on successful updates. Learn about Troubleshooting the Team API.
-
π Usage
-
-
client.teamMembers().update( UpdateTeamMembersRequest .builder() .teamMemberId("team_member_id") .body( UpdateTeamMemberRequest .builder() .teamMember( TeamMember .builder() .referenceId("reference_id_1") .status(TeamMemberStatus.ACTIVE) .givenName("Joe") .familyName("Doe") .emailAddress("joe_doe@gmail.com") .phoneNumber("+14159283333") .assignedLocations( TeamMemberAssignedLocations .builder() .assignmentType(TeamMemberAssignedLocationsAssignmentType.EXPLICIT_LOCATIONS) .locationIds( Optional.of( Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT") ) ) .build() ) .wageSetting( WageSetting .builder() .jobAssignments( Optional.of( Arrays.asList( JobAssignment .builder() .payType(JobAssignmentPayType.SALARY) .annualRate( Money .builder() .amount(3000000L) .currency(Currency.USD) .build() ) .weeklyHours(40) .jobId("FjS8x95cqHiMenw4f1NAUH4P") .build(), JobAssignment .builder() .payType(JobAssignmentPayType.HOURLY) .hourlyRate( Money .builder() .amount(1200L) .currency(Currency.USD) .build() ) .jobId("VDNpRv8da51NU8qZFC5zDWpF") .build() ) ) ) .isOvertimeExempt(true) .build() ) .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
teamMemberId:
Stringβ The ID of the team member to update.
-
request:
UpdateTeamMemberRequest
-
-
Team
client.team.listJobs() -> ListJobsResponse
-
π Description
-
-
Lists jobs in a seller account. Results are sorted by title in ascending order.
-
π Usage
-
-
client.team().listJobs( ListJobsRequest .builder() .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>The pagination cursor returned by the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
-
client.team.createJob(request) -> CreateJobResponse
-
π Description
-
-
Creates a job in a seller account. A job defines a title and tip eligibility. Note that compensation is defined in a job assignment in a team member's wage setting.
-
π Usage
-
-
client.team().createJob( CreateJobRequest .builder() .job( Job .builder() .title("Cashier") .isTipEligible(true) .build() ) .idempotencyKey("idempotency-key-0") .build() );
-
βοΈ Parameters
-
-
job:
Jobβ The job to create. Thetitlefield is required andis_tip_eligibledefaults to true.
-
idempotencyKey:
StringA unique identifier for the
CreateJobrequest. Keys can be any valid string, but must be unique for each request. For more information, see Idempotency.
-
-
client.team.retrieveJob(jobId) -> RetrieveJobResponse
-
π Description
-
-
Retrieves a specified job.
-
π Usage
-
-
client.team().retrieveJob( RetrieveJobRequest .builder() .jobId("job_id") .build() );
-
βοΈ Parameters
-
-
jobId:
Stringβ The ID of the job to retrieve.
-
-
client.team.updateJob(jobId, request) -> UpdateJobResponse
-
π Description
-
-
Updates the title or tip eligibility of a job. Changes to the title propagate to all
JobAssignment,Shift, andTeamMemberWageobjects that reference the job ID. Changes to tip eligibility propagate to allTeamMemberWageobjects that reference the job ID.
-
π Usage
-
-
client.team().updateJob( UpdateJobRequest .builder() .jobId("job_id") .job( Job .builder() .title("Cashier 1") .isTipEligible(true) .build() ) .build() );
-
βοΈ Parameters
-
-
jobId:
Stringβ The ID of the job to update.
-
job:
JobThe job with the updated fields, either
title,is_tip_eligible, or both. Only changed fields need to be included in the request. Optionally includeversionto enable optimistic concurrency control.
-
-
Terminal
client.terminal.dismissTerminalAction(actionId) -> DismissTerminalActionResponse
-
π Description
-
-
Dismisses a Terminal action request if the status and type of the request permits it.
See Link and Dismiss Actions for more details.
-
π Usage
-
-
client.terminal().dismissTerminalAction( DismissTerminalActionRequest .builder() .actionId("action_id") .build() );
-
βοΈ Parameters
-
-
actionId:
Stringβ Unique ID for theTerminalActionassociated with the action to be dismissed.
-
-
client.terminal.dismissTerminalCheckout(checkoutId) -> DismissTerminalCheckoutResponse
-
π Description
-
-
Dismisses a Terminal checkout request if the status and type of the request permits it.
-
π Usage
-
-
client.terminal().dismissTerminalCheckout( DismissTerminalCheckoutRequest .builder() .checkoutId("checkout_id") .build() );
-
βοΈ Parameters
-
-
checkoutId:
Stringβ Unique ID for theTerminalCheckoutassociated with the checkout to be dismissed.
-
-
client.terminal.dismissTerminalRefund(terminalRefundId) -> DismissTerminalRefundResponse
-
π Description
-
-
Dismisses a Terminal refund request if the status and type of the request permits it.
-
π Usage
-
-
client.terminal().dismissTerminalRefund( DismissTerminalRefundRequest .builder() .terminalRefundId("terminal_refund_id") .build() );
-
βοΈ Parameters
-
-
terminalRefundId:
Stringβ Unique ID for theTerminalRefundassociated with the refund to be dismissed.
-
-
TransferOrders
client.transferOrders.create(request) -> CreateTransferOrderResponse
-
π Description
-
-
Creates a new transfer order in DRAFT status. A transfer order represents the intent to move CatalogItemVariations from one Location to another. The source and destination locations must be different and must belong to your Square account.
In DRAFT status, you can:
- Add or remove items
- Modify quantities
- Update shipping information
- Delete the entire order via DeleteTransferOrder
The request requires source_location_id and destination_location_id. Inventory levels are not affected until the order is started via StartTransferOrder.
Common integration points:
- Sync with warehouse management systems
- Automate regular stock transfers
- Initialize transfers from inventory optimization systems
Creates a transfer_order.created webhook event.
-
π Usage
-
-
client.transferOrders().create( CreateTransferOrderRequest .builder() .idempotencyKey("65cc0586-3e82-384s-b524-3885cffd52") .transferOrder( CreateTransferOrderData .builder() .sourceLocationId("EXAMPLE_SOURCE_LOCATION_ID_123") .destinationLocationId("EXAMPLE_DEST_LOCATION_ID_456") .expectedAt("2025-11-09T05:00:00Z") .notes("Example transfer order for inventory redistribution between locations") .trackingNumber("TRACK123456789") .createdByTeamMemberId("EXAMPLE_TEAM_MEMBER_ID_789") .lineItems( Optional.of( Arrays.asList( CreateTransferOrderLineData .builder() .itemVariationId("EXAMPLE_ITEM_VARIATION_ID_001") .quantityOrdered("5") .build(), CreateTransferOrderLineData .builder() .itemVariationId("EXAMPLE_ITEM_VARIATION_ID_002") .quantityOrdered("3") .build() ) ) ) .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA unique string that identifies this CreateTransferOrder request. Keys can be any valid string but must be unique for every CreateTransferOrder request.
-
transferOrder:
CreateTransferOrderDataβ The transfer order to create
-
-
client.transferOrders.search(request) -> SyncPagingIterable<TransferOrder>
-
π Description
-
-
Searches for transfer orders using filters. Returns a paginated list of matching TransferOrders sorted by creation date.
Common search scenarios:
- Find orders for a source Location
- Find orders for a destination Location
- Find orders in a particular TransferOrderStatus
-
π Usage
-
-
client.transferOrders().search( SearchTransferOrdersRequest .builder() .query( TransferOrderQuery .builder() .filter( TransferOrderFilter .builder() .sourceLocationIds( Optional.of( Arrays.asList("EXAMPLE_SOURCE_LOCATION_ID_123") ) ) .destinationLocationIds( Optional.of( Arrays.asList("EXAMPLE_DEST_LOCATION_ID_456") ) ) .statuses( Optional.of( Arrays.asList(TransferOrderStatus.STARTED, TransferOrderStatus.PARTIALLY_RECEIVED) ) ) .build() ) .sort( TransferOrderSort .builder() .field(TransferOrderSortField.UPDATED_AT) .order(SortOrder.DESC) .build() ) .build() ) .cursor("eyJsYXN0X3VwZGF0ZWRfYXQiOjE3NTMxMTg2NjQ4NzN9") .limit(10) .build() );
-
βοΈ Parameters
-
-
query:
Optional<TransferOrderQuery>β The search query
-
cursor:
Optional<String>β Pagination cursor from a previous search response
-
limit:
Optional<Integer>β Maximum number of results to return (1-100)
-
-
client.transferOrders.get(transferOrderId) -> RetrieveTransferOrderResponse
-
π Description
-
-
Retrieves a specific TransferOrder by ID. Returns the complete order details including:
- Basic information (status, dates, notes)
- Line items with ordered and received quantities
- Source and destination Locations
- Tracking information (if available)
-
π Usage
-
-
client.transferOrders().get( GetTransferOrdersRequest .builder() .transferOrderId("transfer_order_id") .build() );
-
βοΈ Parameters
-
-
transferOrderId:
Stringβ The ID of the transfer order to retrieve
-
-
client.transferOrders.update(transferOrderId, request) -> UpdateTransferOrderResponse
-
π Description
-
-
Updates an existing transfer order. This endpoint supports sparse updates, allowing you to modify specific fields without affecting others.
Creates a transfer_order.updated webhook event.
-
π Usage
-
-
client.transferOrders().update( UpdateTransferOrderRequest .builder() .transferOrderId("transfer_order_id") .idempotencyKey("f47ac10b-58cc-4372-a567-0e02b2c3d479") .transferOrder( UpdateTransferOrderData .builder() .sourceLocationId("EXAMPLE_SOURCE_LOCATION_ID_789") .destinationLocationId("EXAMPLE_DEST_LOCATION_ID_101") .expectedAt("2025-11-10T08:00:00Z") .notes("Updated: Priority transfer due to low stock at destination") .trackingNumber("TRACK987654321") .lineItems( Optional.of( Arrays.asList( UpdateTransferOrderLineData .builder() .uid("1") .quantityOrdered("7") .build(), UpdateTransferOrderLineData .builder() .itemVariationId("EXAMPLE_NEW_ITEM_VARIATION_ID_003") .quantityOrdered("2") .build(), UpdateTransferOrderLineData .builder() .uid("2") .remove(true) .build() ) ) ) .build() ) .version(1753109537351L) .build() );
-
βοΈ Parameters
-
-
transferOrderId:
Stringβ The ID of the transfer order to update
-
idempotencyKey:
Stringβ A unique string that identifies this UpdateTransferOrder request. Keys must contain only alphanumeric characters, dashes and underscores
-
transferOrder:
UpdateTransferOrderDataβ The transfer order updates to apply
-
version:
Optional<Long>β Version for optimistic concurrency
-
-
client.transferOrders.delete(transferOrderId) -> DeleteTransferOrderResponse
-
π Description
-
-
Deletes a transfer order in DRAFT status. Only draft orders can be deleted. Once an order is started via StartTransferOrder, it can no longer be deleted.
Creates a transfer_order.deleted webhook event.
-
π Usage
-
-
client.transferOrders().delete( DeleteTransferOrdersRequest .builder() .transferOrderId("transfer_order_id") .version(1000000L) .build() );
-
βοΈ Parameters
-
-
transferOrderId:
Stringβ The ID of the transfer order to delete
-
version:
Optional<Long>β Version for optimistic concurrency
-
-
client.transferOrders.cancel(transferOrderId, request) -> CancelTransferOrderResponse
-
π Description
-
-
Cancels a transfer order in STARTED or PARTIALLY_RECEIVED status. Any unreceived quantities will no longer be receivable and will be immediately returned to the source Location's inventory.
Common reasons for cancellation:
- Items no longer needed at destination
- Source location needs the inventory
- Order created in error
Creates a transfer_order.updated webhook event.
-
π Usage
-
-
client.transferOrders().cancel( CancelTransferOrderRequest .builder() .transferOrderId("transfer_order_id") .idempotencyKey("65cc0586-3e82-4d08-b524-3885cffd52") .version(1753117449752L) .build() );
-
βοΈ Parameters
-
-
transferOrderId:
Stringβ The ID of the transfer order to cancel. Must be in STARTED or PARTIALLY_RECEIVED status.
-
idempotencyKey:
StringA unique string that identifies this UpdateTransferOrder request. Keys can be any valid string but must be unique for every UpdateTransferOrder request.
-
version:
Optional<Long>β Version for optimistic concurrency
-
-
client.transferOrders.receive(transferOrderId, request) -> ReceiveTransferOrderResponse
-
π Description
-
-
Records receipt of CatalogItemVariations for a transfer order. This endpoint supports partial receiving - you can receive items in multiple batches.
For each line item, you can specify:
- Quantity received in good condition (added to destination inventory with InventoryState of IN_STOCK)
- Quantity damaged during transit/handling (added to destination inventory with InventoryState of WASTE)
- Quantity canceled (returned to source location's inventory)
The order must be in STARTED or PARTIALLY_RECEIVED status. Received quantities are added to the destination Location's inventory according to their condition. Canceled quantities are immediately returned to the source Location's inventory.
When all items are either received, damaged, or canceled, the order moves to COMPLETED status.
Creates a transfer_order.updated webhook event.
-
π Usage
-
-
client.transferOrders().receive( ReceiveTransferOrderRequest .builder() .transferOrderId("transfer_order_id") .idempotencyKey("EXAMPLE_IDEMPOTENCY_KEY_101") .receipt( TransferOrderGoodsReceipt .builder() .lineItems( Optional.of( Arrays.asList( TransferOrderGoodsReceiptLineItem .builder() .transferOrderLineUid("1") .quantityReceived("3") .quantityDamaged("1") .quantityCanceled("1") .build(), TransferOrderGoodsReceiptLineItem .builder() .transferOrderLineUid("2") .quantityReceived("2") .quantityCanceled("1") .build() ) ) ) .build() ) .version(1753118664873L) .build() );
-
βοΈ Parameters
-
-
transferOrderId:
Stringβ The ID of the transfer order to receive items for
-
idempotencyKey:
Stringβ A unique key to make this request idempotent
-
receipt:
TransferOrderGoodsReceiptβ The receipt details
-
version:
Optional<Long>β Version for optimistic concurrency
-
-
client.transferOrders.start(transferOrderId, request) -> StartTransferOrderResponse
-
π Description
-
-
Changes a DRAFT transfer order to STARTED status. This decrements inventory at the source Location and marks it as in-transit.
The order must be in DRAFT status and have all required fields populated. Once started, the order can no longer be deleted, but it can be canceled via CancelTransferOrder.
Creates a transfer_order.updated webhook event.
-
π Usage
-
-
client.transferOrders().start( StartTransferOrderRequest .builder() .transferOrderId("transfer_order_id") .idempotencyKey("EXAMPLE_IDEMPOTENCY_KEY_789") .version(1753109537351L) .build() );
-
βοΈ Parameters
-
-
transferOrderId:
Stringβ The ID of the transfer order to start. Must be in DRAFT status.
-
idempotencyKey:
StringA unique string that identifies this UpdateTransferOrder request. Keys can be any valid string but must be unique for every UpdateTransferOrder request.
-
version:
Optional<Long>β Version for optimistic concurrency
-
-
Vendors
client.vendors.batchCreate(request) -> BatchCreateVendorsResponse
-
π Description
-
-
Creates one or more Vendor objects to represent suppliers to a seller.
-
π Usage
-
-
client.vendors().batchCreate( BatchCreateVendorsRequest .builder() .vendors( new HashMap<String, Vendor>() {{ put("8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", Vendor .builder() .name(Optional.of("Joe's Fresh Seafood")) .address( Optional.of( Address .builder() .addressLine1(Optional.of("505 Electric Ave")) .addressLine2(Optional.of("Suite 600")) .locality(Optional.of("New York")) .administrativeDistrictLevel1(Optional.of("NY")) .postalCode(Optional.of("10003")) .country(Optional.of(Country.US)) .build() ) ) .contacts( Optional.of( Arrays.asList( VendorContact .builder() .ordinal(1) .name("Joe Burrow") .emailAddress("joe@joesfreshseafood.com") .phoneNumber("1-212-555-4250") .build() ) ) ) .accountNumber(Optional.of("4025391")) .note(Optional.of("a vendor")) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
vendors:
Map<String, Vendor>β Specifies a set of new Vendor objects as represented by a collection of idempotency-key/Vendor-object pairs.
-
-
client.vendors.batchGet(request) -> BatchGetVendorsResponse
-
π Description
-
-
Retrieves one or more vendors of specified Vendor IDs.
-
π Usage
-
-
client.vendors().batchGet( BatchGetVendorsRequest .builder() .vendorIds( Optional.of( Arrays.asList("INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4") ) ) .build() );
-
βοΈ Parameters
-
-
vendorIds:
Optional<List<String>>β IDs of the Vendor objects to retrieve.
-
-
client.vendors.batchUpdate(request) -> BatchUpdateVendorsResponse
-
π Description
-
-
Updates one or more of existing Vendor objects as suppliers to a seller.
-
π Usage
-
-
client.vendors().batchUpdate( BatchUpdateVendorsRequest .builder() .vendors( new HashMap<String, UpdateVendorRequest>() {{ put("FMCYHBWT1TPL8MFH52PBMEN92A", UpdateVendorRequest .builder() .vendor( Vendor .builder() .build() ) .build()); put("INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", UpdateVendorRequest .builder() .vendor( Vendor .builder() .build() ) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
vendors:
Map<String, UpdateVendorRequest>A set of UpdateVendorRequest objects encapsulating to-be-updated Vendor objects. The set is represented by a collection of
Vendor-ID/UpdateVendorRequest-object pairs.
-
-
client.vendors.create(request) -> CreateVendorResponse
-
π Description
-
-
Creates a single Vendor object to represent a supplier to a seller.
-
π Usage
-
-
client.vendors().create( CreateVendorRequest .builder() .idempotencyKey("8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe") .vendor( Vendor .builder() .name("Joe's Fresh Seafood") .address( Address .builder() .addressLine1("505 Electric Ave") .addressLine2("Suite 600") .locality("New York") .administrativeDistrictLevel1("NY") .postalCode("10003") .country(Country.US) .build() ) .contacts( Optional.of( Arrays.asList( VendorContact .builder() .ordinal(1) .name("Joe Burrow") .emailAddress("joe@joesfreshseafood.com") .phoneNumber("1-212-555-4250") .build() ) ) ) .accountNumber("4025391") .note("a vendor") .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA client-supplied, universally unique identifier (UUID) to make this CreateVendor call idempotent.
See Idempotency in the API Development 101 section for more information.
-
vendor:
Optional<Vendor>β The requested Vendor to be created.
-
-
client.vendors.search(request) -> SearchVendorsResponse
-
π Description
-
-
Searches for vendors using a filter against supported Vendor properties and a supported sorter.
-
π Usage
-
-
client.vendors().search( SearchVendorsRequest .builder() .build() );
-
βοΈ Parameters
-
-
filter:
Optional<SearchVendorsRequestFilter>β Specifies a filter used to search for vendors.
-
sort:
Optional<SearchVendorsRequestSort>β Specifies a sorter used to sort the returned vendors.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query.
See the Pagination guide for more information.
-
-
client.vendors.get(vendorId) -> GetVendorResponse
-
π Description
-
-
Retrieves the vendor of a specified Vendor ID.
-
π Usage
-
-
client.vendors().get( GetVendorsRequest .builder() .vendorId("vendor_id") .build() );
-
βοΈ Parameters
-
-
vendorId:
Stringβ ID of the Vendor to retrieve.
-
-
client.vendors.update(vendorId, request) -> UpdateVendorResponse
-
π Description
-
-
Updates an existing Vendor object as a supplier to a seller.
-
π Usage
-
-
client.vendors().update( UpdateVendorsRequest .builder() .vendorId("vendor_id") .body( UpdateVendorRequest .builder() .vendor( Vendor .builder() .id("INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4") .name("Jack's Chicken Shack") .version(1) .status(VendorStatus.ACTIVE) .build() ) .idempotencyKey("8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe") .build() ) .build() );
-
βοΈ Parameters
-
-
vendorId:
Stringβ ID of the Vendor to retrieve.
-
request:
UpdateVendorRequest
-
-
Bookings CustomAttributeDefinitions
client.bookings.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
-
π Description
-
-
Get all bookings custom attribute definitions.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_READfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_READandAPPOINTMENTS_READfor the OAuth scope.
-
π Usage
-
-
client.bookings().customAttributeDefinitions().list( ListCustomAttributeDefinitionsRequest .builder() .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
-
client.bookings.customAttributeDefinitions.create(request) -> CreateBookingCustomAttributeDefinitionResponse
-
π Description
-
-
Creates a bookings custom attribute definition.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().customAttributeDefinitions().create( CreateBookingCustomAttributeDefinitionRequest .builder() .customAttributeDefinition( CustomAttributeDefinition .builder() .build() ) .build() );
-
βοΈ Parameters
-
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition to create, with the following fields:
-
key -
name. If provided,namemust be unique (case-sensitive) across all visible booking-related custom attribute definitions for the seller. -
description -
visibility. Note that all custom attributes are visible in exported booking data, including those set toVISIBILITY_HIDDEN. -
schema. With the exception of theSelectiondata type, theschemais specified as a simple URL to the JSON schema definition hosted on the Square CDN. For more information, see Specifying the schema.
-
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.bookings.customAttributeDefinitions.get(key) -> RetrieveBookingCustomAttributeDefinitionResponse
-
π Description
-
-
Retrieves a bookings custom attribute definition.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_READfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_READandAPPOINTMENTS_READfor the OAuth scope.
-
π Usage
-
-
client.bookings().customAttributeDefinitions().get( GetCustomAttributeDefinitionsRequest .builder() .key("key") .version(1) .build() );
-
βοΈ Parameters
-
-
key:
StringThe key of the custom attribute definition to retrieve. If the requesting application is not the definition owner, you must use the qualified key.
-
version:
Optional<Integer>The current version of the custom attribute definition, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a
BAD_REQUESTerror.
-
-
client.bookings.customAttributeDefinitions.update(key, request) -> UpdateBookingCustomAttributeDefinitionResponse
-
π Description
-
-
Updates a bookings custom attribute definition.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().customAttributeDefinitions().update( UpdateBookingCustomAttributeDefinitionRequest .builder() .key("key") .customAttributeDefinition( CustomAttributeDefinition .builder() .build() ) .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to update.
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition that contains the fields to update. Only the following fields can be updated:
namedescriptionvisibilityschemafor aSelectiondata type. Only changes to the named options or the maximum number of allowed selections are supported.
For more information, see Updatable definition fields.
To enable optimistic concurrency control, include the optional
versionfield and specify the current version of the custom attribute definition.
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.bookings.customAttributeDefinitions.delete(key) -> DeleteBookingCustomAttributeDefinitionResponse
-
π Description
-
-
Deletes a bookings custom attribute definition.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().customAttributeDefinitions().delete( DeleteCustomAttributeDefinitionsRequest .builder() .key("key") .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to delete.
-
-
Bookings CustomAttributes
client.bookings.customAttributes.batchDelete(request) -> BulkDeleteBookingCustomAttributesResponse
-
π Description
-
-
Bulk deletes bookings custom attributes.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().customAttributes().batchDelete( BulkDeleteBookingCustomAttributesRequest .builder() .values( new HashMap<String, BookingCustomAttributeDeleteRequest>() {{ put("key", BookingCustomAttributeDeleteRequest .builder() .bookingId("booking_id") .key("key") .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BookingCustomAttributeDeleteRequest>A map containing 1 to 25 individual Delete requests. For each request, provide an arbitrary ID that is unique for this
BulkDeleteBookingCustomAttributesrequest and the information needed to delete a custom attribute.
-
-
client.bookings.customAttributes.batchUpsert(request) -> BulkUpsertBookingCustomAttributesResponse
-
π Description
-
-
Bulk upserts bookings custom attributes.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().customAttributes().batchUpsert( BulkUpsertBookingCustomAttributesRequest .builder() .values( new HashMap<String, BookingCustomAttributeUpsertRequest>() {{ put("key", BookingCustomAttributeUpsertRequest .builder() .bookingId("booking_id") .customAttribute( CustomAttribute .builder() .build() ) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BookingCustomAttributeUpsertRequest>A map containing 1 to 25 individual upsert requests. For each request, provide an arbitrary ID that is unique for this
BulkUpsertBookingCustomAttributesrequest and the information needed to create or update a custom attribute.
-
-
client.bookings.customAttributes.list(bookingId) -> SyncPagingIterable<CustomAttribute>
-
π Description
-
-
Lists a booking's custom attributes.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_READfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_READandAPPOINTMENTS_READfor the OAuth scope.
-
π Usage
-
-
client.bookings().customAttributes().list( ListCustomAttributesRequest .builder() .bookingId("booking_id") .limit(1) .cursor("cursor") .withDefinitions(true) .build() );
-
βοΈ Parameters
-
-
bookingId:
Stringβ The ID of the target booking.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
withDefinitions:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of each custom attribute. Set this parameter totrueto get the name and description of each custom attribute, information about the data type, or other definition details. The default value isfalse.
-
-
client.bookings.customAttributes.get(bookingId, key) -> RetrieveBookingCustomAttributeResponse
-
π Description
-
-
Retrieves a bookings custom attribute.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_READfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_READandAPPOINTMENTS_READfor the OAuth scope.
-
π Usage
-
-
client.bookings().customAttributes().get( GetCustomAttributesRequest .builder() .bookingId("booking_id") .key("key") .withDefinition(true) .version(1) .build() );
-
βοΈ Parameters
-
-
bookingId:
Stringβ The ID of the target booking.
-
key:
StringThe key of the custom attribute to retrieve. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
withDefinition:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of the custom attribute. Set this parameter totrueto get the name and description of the custom attribute, information about the data type, or other definition details. The default value isfalse.
-
version:
Optional<Integer>The current version of the custom attribute, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a
BAD_REQUESTerror.
-
-
client.bookings.customAttributes.upsert(bookingId, key, request) -> UpsertBookingCustomAttributeResponse
-
π Description
-
-
Upserts a bookings custom attribute.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().customAttributes().upsert( UpsertBookingCustomAttributeRequest .builder() .bookingId("booking_id") .key("key") .customAttribute( CustomAttribute .builder() .build() ) .build() );
-
βοΈ Parameters
-
-
bookingId:
Stringβ The ID of the target booking.
-
key:
StringThe key of the custom attribute to create or update. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
customAttribute:
CustomAttributeThe custom attribute to create or update, with the following fields:
-
value. This value must conform to theschemaspecified by the definition. For more information, see Value data types. -
version. To enable optimistic concurrency control for an update operation, include this optional field and specify the current version of the custom attribute.
-
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.bookings.customAttributes.delete(bookingId, key) -> DeleteBookingCustomAttributeResponse
-
π Description
-
-
Deletes a bookings custom attribute.
To call this endpoint with buyer-level permissions, set
APPOINTMENTS_WRITEfor the OAuth scope. To call this endpoint with seller-level permissions, setAPPOINTMENTS_ALL_WRITEandAPPOINTMENTS_WRITEfor the OAuth scope.For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
-
π Usage
-
-
client.bookings().customAttributes().delete( DeleteCustomAttributesRequest .builder() .bookingId("booking_id") .key("key") .build() );
-
βοΈ Parameters
-
-
bookingId:
Stringβ The ID of the target booking.
-
key:
StringThe key of the custom attribute to delete. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
-
Bookings LocationProfiles
client.bookings.locationProfiles.list() -> SyncPagingIterable<LocationBookingProfile>
-
π Description
-
-
Lists location booking profiles of a seller.
-
π Usage
-
-
client.bookings().locationProfiles().list( ListLocationProfilesRequest .builder() .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
limit:
Optional<Integer>β The maximum number of results to return in a paged response.
-
cursor:
Optional<String>β The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results.
-
-
Bookings TeamMemberProfiles
client.bookings.teamMemberProfiles.list() -> SyncPagingIterable<TeamMemberBookingProfile>
-
π Description
-
-
Lists booking profiles for team members.
-
π Usage
-
-
client.bookings().teamMemberProfiles().list( ListTeamMemberProfilesRequest .builder() .bookableOnly(true) .limit(1) .cursor("cursor") .locationId("location_id") .build() );
-
βοΈ Parameters
-
-
bookableOnly:
Optional<Boolean>β Indicates whether to include only bookable team members in the returned result (true) or not (false).
-
limit:
Optional<Integer>β The maximum number of results to return in a paged response.
-
cursor:
Optional<String>β The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results.
-
locationId:
Optional<String>β Indicates whether to include only team members enabled at the given location in the returned result.
-
-
client.bookings.teamMemberProfiles.get(teamMemberId) -> GetTeamMemberBookingProfileResponse
-
π Description
-
-
Retrieves a team member's booking profile.
-
π Usage
-
-
client.bookings().teamMemberProfiles().get( GetTeamMemberProfilesRequest .builder() .teamMemberId("team_member_id") .build() );
-
βοΈ Parameters
-
-
teamMemberId:
Stringβ The ID of the team member to retrieve.
-
-
CashDrawers Shifts
client.cashDrawers.shifts.list() -> SyncPagingIterable<CashDrawerShiftSummary>
-
π Description
-
-
Provides the details for all of the cash drawer shifts for a location in a date range.
-
π Usage
-
-
client.cashDrawers().shifts().list( ListShiftsRequest .builder() .locationId("location_id") .sortOrder(SortOrder.DESC) .beginTime("begin_time") .endTime("end_time") .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the location to query for a list of cash drawer shifts.
-
sortOrder:
Optional<SortOrder>The order in which cash drawer shifts are listed in the response, based on their opened_at field. Default value: ASC
-
beginTime:
Optional<String>β The inclusive start time of the query on opened_at, in ISO 8601 format.
-
endTime:
Optional<String>β The exclusive end date of the query on opened_at, in ISO 8601 format.
-
limit:
Optional<Integer>Number of cash drawer shift events in a page of results (200 by default, 1000 max).
-
cursor:
Optional<String>β Opaque cursor for fetching the next page of results.
-
-
client.cashDrawers.shifts.get(shiftId) -> GetCashDrawerShiftResponse
-
π Description
-
-
Provides the summary details for a single cash drawer shift. See ListCashDrawerShiftEvents for a list of cash drawer shift events.
-
π Usage
-
-
client.cashDrawers().shifts().get( GetShiftsRequest .builder() .shiftId("shift_id") .locationId("location_id") .build() );
-
βοΈ Parameters
-
-
shiftId:
Stringβ The shift ID.
-
locationId:
Stringβ The ID of the location to retrieve cash drawer shifts from.
-
-
client.cashDrawers.shifts.listEvents(shiftId) -> SyncPagingIterable<CashDrawerShiftEvent>
-
π Description
-
-
Provides a paginated list of events for a single cash drawer shift.
-
π Usage
-
-
client.cashDrawers().shifts().listEvents( ListEventsShiftsRequest .builder() .shiftId("shift_id") .locationId("location_id") .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
shiftId:
Stringβ The shift ID.
-
locationId:
Stringβ The ID of the location to list cash drawer shifts for.
-
limit:
Optional<Integer>Number of resources to be returned in a page of results (200 by default, 1000 max).
-
cursor:
Optional<String>β Opaque cursor for fetching the next page of results.
-
-
Catalog Images
client.catalog.images.create(request) -> CreateCatalogImageResponse
-
π Description
-
-
Uploads an image file to be represented by a CatalogImage object that can be linked to an existing CatalogObject instance. The resulting
CatalogImageis unattached to anyCatalogObjectif theobject_idis not specified.This
CreateCatalogImageendpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
-
π Usage
-
-
client.catalog().images().create( CreateImagesRequest .builder() .build() );
-
-
client.catalog.images.update(imageId, request) -> UpdateCatalogImageResponse
-
π Description
-
-
Uploads a new image file to replace the existing one in the specified CatalogImage object.
This
UpdateCatalogImageendpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
-
π Usage
-
-
client.catalog().images().update( UpdateImagesRequest .builder() .imageId("image_id") .build() );
-
βοΈ Parameters
-
-
imageId:
Stringβ The ID of theCatalogImageobject to update the encapsulated image file.
-
-
Catalog Object
client.catalog.object.upsert(request) -> UpsertCatalogObjectResponse
-
π Description
-
-
Creates a new or updates the specified CatalogObject.
To ensure consistency, only one update request is processed at a time per seller account. While one (batch or non-batch) update request is being processed, other (batched and non-batched) update requests are rejected with the
429error code.
-
π Usage
-
-
client.catalog().object().upsert( UpsertCatalogObjectRequest .builder() .idempotencyKey("af3d1afc-7212-4300-b463-0bfc5314a5ae") .object( CatalogObject.item( CatalogObjectItem .builder() .id("id") .build() ) ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA value you specify that uniquely identifies this request among all your requests. A common way to create a valid idempotency key is to use a Universally unique identifier (UUID).
If you're unsure whether a particular request was successful, you can reattempt it with the same idempotency key without worrying about creating duplicate objects.
See Idempotency for more information.
-
object:
CatalogObjectA CatalogObject to be created or updated.
- For updates, the object must be active (the
is_deletedfield is nottrue). - For creates, the object ID must start with
#. The provided ID is replaced with a server-generated ID.
- For updates, the object must be active (the
-
-
client.catalog.object.get(objectId) -> GetCatalogObjectResponse
-
π Description
-
-
Returns a single CatalogItem as a CatalogObject based on the provided ID. The returned object includes all of the relevant CatalogItem information including: CatalogItemVariation children, references to its CatalogModifierList objects, and the ids of any CatalogTax objects that apply to it.
-
π Usage
-
-
client.catalog().object().get( GetObjectRequest .builder() .objectId("object_id") .includeRelatedObjects(true) .catalogVersion(1000000L) .includeCategoryPathToRoot(true) .build() );
-
βοΈ Parameters
-
-
objectId:
Stringβ The object ID of any type of catalog objects to be retrieved.
-
includeRelatedObjects:
Optional<Boolean>If
true, the response will include additional objects that are related to the requested objects. Related objects are defined as any objects referenced by ID by the results in theobjectsfield of the response. These objects are put in therelated_objectsfield. Setting this totrueis helpful when the objects are needed for immediate display to a user. This process only goes one level deep. Objects referenced by the related objects will not be included. For example,if the
objectsfield of the response contains a CatalogItem, its associated CatalogCategory objects, CatalogTax objects, CatalogImage objects and CatalogModifierLists will be returned in therelated_objectsfield of the response. If theobjectsfield of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in therelated_objectsfield of the response.Default value:
false
-
catalogVersion:
Optional<Long>Requests objects as of a specific version of the catalog. This allows you to retrieve historical versions of objects. The value to retrieve a specific version of an object can be found in the version field of CatalogObjects. If not included, results will be from the current version of the catalog.
-
includeCategoryPathToRoot:
Optional<Boolean>Specifies whether or not to include the
path_to_rootlist for each returned category instance. Thepath_to_rootlist consists ofCategoryPathToRootNodeobjects and specifies the path that starts with the immediate parent category of the returned category and ends with its root category. If the returned category is a top-level category, thepath_to_rootlist is empty and is not returned in the response payload.
-
-
client.catalog.object.delete(objectId) -> DeleteCatalogObjectResponse
-
π Description
-
-
Deletes a single CatalogObject based on the provided ID and returns the set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its CatalogItemVariation children.
To ensure consistency, only one delete request is processed at a time per seller account. While one (batch or non-batch) delete request is being processed, other (batched and non-batched) delete requests are rejected with the
429error code.
-
π Usage
-
-
client.catalog().object().delete( DeleteObjectRequest .builder() .objectId("object_id") .build() );
-
βοΈ Parameters
-
-
objectId:
StringThe ID of the catalog object to be deleted. When an object is deleted, other objects in the graph that depend on that object will be deleted as well (for example, deleting a catalog item will delete its catalog item variations).
-
-
Checkout PaymentLinks
client.checkout.paymentLinks.list() -> SyncPagingIterable<PaymentLink>
-
π Description
-
-
Lists all payment links.
-
π Usage
-
-
client.checkout().paymentLinks().list( ListPaymentLinksRequest .builder() .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. If a cursor is not provided, the endpoint returns the first page of the results. For more information, see Pagination.
-
limit:
Optional<Integer>A limit on the number of results to return per page. The limit is advisory and the implementation might return more or less results. If the supplied limit is negative, zero, or greater than the maximum limit of 1000, it is ignored.
Default value:
100
-
-
client.checkout.paymentLinks.create(request) -> CreatePaymentLinkResponse
-
π Description
-
-
Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services.
-
π Usage
-
-
client.checkout().paymentLinks().create( CreatePaymentLinkRequest .builder() .idempotencyKey("cd9e25dc-d9f2-4430-aedb-61605070e95f") .quickPay( QuickPay .builder() .name("Auto Detailing") .priceMoney( Money .builder() .amount(10000L) .currency(Currency.USD) .build() ) .locationId("A9Y43N9ABXZBP") .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>A unique string that identifies this
CreatePaymentLinkRequestrequest. If you do not provide a unique string (or provide an empty string as the value), the endpoint treats each request as independent.For more information, see Idempotency.
-
description:
Optional<String>A description of the payment link. You provide this optional description that is useful in your application context. It is not used anywhere.
-
quickPay:
Optional<QuickPay>Describes an ad hoc item and price for which to generate a quick pay checkout link. For more information, see Quick Pay Checkout.
-
order:
Optional<Order>Describes the
Orderfor which to create a checkout link. For more information, see Square Order Checkout.
-
checkoutOptions:
Optional<CheckoutOptions>Describes optional fields to add to the resulting checkout page. For more information, see Optional Checkout Configurations.
-
prePopulatedData:
Optional<PrePopulatedData>Describes fields to prepopulate in the resulting checkout page. For more information, see Prepopulate the shipping address.
-
paymentNote:
Optional<String>β A note for the payment. After processing the payment, Square adds this note to the resultingPayment.
-
-
client.checkout.paymentLinks.get(id) -> GetPaymentLinkResponse
-
π Description
-
-
Retrieves a payment link.
-
π Usage
-
-
client.checkout().paymentLinks().get( GetPaymentLinksRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of link to retrieve.
-
-
client.checkout.paymentLinks.update(id, request) -> UpdatePaymentLinkResponse
-
π Description
-
-
Updates a payment link. You can update the
payment_linkfields such asdescription,checkout_options, andpre_populated_data. You cannot update other fields such as theorder_id,version,URL, ortimestampfield.
-
π Usage
-
-
client.checkout().paymentLinks().update( UpdatePaymentLinkRequest .builder() .id("id") .paymentLink( PaymentLink .builder() .version(1) .checkoutOptions( CheckoutOptions .builder() .askForShippingAddress(true) .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of the payment link to update.
-
paymentLink:
PaymentLinkThe
payment_linkobject describing the updates to apply. For more information, see Update a payment link.
-
-
client.checkout.paymentLinks.delete(id) -> DeletePaymentLinkResponse
-
π Description
-
-
Deletes a payment link.
-
π Usage
-
-
client.checkout().paymentLinks().delete( DeletePaymentLinksRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of the payment link to delete.
-
-
Customers CustomAttributeDefinitions
client.customers.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
-
π Description
-
-
Lists the customer-related custom attribute definitions that belong to a Square seller account.
When all response pages are retrieved, the results include all custom attribute definitions that are visible to the requesting application, including those that are created by other applications and set to
VISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.customers().customAttributeDefinitions().list( ListCustomAttributeDefinitionsRequest .builder() .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
-
client.customers.customAttributeDefinitions.create(request) -> CreateCustomerCustomAttributeDefinitionResponse
-
π Description
-
-
Creates a customer-related custom attribute definition for a Square seller account. Use this endpoint to define a custom attribute that can be associated with customer profiles.
A custom attribute definition specifies the
key,visibility,schema, and other properties for a custom attribute. After the definition is created, you can call UpsertCustomerCustomAttribute or BulkUpsertCustomerCustomAttributes to set the custom attribute for customer profiles in the seller's Customer Directory.Sellers can view all custom attributes in exported customer data, including those set to
VISIBILITY_HIDDEN.
-
π Usage
-
-
client.customers().customAttributeDefinitions().create( CreateCustomerCustomAttributeDefinitionRequest .builder() .customAttributeDefinition( CustomAttributeDefinition .builder() .key("favoritemovie") .schema( new HashMap<String, Object>() {{ put("$ref", "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"); }} ) .name("Favorite Movie") .description("The favorite movie of the customer.") .visibility(CustomAttributeDefinitionVisibility.VISIBILITY_HIDDEN) .build() ) .build() );
-
βοΈ Parameters
-
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition to create. Note the following:
- With the exception of the
Selectiondata type, theschemais specified as a simple URL to the JSON schema definition hosted on the Square CDN. For more information, including supported values and constraints, see Specifying the schema. - If provided,
namemust be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. - All custom attributes are visible in exported customer data, including those set to
VISIBILITY_HIDDEN.
- With the exception of the
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.customers.customAttributeDefinitions.get(key) -> GetCustomerCustomAttributeDefinitionResponse
-
π Description
-
-
Retrieves a customer-related custom attribute definition from a Square seller account.
To retrieve a custom attribute definition created by another application, the
visibilitysetting must beVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.customers().customAttributeDefinitions().get( GetCustomAttributeDefinitionsRequest .builder() .key("key") .version(1) .build() );
-
βοΈ Parameters
-
-
key:
StringThe key of the custom attribute definition to retrieve. If the requesting application is not the definition owner, you must use the qualified key.
-
version:
Optional<Integer>The current version of the custom attribute definition, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a
BAD_REQUESTerror.
-
-
client.customers.customAttributeDefinitions.update(key, request) -> UpdateCustomerCustomAttributeDefinitionResponse
-
π Description
-
-
Updates a customer-related custom attribute definition for a Square seller account.
Use this endpoint to update the following fields:
name,description,visibility, or theschemafor aSelectiondata type.Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to
VISIBILITY_HIDDEN.
-
π Usage
-
-
client.customers().customAttributeDefinitions().update( UpdateCustomerCustomAttributeDefinitionRequest .builder() .key("key") .customAttributeDefinition( CustomAttributeDefinition .builder() .description("Update the description as desired.") .visibility(CustomAttributeDefinitionVisibility.VISIBILITY_READ_ONLY) .build() ) .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to update.
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition that contains the fields to update. This endpoint supports sparse updates, so only new or changed fields need to be included in the request. Only the following fields can be updated:
namedescriptionvisibilityschemafor aSelectiondata type. Only changes to the named options or the maximum number of allowed selections are supported.
For more information, see Updatable definition fields.
To enable optimistic concurrency control, include the optional
versionfield and specify the current version of the custom attribute definition.
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.customers.customAttributeDefinitions.delete(key) -> DeleteCustomerCustomAttributeDefinitionResponse
-
π Description
-
-
Deletes a customer-related custom attribute definition from a Square seller account.
Deleting a custom attribute definition also deletes the corresponding custom attribute from all customer profiles in the seller's Customer Directory.
Only the definition owner can delete a custom attribute definition.
-
π Usage
-
-
client.customers().customAttributeDefinitions().delete( DeleteCustomAttributeDefinitionsRequest .builder() .key("key") .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to delete.
-
-
client.customers.customAttributeDefinitions.batchUpsert(request) -> BatchUpsertCustomerCustomAttributesResponse
-
π Description
-
-
Creates or updates custom attributes for customer profiles as a bulk operation.
Use this endpoint to set the value of one or more custom attributes for one or more customer profiles. A custom attribute is based on a custom attribute definition in a Square seller account, which is created using the CreateCustomerCustomAttributeDefinition endpoint.
This
BulkUpsertCustomerCustomAttributesendpoint accepts a map of 1 to 25 individual upsert requests and returns a map of individual upsert responses. Each upsert request has a unique ID and provides a customer ID and custom attribute. Each upsert response is returned with the ID of the corresponding request.To create or update a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.customers().customAttributeDefinitions().batchUpsert( BatchUpsertCustomerCustomAttributesRequest .builder() .values( new HashMap<String, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest>() {{ put("id1", BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest .builder() .customerId("N3NCVYY3WS27HF0HKANA3R9FP8") .customAttribute( CustomAttribute .builder() .key(Optional.of("favoritemovie")) .value(Optional.of("Dune")) .build() ) .build()); put("id2", BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest .builder() .customerId("SY8EMWRNDN3TQDP2H4KS1QWMMM") .customAttribute( CustomAttribute .builder() .key(Optional.of("ownsmovie")) .value(Optional.of(false)) .build() ) .build()); put("id3", BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest .builder() .customerId("SY8EMWRNDN3TQDP2H4KS1QWMMM") .customAttribute( CustomAttribute .builder() .key(Optional.of("favoritemovie")) .value(Optional.of("Star Wars")) .build() ) .build()); put("id4", BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest .builder() .customerId("N3NCVYY3WS27HF0HKANA3R9FP8") .customAttribute( CustomAttribute .builder() .key(Optional.of("square:a0f1505a-2aa1-490d-91a8-8d31ff181808")) .value(Optional.of("10.5")) .build() ) .build()); put("id5", BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest .builder() .customerId("70548QG1HN43B05G0KCZ4MMC1G") .customAttribute( CustomAttribute .builder() .key(Optional.of("sq0ids-0evKIskIGaY45fCyNL66aw:backupemail")) .value(Optional.of("fake-email@squareup.com")) .build() ) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest>A map containing 1 to 25 individual upsert requests. For each request, provide an arbitrary ID that is unique for this
BulkUpsertCustomerCustomAttributesrequest and the information needed to create or update a custom attribute.
-
-
Customers Groups
client.customers.groups.list() -> SyncPagingIterable<CustomerGroup>
-
π Description
-
-
Retrieves the list of customer groups of a business.
-
π Usage
-
-
client.customers().groups().list( ListGroupsRequest .builder() .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for your original query.
For more information, see Pagination.
-
limit:
Optional<Integer>The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. If the limit is less than 1 or greater than 50, Square returns a
400 VALUE_TOO_LOWor400 VALUE_TOO_HIGHerror. The default value is 50.For more information, see Pagination.
-
-
client.customers.groups.create(request) -> CreateCustomerGroupResponse
-
π Description
-
-
Creates a new customer group for a business.
The request must include the
namevalue of the group.
-
π Usage
-
-
client.customers().groups().create( CreateCustomerGroupRequest .builder() .group( CustomerGroup .builder() .name("Loyal Customers") .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>β The idempotency key for the request. For more information, see Idempotency.
-
group:
CustomerGroupβ The customer group to create.
-
-
client.customers.groups.get(groupId) -> GetCustomerGroupResponse
-
π Description
-
-
Retrieves a specific customer group as identified by the
group_idvalue.
-
π Usage
-
-
client.customers().groups().get( GetGroupsRequest .builder() .groupId("group_id") .build() );
-
βοΈ Parameters
-
-
groupId:
Stringβ The ID of the customer group to retrieve.
-
-
client.customers.groups.update(groupId, request) -> UpdateCustomerGroupResponse
-
π Description
-
-
Updates a customer group as identified by the
group_idvalue.
-
π Usage
-
-
client.customers().groups().update( UpdateCustomerGroupRequest .builder() .groupId("group_id") .group( CustomerGroup .builder() .name("Loyal Customers") .build() ) .build() );
-
βοΈ Parameters
-
-
groupId:
Stringβ The ID of the customer group to update.
-
group:
CustomerGroupβ TheCustomerGroupobject including all the updates you want to make.
-
-
client.customers.groups.delete(groupId) -> DeleteCustomerGroupResponse
-
π Description
-
-
Deletes a customer group as identified by the
group_idvalue.
-
π Usage
-
-
client.customers().groups().delete( DeleteGroupsRequest .builder() .groupId("group_id") .build() );
-
βοΈ Parameters
-
-
groupId:
Stringβ The ID of the customer group to delete.
-
-
client.customers.groups.add(customerId, groupId) -> AddGroupToCustomerResponse
-
π Description
-
-
Adds a group membership to a customer.
The customer is identified by the
customer_idvalue and the customer group is identified by thegroup_idvalue.
-
π Usage
-
-
client.customers().groups().add( AddGroupsRequest .builder() .customerId("customer_id") .groupId("group_id") .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the customer to add to a group.
-
groupId:
Stringβ The ID of the customer group to add the customer to.
-
-
client.customers.groups.remove(customerId, groupId) -> RemoveGroupFromCustomerResponse
-
π Description
-
-
Removes a group membership from a customer.
The customer is identified by the
customer_idvalue and the customer group is identified by thegroup_idvalue.
-
π Usage
-
-
client.customers().groups().remove( RemoveGroupsRequest .builder() .customerId("customer_id") .groupId("group_id") .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the customer to remove from the group.
-
groupId:
Stringβ The ID of the customer group to remove the customer from.
-
-
Customers Segments
client.customers.segments.list() -> SyncPagingIterable<CustomerSegment>
-
π Description
-
-
Retrieves the list of customer segments of a business.
-
π Usage
-
-
client.customers().segments().list( ListSegmentsRequest .builder() .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by previous calls to
ListCustomerSegments. This cursor is used to retrieve the next set of query results.For more information, see Pagination.
-
limit:
Optional<Integer>The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. If the specified limit is less than 1 or greater than 50, Square returns a
400 VALUE_TOO_LOWor400 VALUE_TOO_HIGHerror. The default value is 50.For more information, see Pagination.
-
-
client.customers.segments.get(segmentId) -> GetCustomerSegmentResponse
-
π Description
-
-
Retrieves a specific customer segment as identified by the
segment_idvalue.
-
π Usage
-
-
client.customers().segments().get( GetSegmentsRequest .builder() .segmentId("segment_id") .build() );
-
βοΈ Parameters
-
-
segmentId:
Stringβ The Square-issued ID of the customer segment.
-
-
Customers Cards
client.customers.cards.create(customerId, request) -> CreateCustomerCardResponse
-
π Description
-
-
Adds a card on file to an existing customer.
As with charges, calls to
CreateCustomerCardare idempotent. Multiple calls with the same card nonce return the same card record that was created with the provided nonce during the first call.
-
π Usage
-
-
client.customers().cards().create( CreateCustomerCardRequest .builder() .customerId("customer_id") .cardNonce("YOUR_CARD_NONCE") .billingAddress( Address .builder() .addressLine1("500 Electric Ave") .addressLine2("Suite 600") .locality("New York") .administrativeDistrictLevel1("NY") .postalCode("10003") .country(Country.US) .build() ) .cardholderName("Amelia Earhart") .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The Square ID of the customer profile the card is linked to.
-
cardNonce:
StringA card nonce representing the credit card to link to the customer.
Card nonces are generated by the Square payment form when customers enter their card information. For more information, see Walkthrough: Integrate Square Payments in a Website.
NOTE: Card nonces generated by digital wallets (such as Apple Pay) cannot be used to create a customer card.
-
billingAddress:
Optional<Address>Address information for the card on file.
NOTE: If a billing address is provided in the request, the
CreateCustomerCardRequest.billing_address.postal_codemust match the postal code encoded in the card nonce.
-
cardholderName:
Optional<String>β The full name printed on the credit card.
-
verificationToken:
Optional<String>An identifying token generated by Payments.verifyBuyer(). Verification tokens encapsulate customer device information and 3-D Secure challenge results to indicate that Square has verified the buyer identity.
-
-
client.customers.cards.delete(customerId, cardId) -> DeleteCustomerCardResponse
-
π Description
-
-
Removes a card on file from a customer.
-
π Usage
-
-
client.customers().cards().delete( DeleteCardsRequest .builder() .customerId("customer_id") .cardId("card_id") .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the customer that the card on file belongs to.
-
cardId:
Stringβ The ID of the card on file to delete.
-
-
Customers CustomAttributes
client.customers.customAttributes.list(customerId) -> SyncPagingIterable<CustomAttribute>
-
π Description
-
-
Lists the custom attributes associated with a customer profile.
You can use the
with_definitionsquery parameter to also retrieve custom attribute definitions in the same call.When all response pages are retrieved, the results include all custom attributes that are visible to the requesting application, including those that are owned by other applications and set to
VISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.customers().customAttributes().list( ListCustomAttributesRequest .builder() .customerId("customer_id") .limit(1) .cursor("cursor") .withDefinitions(true) .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the target customer profile.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
withDefinitions:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of each custom attribute. Set this parameter totrueto get the name and description of each custom attribute, information about the data type, or other definition details. The default value isfalse.
-
-
client.customers.customAttributes.get(customerId, key) -> GetCustomerCustomAttributeResponse
-
π Description
-
-
Retrieves a custom attribute associated with a customer profile.
You can use the
with_definitionquery parameter to also retrieve the custom attribute definition in the same call.To retrieve a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.customers().customAttributes().get( GetCustomAttributesRequest .builder() .customerId("customer_id") .key("key") .withDefinition(true) .version(1) .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the target customer profile.
-
key:
StringThe key of the custom attribute to retrieve. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
withDefinition:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of the custom attribute. Set this parameter totrueto get the name and description of the custom attribute, information about the data type, or other definition details. The default value isfalse.
-
version:
Optional<Integer>The current version of the custom attribute, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a
BAD_REQUESTerror.
-
-
client.customers.customAttributes.upsert(customerId, key, request) -> UpsertCustomerCustomAttributeResponse
-
π Description
-
-
Creates or updates a custom attribute for a customer profile.
Use this endpoint to set the value of a custom attribute for a specified customer profile. A custom attribute is based on a custom attribute definition in a Square seller account, which is created using the CreateCustomerCustomAttributeDefinition endpoint.
To create or update a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.customers().customAttributes().upsert( UpsertCustomerCustomAttributeRequest .builder() .customerId("customer_id") .key("key") .customAttribute( CustomAttribute .builder() .value("Dune") .build() ) .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the target customer profile.
-
key:
StringThe key of the custom attribute to create or update. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
customAttribute:
CustomAttributeThe custom attribute to create or update, with the following fields:
-
value. This value must conform to theschemaspecified by the definition. For more information, see Value data types. -
version. To enable optimistic concurrency control for an update operation, include this optional field and specify the current version of the custom attribute.
-
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.customers.customAttributes.delete(customerId, key) -> DeleteCustomerCustomAttributeResponse
-
π Description
-
-
Deletes a custom attribute associated with a customer profile.
To delete a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.customers().customAttributes().delete( DeleteCustomAttributesRequest .builder() .customerId("customer_id") .key("key") .build() );
-
βοΈ Parameters
-
-
customerId:
Stringβ The ID of the target customer profile.
-
key:
StringThe key of the custom attribute to delete. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
-
Devices Codes
client.devices.codes.list() -> SyncPagingIterable<DeviceCode>
-
π Description
-
-
Lists all DeviceCodes associated with the merchant.
-
π Usage
-
-
client.devices().codes().list( ListCodesRequest .builder() .cursor("cursor") .locationId("location_id") .productType("TERMINAL_API") .status(DeviceCodeStatus.UNKNOWN) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query.
See Paginating results for more information.
-
locationId:
Optional<String>If specified, only returns DeviceCodes of the specified location. Returns DeviceCodes of all locations if empty.
-
productType:
Optional<String>If specified, only returns DeviceCodes targeting the specified product type. Returns DeviceCodes of all product types if empty.
-
status:
Optional<DeviceCodeStatus>If specified, returns DeviceCodes with the specified statuses. Returns DeviceCodes of status
PAIREDandUNPAIREDif empty.
-
-
client.devices.codes.create(request) -> CreateDeviceCodeResponse
-
π Description
-
-
Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected terminal mode.
-
π Usage
-
-
client.devices().codes().create( CreateDeviceCodeRequest .builder() .idempotencyKey("01bb00a6-0c86-4770-94ed-f5fca973cd56") .deviceCode( DeviceCode .builder() .productType("TERMINAL_API") .name("Counter 1") .locationId("B5E4484SHHNYH") .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA unique string that identifies this CreateDeviceCode request. Keys can be any valid string but must be unique for every CreateDeviceCode request.
See Idempotency keys for more information.
-
deviceCode:
DeviceCodeβ The device code to create.
-
-
client.devices.codes.get(id) -> GetDeviceCodeResponse
-
π Description
-
-
Retrieves DeviceCode with the associated ID.
-
π Usage
-
-
client.devices().codes().get( GetCodesRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The unique identifier for the device code.
-
-
Disputes Evidence
client.disputes.evidence.list(disputeId) -> SyncPagingIterable<DisputeEvidence>
-
π Description
-
-
Returns a list of evidence associated with a dispute.
-
π Usage
-
-
client.disputes().evidence().list( ListEvidenceRequest .builder() .disputeId("dispute_id") .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
disputeId:
Stringβ The ID of the dispute.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. For more information, see Pagination.
-
-
client.disputes.evidence.get(disputeId, evidenceId) -> GetDisputeEvidenceResponse
-
π Description
-
-
Returns the metadata for the evidence specified in the request URL path.
You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it.
-
π Usage
-
-
client.disputes().evidence().get( GetEvidenceRequest .builder() .disputeId("dispute_id") .evidenceId("evidence_id") .build() );
-
βοΈ Parameters
-
-
disputeId:
Stringβ The ID of the dispute from which you want to retrieve evidence metadata.
-
evidenceId:
Stringβ The ID of the evidence to retrieve.
-
-
client.disputes.evidence.delete(disputeId, evidenceId) -> DeleteDisputeEvidenceResponse
-
π Description
-
-
Removes specified evidence from a dispute. Square does not send the bank any evidence that is removed.
-
π Usage
-
-
client.disputes().evidence().delete( DeleteEvidenceRequest .builder() .disputeId("dispute_id") .evidenceId("evidence_id") .build() );
-
βοΈ Parameters
-
-
disputeId:
Stringβ The ID of the dispute from which you want to remove evidence.
-
evidenceId:
Stringβ The ID of the evidence you want to remove.
-
-
GiftCards Activities
client.giftCards.activities.list() -> SyncPagingIterable<GiftCardActivity>
-
π Description
-
-
Lists gift card activities. By default, you get gift card activities for all gift cards in the seller's account. You can optionally specify query parameters to filter the list. For example, you can get a list of gift card activities for a gift card, for all gift cards in a specific region, or for activities within a time window.
-
π Usage
-
-
client.giftCards().activities().list( ListActivitiesRequest .builder() .giftCardId("gift_card_id") .type("type") .locationId("location_id") .beginTime("begin_time") .endTime("end_time") .limit(1) .cursor("cursor") .sortOrder("sort_order") .build() );
-
βοΈ Parameters
-
-
giftCardId:
Optional<String>If a gift card ID is provided, the endpoint returns activities related to the specified gift card. Otherwise, the endpoint returns all gift card activities for the seller.
-
type:
Optional<String>If a type is provided, the endpoint returns gift card activities of the specified type. Otherwise, the endpoint returns all types of gift card activities.
-
locationId:
Optional<String>If a location ID is provided, the endpoint returns gift card activities for the specified location. Otherwise, the endpoint returns gift card activities for all locations.
-
beginTime:
Optional<String>The timestamp for the beginning of the reporting period, in RFC 3339 format. This start time is inclusive. The default value is the current time minus one year.
-
endTime:
Optional<String>The timestamp for the end of the reporting period, in RFC 3339 format. This end time is inclusive. The default value is the current time.
-
limit:
Optional<Integer>If a limit is provided, the endpoint returns the specified number of results (or fewer) per page. The maximum value is 100. The default value is 50. For more information, see Pagination.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. If a cursor is not provided, the endpoint returns the first page of the results. For more information, see Pagination.
-
sortOrder:
Optional<String>The order in which the endpoint returns the activities, based on
created_at.ASC- Oldest to newest.DESC- Newest to oldest (default).
-
-
client.giftCards.activities.create(request) -> CreateGiftCardActivityResponse
-
π Description
-
-
Creates a gift card activity to manage the balance or state of a gift card. For example, create an
ACTIVATEactivity to activate a gift card with an initial balance before first use.
-
π Usage
-
-
client.giftCards().activities().create( CreateGiftCardActivityRequest .builder() .idempotencyKey("U16kfr-kA70er-q4Rsym-7U7NnY") .giftCardActivity( GiftCardActivity .builder() .type(GiftCardActivityType.ACTIVATE) .locationId("81FN9BNFZTKS4") .giftCardId("gftc:6d55a72470d940c6ba09c0ab8ad08d20") .activateActivityDetails( GiftCardActivityActivate .builder() .orderId("jJNGHm4gLI6XkFbwtiSLqK72KkAZY") .lineItemUid("eIWl7X0nMuO9Ewbh0ChIx") .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Stringβ A unique string that identifies theCreateGiftCardActivityrequest.
-
giftCardActivity:
GiftCardActivityThe activity to create for the gift card. This activity must specify
gift_card_idorgift_card_ganfor the target gift card, thelocation_idwhere the activity occurred, and the activitytypealong with the corresponding activity details.
-
-
Labor BreakTypes
client.labor.breakTypes.list() -> SyncPagingIterable<BreakType>
-
π Description
-
-
Returns a paginated list of
BreakTypeinstances for a business.
-
π Usage
-
-
client.labor().breakTypes().list( ListBreakTypesRequest .builder() .locationId("location_id") .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
locationId:
Optional<String>Filter the returned
BreakTyperesults to only those that are associated with the specified location.
-
limit:
Optional<Integer>The maximum number of
BreakTyperesults to return per page. The number can range between 1 and 200. The default is 200.
-
cursor:
Optional<String>β A pointer to the next page ofBreakTyperesults to fetch.
-
-
client.labor.breakTypes.create(request) -> CreateBreakTypeResponse
-
π Description
-
-
Creates a new
BreakType.A
BreakTypeis a template for creatingBreakobjects. You must provide the following values in your request to this endpoint:location_idbreak_nameexpected_durationis_paid
You can only have three
BreakTypeinstances per location. If you attempt to add a fourthBreakTypefor a location, anINVALID_REQUEST_ERROR"Exceeded limit of 3 breaks per location." is returned.
-
π Usage
-
-
client.labor().breakTypes().create( CreateBreakTypeRequest .builder() .breakType( BreakType .builder() .locationId("CGJN03P1D08GF") .breakName("Lunch Break") .expectedDuration("PT30M") .isPaid(true) .build() ) .idempotencyKey("PAD3NG5KSN2GL") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>β A unique string value to ensure the idempotency of the operation.
-
breakType:
BreakTypeβ TheBreakTypeto be created.
-
-
client.labor.breakTypes.get(id) -> GetBreakTypeResponse
-
π Description
-
-
Returns a single
BreakTypespecified byid.
-
π Usage
-
-
client.labor().breakTypes().get( GetBreakTypesRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theBreakTypebeing retrieved.
-
-
client.labor.breakTypes.update(id, request) -> UpdateBreakTypeResponse
-
π Description
-
-
Updates an existing
BreakType.
-
π Usage
-
-
client.labor().breakTypes().update( UpdateBreakTypeRequest .builder() .id("id") .breakType( BreakType .builder() .locationId("26M7H24AZ9N6R") .breakName("Lunch") .expectedDuration("PT50M") .isPaid(true) .version(1) .build() ) .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theBreakTypebeing updated.
-
breakType:
BreakTypeβ The updatedBreakType.
-
-
client.labor.breakTypes.delete(id) -> DeleteBreakTypeResponse
-
π Description
-
-
Deletes an existing
BreakType.A
BreakTypecan be deleted even if it is referenced from aShift.
-
π Usage
-
-
client.labor().breakTypes().delete( DeleteBreakTypesRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theBreakTypebeing deleted.
-
-
Labor EmployeeWages
client.labor.employeeWages.list() -> SyncPagingIterable<EmployeeWage>
-
π Description
-
-
Returns a paginated list of
EmployeeWageinstances for a business.
-
π Usage
-
-
client.labor().employeeWages().list( ListEmployeeWagesRequest .builder() .employeeId("employee_id") .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
employeeId:
Optional<String>β Filter the returned wages to only those that are associated with the specified employee.
-
limit:
Optional<Integer>The maximum number of
EmployeeWageresults to return per page. The number can range between 1 and 200. The default is 200.
-
cursor:
Optional<String>β A pointer to the next page ofEmployeeWageresults to fetch.
-
-
client.labor.employeeWages.get(id) -> GetEmployeeWageResponse
-
π Description
-
-
Returns a single
EmployeeWagespecified byid.
-
π Usage
-
-
client.labor().employeeWages().get( GetEmployeeWagesRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theEmployeeWagebeing retrieved.
-
-
Labor Shifts
client.labor.shifts.create(request) -> CreateShiftResponse
-
π Description
-
-
Creates a new
Shift.A
Shiftrepresents a complete workday for a single team member. You must provide the following values in your request to this endpoint:location_idteam_member_idstart_at
An attempt to create a new
Shiftcan result in aBAD_REQUESTerror when:- The
statusof the newShiftisOPENand the team member has another shift with anOPENstatus. - The
start_atdate is in the future. - The
start_atorend_atdate overlaps another shift for the same team member. - The
Breakinstances are set in the request and a breakstart_atis before theShift.start_at, a breakend_atis after theShift.end_at, or both.
-
π Usage
-
-
client.labor().shifts().create( CreateShiftRequest .builder() .shift( Shift .builder() .locationId("PAA1RJZZKXBFG") .startAt("2019-01-25T03:11:00-05:00") .endAt("2019-01-25T13:11:00-05:00") .wage( ShiftWage .builder() .title("Barista") .hourlyRate( Money .builder() .amount(1100L) .currency(Currency.USD) .build() ) .tipEligible(true) .build() ) .breaks( Optional.of( Arrays.asList( Break .builder() .startAt("2019-01-25T06:11:00-05:00") .breakTypeId("REGS1EQR1TPZ5") .name("Tea Break") .expectedDuration("PT5M") .isPaid(true) .endAt("2019-01-25T06:16:00-05:00") .build() ) ) ) .teamMemberId("ormj0jJJZ5OZIzxrZYJI") .declaredCashTipMoney( Money .builder() .amount(500L) .currency(Currency.USD) .build() ) .build() ) .idempotencyKey("HIDSNG5KS478L") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>β A unique string value to ensure the idempotency of the operation.
-
shift:
Shiftβ TheShiftto be created.
-
-
client.labor.shifts.search(request) -> SearchShiftsResponse
-
π Description
-
-
Returns a paginated list of
Shiftrecords for a business. The list to be returned can be filtered by:- Location IDs
- Team member IDs
- Shift status (
OPENorCLOSED) - Shift start
- Shift end
- Workday details
The list can be sorted by:
START_ATEND_ATCREATED_ATUPDATED_AT
-
π Usage
-
-
client.labor().shifts().search( SearchShiftsRequest .builder() .query( ShiftQuery .builder() .filter( ShiftFilter .builder() .workday( ShiftWorkday .builder() .dateRange( DateRange .builder() .startDate("2019-01-20") .endDate("2019-02-03") .build() ) .matchShiftsBy(ShiftWorkdayMatcher.START_AT) .defaultTimezone("America/Los_Angeles") .build() ) .build() ) .build() ) .limit(100) .build() );
-
βοΈ Parameters
-
-
query:
Optional<ShiftQuery>β Query filters.
-
limit:
Optional<Integer>β The number of resources in a page (200 by default).
-
cursor:
Optional<String>β An opaque cursor for fetching the next page.
-
-
client.labor.shifts.get(id) -> GetShiftResponse
-
π Description
-
-
Returns a single
Shiftspecified byid.
-
π Usage
-
-
client.labor().shifts().get( GetShiftsRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theShiftbeing retrieved.
-
-
client.labor.shifts.update(id, request) -> UpdateShiftResponse
-
π Description
-
-
Updates an existing
Shift.When adding a
Breakto aShift, any earlierBreakinstances in theShifthave theend_atproperty set to a valid RFC-3339 datetime string.When closing a
Shift, allBreakinstances in theShiftmust be complete withend_atset on eachBreak.
-
π Usage
-
-
client.labor().shifts().update( UpdateShiftRequest .builder() .id("id") .shift( Shift .builder() .locationId("PAA1RJZZKXBFG") .startAt("2019-01-25T03:11:00-05:00") .endAt("2019-01-25T13:11:00-05:00") .wage( ShiftWage .builder() .title("Bartender") .hourlyRate( Money .builder() .amount(1500L) .currency(Currency.USD) .build() ) .tipEligible(true) .build() ) .breaks( Optional.of( Arrays.asList( Break .builder() .startAt("2019-01-25T06:11:00-05:00") .breakTypeId("REGS1EQR1TPZ5") .name("Tea Break") .expectedDuration("PT5M") .isPaid(true) .id("X7GAQYVVRRG6P") .endAt("2019-01-25T06:16:00-05:00") .build() ) ) ) .version(1) .teamMemberId("ormj0jJJZ5OZIzxrZYJI") .declaredCashTipMoney( Money .builder() .amount(500L) .currency(Currency.USD) .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The ID of the object being updated.
-
shift:
Shiftβ The updatedShiftobject.
-
-
client.labor.shifts.delete(id) -> DeleteShiftResponse
-
π Description
-
-
Deletes a
Shift.
-
π Usage
-
-
client.labor().shifts().delete( DeleteShiftsRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theShiftbeing deleted.
-
-
Labor TeamMemberWages
client.labor.teamMemberWages.list() -> SyncPagingIterable<TeamMemberWage>
-
π Description
-
-
Returns a paginated list of
TeamMemberWageinstances for a business.
-
π Usage
-
-
client.labor().teamMemberWages().list( ListTeamMemberWagesRequest .builder() .teamMemberId("team_member_id") .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
teamMemberId:
Optional<String>Filter the returned wages to only those that are associated with the specified team member.
-
limit:
Optional<Integer>The maximum number of
TeamMemberWageresults to return per page. The number can range between 1 and 200. The default is 200.
-
cursor:
Optional<String>β A pointer to the next page ofEmployeeWageresults to fetch.
-
-
client.labor.teamMemberWages.get(id) -> GetTeamMemberWageResponse
-
π Description
-
-
Returns a single
TeamMemberWagespecified byid.
-
π Usage
-
-
client.labor().teamMemberWages().get( GetTeamMemberWagesRequest .builder() .id("id") .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theTeamMemberWagebeing retrieved.
-
-
Labor WorkweekConfigs
client.labor.workweekConfigs.list() -> SyncPagingIterable<WorkweekConfig>
-
π Description
-
-
Returns a list of
WorkweekConfiginstances for a business.
-
π Usage
-
-
client.labor().workweekConfigs().list( ListWorkweekConfigsRequest .builder() .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
limit:
Optional<Integer>β The maximum number ofWorkweekConfigsresults to return per page.
-
cursor:
Optional<String>β A pointer to the next page ofWorkweekConfigresults to fetch.
-
-
client.labor.workweekConfigs.get(id, request) -> UpdateWorkweekConfigResponse
-
π Description
-
-
Updates a
WorkweekConfig.
-
π Usage
-
-
client.labor().workweekConfigs().get( UpdateWorkweekConfigRequest .builder() .id("id") .workweekConfig( WorkweekConfig .builder() .startOfWeek(Weekday.MON) .startOfDayLocalTime("10:00") .version(10) .build() ) .build() );
-
βοΈ Parameters
-
-
id:
Stringβ The UUID for theWorkweekConfigobject being updated.
-
workweekConfig:
WorkweekConfigβ The updatedWorkweekConfigobject.
-
-
Locations CustomAttributeDefinitions
client.locations.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
-
π Description
-
-
Lists the location-related custom attribute definitions that belong to a Square seller account. When all response pages are retrieved, the results include all custom attribute definitions that are visible to the requesting application, including those that are created by other applications and set to
VISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.locations().customAttributeDefinitions().list( ListCustomAttributeDefinitionsRequest .builder() .visibilityFilter(VisibilityFilter.ALL) .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
visibilityFilter:
Optional<VisibilityFilter>β Filters theCustomAttributeDefinitionresults by theirvisibilityvalues.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
-
client.locations.customAttributeDefinitions.create(request) -> CreateLocationCustomAttributeDefinitionResponse
-
π Description
-
-
Creates a location-related custom attribute definition for a Square seller account. Use this endpoint to define a custom attribute that can be associated with locations. A custom attribute definition specifies the
key,visibility,schema, and other properties for a custom attribute. After the definition is created, you can call UpsertLocationCustomAttribute or BulkUpsertLocationCustomAttributes to set the custom attribute for locations.
-
π Usage
-
-
client.locations().customAttributeDefinitions().create( CreateLocationCustomAttributeDefinitionRequest .builder() .customAttributeDefinition( CustomAttributeDefinition .builder() .key("bestseller") .schema( new HashMap<String, Object>() {{ put("$ref", "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"); }} ) .name("Bestseller") .description("Bestselling item at location") .visibility(CustomAttributeDefinitionVisibility.VISIBILITY_READ_WRITE_VALUES) .build() ) .build() );
-
βοΈ Parameters
-
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition to create. Note the following:
- With the exception of the
Selectiondata type, theschemais specified as a simple URL to the JSON schema definition hosted on the Square CDN. For more information, including supported values and constraints, see Supported data types. nameis required unlessvisibilityis set toVISIBILITY_HIDDEN.
- With the exception of the
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.locations.customAttributeDefinitions.get(key) -> RetrieveLocationCustomAttributeDefinitionResponse
-
π Description
-
-
Retrieves a location-related custom attribute definition from a Square seller account. To retrieve a custom attribute definition created by another application, the
visibilitysetting must beVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.locations().customAttributeDefinitions().get( GetCustomAttributeDefinitionsRequest .builder() .key("key") .version(1) .build() );
-
βοΈ Parameters
-
-
key:
StringThe key of the custom attribute definition to retrieve. If the requesting application is not the definition owner, you must use the qualified key.
-
version:
Optional<Integer>The current version of the custom attribute definition, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a
BAD_REQUESTerror.
-
-
client.locations.customAttributeDefinitions.update(key, request) -> UpdateLocationCustomAttributeDefinitionResponse
-
π Description
-
-
Updates a location-related custom attribute definition for a Square seller account. Use this endpoint to update the following fields:
name,description,visibility, or theschemafor aSelectiondata type. Only the definition owner can update a custom attribute definition.
-
π Usage
-
-
client.locations().customAttributeDefinitions().update( UpdateLocationCustomAttributeDefinitionRequest .builder() .key("key") .customAttributeDefinition( CustomAttributeDefinition .builder() .description("Update the description as desired.") .visibility(CustomAttributeDefinitionVisibility.VISIBILITY_READ_ONLY) .build() ) .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to update.
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition that contains the fields to update. This endpoint supports sparse updates, so only new or changed fields need to be included in the request. Only the following fields can be updated:
namedescriptionvisibilityschemafor aSelectiondata type. Only changes to the named options or the maximum number of allowed selections are supported.
For more information, see Update a location custom attribute definition. To enable optimistic concurrency control, specify the current version of the custom attribute definition. If this is not important for your application,
versioncan be set to -1.
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.locations.customAttributeDefinitions.delete(key) -> DeleteLocationCustomAttributeDefinitionResponse
-
π Description
-
-
Deletes a location-related custom attribute definition from a Square seller account. Deleting a custom attribute definition also deletes the corresponding custom attribute from all locations. Only the definition owner can delete a custom attribute definition.
-
π Usage
-
-
client.locations().customAttributeDefinitions().delete( DeleteCustomAttributeDefinitionsRequest .builder() .key("key") .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to delete.
-
-
Locations CustomAttributes
client.locations.customAttributes.batchDelete(request) -> BulkDeleteLocationCustomAttributesResponse
-
π Description
-
-
Deletes custom attributes for locations as a bulk operation. To delete a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.locations().customAttributes().batchDelete( BulkDeleteLocationCustomAttributesRequest .builder() .values( new HashMap<String, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest>() {{ put("id1", BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest .builder() .key(Optional.of("bestseller")) .build()); put("id2", BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest .builder() .key(Optional.of("bestseller")) .build()); put("id3", BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest .builder() .key(Optional.of("phone-number")) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest>The data used to update the
CustomAttributeobjects. The keys must be unique and are used to map to the corresponding response.
-
-
client.locations.customAttributes.batchUpsert(request) -> BulkUpsertLocationCustomAttributesResponse
-
π Description
-
-
Creates or updates custom attributes for locations as a bulk operation. Use this endpoint to set the value of one or more custom attributes for one or more locations. A custom attribute is based on a custom attribute definition in a Square seller account, which is created using the CreateLocationCustomAttributeDefinition endpoint. This
BulkUpsertLocationCustomAttributesendpoint accepts a map of 1 to 25 individual upsert requests and returns a map of individual upsert responses. Each upsert request has a unique ID and provides a location ID and custom attribute. Each upsert response is returned with the ID of the corresponding request. To create or update a custom attribute owned by another application, thevisibilitysetting must beVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.locations().customAttributes().batchUpsert( BulkUpsertLocationCustomAttributesRequest .builder() .values( new HashMap<String, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest>() {{ put("id1", BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest .builder() .locationId("L0TBCBTB7P8RQ") .customAttribute( CustomAttribute .builder() .key(Optional.of("bestseller")) .value(Optional.of("hot cocoa")) .build() ) .build()); put("id2", BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest .builder() .locationId("L9XMD04V3STJX") .customAttribute( CustomAttribute .builder() .key(Optional.of("bestseller")) .value(Optional.of("berry smoothie")) .build() ) .build()); put("id3", BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest .builder() .locationId("L0TBCBTB7P8RQ") .customAttribute( CustomAttribute .builder() .key(Optional.of("phone-number")) .value(Optional.of("+12223334444")) .build() ) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest>A map containing 1 to 25 individual upsert requests. For each request, provide an arbitrary ID that is unique for this
BulkUpsertLocationCustomAttributesrequest and the information needed to create or update a custom attribute.
-
-
client.locations.customAttributes.list(locationId) -> SyncPagingIterable<CustomAttribute>
-
π Description
-
-
Lists the custom attributes associated with a location. You can use the
with_definitionsquery parameter to also retrieve custom attribute definitions in the same call. When all response pages are retrieved, the results include all custom attributes that are visible to the requesting application, including those that are owned by other applications and set toVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.locations().customAttributes().list( ListCustomAttributesRequest .builder() .locationId("location_id") .visibilityFilter(VisibilityFilter.ALL) .limit(1) .cursor("cursor") .withDefinitions(true) .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the target location.
-
visibilityFilter:
Optional<VisibilityFilter>β Filters theCustomAttributeDefinitionresults by theirvisibilityvalues.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
withDefinitions:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of each custom attribute. Set this parameter totrueto get the name and description of each custom attribute, information about the data type, or other definition details. The default value isfalse.
-
-
client.locations.customAttributes.get(locationId, key) -> RetrieveLocationCustomAttributeResponse
-
π Description
-
-
Retrieves a custom attribute associated with a location. You can use the
with_definitionquery parameter to also retrieve the custom attribute definition in the same call. To retrieve a custom attribute owned by another application, thevisibilitysetting must beVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.locations().customAttributes().get( GetCustomAttributesRequest .builder() .locationId("location_id") .key("key") .withDefinition(true) .version(1) .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the target location.
-
key:
StringThe key of the custom attribute to retrieve. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
withDefinition:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of the custom attribute. Set this parameter totrueto get the name and description of the custom attribute, information about the data type, or other definition details. The default value isfalse.
-
version:
Optional<Integer>The current version of the custom attribute, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a
BAD_REQUESTerror.
-
-
client.locations.customAttributes.upsert(locationId, key, request) -> UpsertLocationCustomAttributeResponse
-
π Description
-
-
Creates or updates a custom attribute for a location. Use this endpoint to set the value of a custom attribute for a specified location. A custom attribute is based on a custom attribute definition in a Square seller account, which is created using the CreateLocationCustomAttributeDefinition endpoint. To create or update a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.locations().customAttributes().upsert( UpsertLocationCustomAttributeRequest .builder() .locationId("location_id") .key("key") .customAttribute( CustomAttribute .builder() .value("hot cocoa") .build() ) .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the target location.
-
key:
StringThe key of the custom attribute to create or update. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
customAttribute:
CustomAttributeThe custom attribute to create or update, with the following fields:
value. This value must conform to theschemaspecified by the definition. For more information, see Supported data types.version. To enable optimistic concurrency control for an update operation, include the current version of the custom attribute. If this is not important for your application, version can be set to -1.
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.locations.customAttributes.delete(locationId, key) -> DeleteLocationCustomAttributeResponse
-
π Description
-
-
Deletes a custom attribute associated with a location. To delete a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.locations().customAttributes().delete( DeleteCustomAttributesRequest .builder() .locationId("location_id") .key("key") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the target location.
-
key:
StringThe key of the custom attribute to delete. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
-
Locations Transactions
client.locations.transactions.list(locationId) -> ListTransactionsResponse
-
π Description
-
-
Lists transactions for a particular location.
Transactions include payment information from sales and exchanges and refund information from returns and exchanges.
Max results per page: 50
-
π Usage
-
-
client.locations().transactions().list( ListTransactionsRequest .builder() .locationId("location_id") .beginTime("begin_time") .endTime("end_time") .sortOrder(SortOrder.DESC) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the location to list transactions for.
-
beginTime:
Optional<String>The beginning of the requested reporting period, in RFC 3339 format.
See Date ranges for details on date inclusivity/exclusivity.
Default value: The current time minus one year.
-
endTime:
Optional<String>The end of the requested reporting period, in RFC 3339 format.
See Date ranges for details on date inclusivity/exclusivity.
Default value: The current time.
-
sortOrder:
Optional<SortOrder>The order in which results are listed in the response (
ASCfor oldest first,DESCfor newest first).Default value:
DESC
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query.
See Paginating results for more information.
-
-
client.locations.transactions.get(locationId, transactionId) -> GetTransactionResponse
-
π Description
-
-
Retrieves details for a single transaction.
-
π Usage
-
-
client.locations().transactions().get( GetTransactionsRequest .builder() .locationId("location_id") .transactionId("transaction_id") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ The ID of the transaction's associated location.
-
transactionId:
Stringβ The ID of the transaction to retrieve.
-
-
client.locations.transactions.capture(locationId, transactionId) -> CaptureTransactionResponse
-
π Description
-
-
Captures a transaction that was created with the Charge endpoint with a
delay_capturevalue oftrue.See Delayed capture transactions for more information.
-
π Usage
-
-
client.locations().transactions().capture( CaptureTransactionsRequest .builder() .locationId("location_id") .transactionId("transaction_id") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ
-
transactionId:
Stringβ
-
-
client.locations.transactions.void_(locationId, transactionId) -> VoidTransactionResponse
-
π Description
-
-
Cancels a transaction that was created with the Charge endpoint with a
delay_capturevalue oftrue.See Delayed capture transactions for more information.
-
π Usage
-
-
client.locations().transactions().void_( VoidTransactionsRequest .builder() .locationId("location_id") .transactionId("transaction_id") .build() );
-
βοΈ Parameters
-
-
locationId:
Stringβ
-
transactionId:
Stringβ
-
-
Loyalty Accounts
client.loyalty.accounts.create(request) -> CreateLoyaltyAccountResponse
-
π Description
-
-
Creates a loyalty account. To create a loyalty account, you must provide the
program_idand amappingwith thephone_numberof the buyer.
-
π Usage
-
-
client.loyalty().accounts().create( CreateLoyaltyAccountRequest .builder() .loyaltyAccount( LoyaltyAccount .builder() .programId("d619f755-2d17-41f3-990d-c04ecedd64dd") .mapping( LoyaltyAccountMapping .builder() .phoneNumber("+14155551234") .build() ) .build() ) .idempotencyKey("ec78c477-b1c3-4899-a209-a4e71337c996") .build() );
-
βοΈ Parameters
-
-
loyaltyAccount:
LoyaltyAccountβ The loyalty account to create.
-
idempotencyKey:
StringA unique string that identifies this
CreateLoyaltyAccountrequest. Keys can be any valid string, but must be unique for every request.
-
-
client.loyalty.accounts.search(request) -> SearchLoyaltyAccountsResponse
-
π Description
-
-
Searches for loyalty accounts in a loyalty program.
You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty
queryobject or omit it entirely.Search results are sorted by
created_atin ascending order.
-
π Usage
-
-
client.loyalty().accounts().search( SearchLoyaltyAccountsRequest .builder() .query( SearchLoyaltyAccountsRequestLoyaltyAccountQuery .builder() .mappings( Optional.of( Arrays.asList( LoyaltyAccountMapping .builder() .phoneNumber("+14155551234") .build() ) ) ) .build() ) .limit(10) .build() );
-
βοΈ Parameters
-
-
query:
Optional<SearchLoyaltyAccountsRequestLoyaltyAccountQuery>β The search criteria for the request.
-
limit:
Optional<Integer>β The maximum number of results to include in the response. The default value is 30.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query.
For more information, see Pagination.
-
-
client.loyalty.accounts.get(accountId) -> GetLoyaltyAccountResponse
-
π Description
-
-
Retrieves a loyalty account.
-
π Usage
-
-
client.loyalty().accounts().get( GetAccountsRequest .builder() .accountId("account_id") .build() );
-
βοΈ Parameters
-
-
accountId:
Stringβ The ID of the loyalty account to retrieve.
-
-
client.loyalty.accounts.accumulatePoints(accountId, request) -> AccumulateLoyaltyPointsResponse
-
π Description
-
-
Adds points earned from a purchase to a loyalty account.
-
If you are using the Orders API to manage orders, provide the
order_id. Square reads the order to compute the points earned from both the base loyalty program and an associated loyalty promotion. For purchases that qualify for multiple accrual rules, Square computes points based on the accrual rule that grants the most points. For purchases that qualify for multiple promotions, Square computes points based on the most recently created promotion. A purchase must first qualify for program points to be eligible for promotion points. -
If you are not using the Orders API to manage orders, provide
pointswith the number of points to add. You must first perform a client-side computation of the points earned from the loyalty program and loyalty promotion. For spend-based and visit-based programs, you can call CalculateLoyaltyPoints to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see Calculating promotion points.
-
-
π Usage
-
-
client.loyalty().accounts().accumulatePoints( AccumulateLoyaltyPointsRequest .builder() .accountId("account_id") .accumulatePoints( LoyaltyEventAccumulatePoints .builder() .orderId("RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY") .build() ) .idempotencyKey("58b90739-c3e8-4b11-85f7-e636d48d72cb") .locationId("P034NEENMD09F") .build() );
-
βοΈ Parameters
-
-
accountId:
Stringβ The ID of the target loyalty account.
-
accumulatePoints:
LoyaltyEventAccumulatePointsThe points to add to the account. If you are using the Orders API to manage orders, specify the order ID. Otherwise, specify the points to add.
-
idempotencyKey:
StringA unique string that identifies the
AccumulateLoyaltyPointsrequest. Keys can be any valid string but must be unique for every request.
-
locationId:
Stringβ The location where the purchase was made.
-
-
client.loyalty.accounts.adjust(accountId, request) -> AdjustLoyaltyPointsResponse
-
π Description
-
-
Adds points to or subtracts points from a buyer's account.
Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call AccumulateLoyaltyPoints to add points when a buyer pays for the purchase.
-
π Usage
-
-
client.loyalty().accounts().adjust( AdjustLoyaltyPointsRequest .builder() .accountId("account_id") .idempotencyKey("bc29a517-3dc9-450e-aa76-fae39ee849d1") .adjustPoints( LoyaltyEventAdjustPoints .builder() .points(10) .reason("Complimentary points") .build() ) .build() );
-
βοΈ Parameters
-
-
accountId:
Stringβ The ID of the target loyalty account.
-
idempotencyKey:
StringA unique string that identifies this
AdjustLoyaltyPointsrequest. Keys can be any valid string, but must be unique for every request.
-
adjustPoints:
LoyaltyEventAdjustPointsThe points to add or subtract and the reason for the adjustment. To add points, specify a positive integer. To subtract points, specify a negative integer.
-
allowNegativeBalance:
Optional<Boolean>Indicates whether to allow a negative adjustment to result in a negative balance. If
true, a negative balance is allowed when subtracting points. Iffalse, Square returns aBAD_REQUESTerror when subtracting the specified number of points would result in a negative balance. The default value isfalse.
-
-
Loyalty Programs
client.loyalty.programs.list() -> ListLoyaltyProgramsResponse
-
π Description
-
-
Returns a list of loyalty programs in the seller's account. Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see Loyalty Program Overview.
Replaced with RetrieveLoyaltyProgram when used with the keyword
main.
-
π Usage
-
-
client.loyalty().programs().list();
-
-
client.loyalty.programs.get(programId) -> GetLoyaltyProgramResponse
-
π Description
-
-
Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword
main.Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see Loyalty Program Overview.
-
π Usage
-
-
client.loyalty().programs().get( GetProgramsRequest .builder() .programId("program_id") .build() );
-
βοΈ Parameters
-
-
programId:
Stringβ The ID of the loyalty program or the keywordmain. Either value can be used to retrieve the single loyalty program that belongs to the seller.
-
-
client.loyalty.programs.calculate(programId, request) -> CalculateLoyaltyPointsResponse
-
π Description
-
-
Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint to display the points to the buyer.
-
If you are using the Orders API to manage orders, provide the
order_idand (optional)loyalty_account_id. Square reads the order to compute the points earned from the base loyalty program and an associated loyalty promotion. -
If you are not using the Orders API to manage orders, provide
transaction_amount_moneywith the purchase amount. Square uses this amount to calculate the points earned from the base loyalty program, but not points earned from a loyalty promotion. For spend-based and visit-based programs, thetax_modesetting of the accrual rule indicates how taxes should be treated for loyalty points accrual. If the purchase qualifies for program points, call ListLoyaltyPromotions and perform a client-side computation to calculate whether the purchase also qualifies for promotion points. For more information, see Calculating promotion points.
-
-
π Usage
-
-
client.loyalty().programs().calculate( CalculateLoyaltyPointsRequest .builder() .programId("program_id") .orderId("RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY") .loyaltyAccountId("79b807d2-d786-46a9-933b-918028d7a8c5") .build() );
-
βοΈ Parameters
-
-
programId:
Stringβ The ID of the loyalty program, which defines the rules for accruing points.
-
orderId:
Optional<String>The order ID for which to calculate the points. Specify this field if your application uses the Orders API to process orders. Otherwise, specify the
transaction_amount_money.
-
transactionAmountMoney:
Optional<Money>The purchase amount for which to calculate the points. Specify this field if your application does not use the Orders API to process orders. Otherwise, specify the
order_id.
-
loyaltyAccountId:
Optional<String>The ID of the target loyalty account. Optionally specify this field if your application uses the Orders API to process orders.
If specified, the
promotion_pointsfield in the response shows the number of points the buyer would earn from the purchase. In this case, Square uses the account ID to determine whether the promotion'strigger_limit(the maximum number of times that a buyer can trigger the promotion) has been reached. If not specified, thepromotion_pointsfield shows the number of points the purchase qualifies for regardless of the trigger limit.
-
-
Loyalty Rewards
client.loyalty.rewards.create(request) -> CreateLoyaltyRewardResponse
-
π Description
-
-
Creates a loyalty reward. In the process, the endpoint does following:
- Uses the
reward_tier_idin the request to determine the number of points to lock for this reward. - If the request includes
order_id, it adds the reward and related discount to the order.
After a reward is created, the points are locked and not available for the buyer to redeem another reward.
- Uses the
-
π Usage
-
-
client.loyalty().rewards().create( CreateLoyaltyRewardRequest .builder() .reward( LoyaltyReward .builder() .loyaltyAccountId("5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd") .rewardTierId("e1b39225-9da5-43d1-a5db-782cdd8ad94f") .orderId("RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY") .build() ) .idempotencyKey("18c2e5ea-a620-4b1f-ad60-7b167285e451") .build() );
-
βοΈ Parameters
-
-
reward:
LoyaltyRewardβ The reward to create.
-
idempotencyKey:
StringA unique string that identifies this
CreateLoyaltyRewardrequest. Keys can be any valid string, but must be unique for every request.
-
-
client.loyalty.rewards.search(request) -> SearchLoyaltyRewardsResponse
-
π Description
-
-
Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. If you include a
queryobject,loyalty_account_idis required andstatusis optional.If you know a reward ID, use the RetrieveLoyaltyReward endpoint.
Search results are sorted by
updated_atin descending order.
-
π Usage
-
-
client.loyalty().rewards().search( SearchLoyaltyRewardsRequest .builder() .query( SearchLoyaltyRewardsRequestLoyaltyRewardQuery .builder() .loyaltyAccountId("5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd") .build() ) .limit(10) .build() );
-
βοΈ Parameters
-
-
query:
Optional<SearchLoyaltyRewardsRequestLoyaltyRewardQuery>The search criteria for the request. If empty, the endpoint retrieves all loyalty rewards in the loyalty program.
-
limit:
Optional<Integer>β The maximum number of results to return in the response. The default value is 30.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. For more information, see Pagination.
-
-
client.loyalty.rewards.get(rewardId) -> GetLoyaltyRewardResponse
-
π Description
-
-
Retrieves a loyalty reward.
-
π Usage
-
-
client.loyalty().rewards().get( GetRewardsRequest .builder() .rewardId("reward_id") .build() );
-
βοΈ Parameters
-
-
rewardId:
Stringβ The ID of the loyalty reward to retrieve.
-
-
client.loyalty.rewards.delete(rewardId) -> DeleteLoyaltyRewardResponse
-
π Description
-
-
Deletes a loyalty reward by doing the following:
- Returns the loyalty points back to the loyalty account.
- If an order ID was specified when the reward was created (see CreateLoyaltyReward), it updates the order by removing the reward and related discounts.
You cannot delete a reward that has reached the terminal state (REDEEMED).
-
π Usage
-
-
client.loyalty().rewards().delete( DeleteRewardsRequest .builder() .rewardId("reward_id") .build() );
-
βοΈ Parameters
-
-
rewardId:
Stringβ The ID of the loyalty reward to delete.
-
-
client.loyalty.rewards.redeem(rewardId, request) -> RedeemLoyaltyRewardResponse
-
π Description
-
-
Redeems a loyalty reward.
The endpoint sets the reward to the
REDEEMEDterminal state.If you are using your own order processing system (not using the Orders API), you call this endpoint after the buyer paid for the purchase.
After the reward reaches the terminal state, it cannot be deleted. In other words, points used for the reward cannot be returned to the account.
-
π Usage
-
-
client.loyalty().rewards().redeem( RedeemLoyaltyRewardRequest .builder() .rewardId("reward_id") .idempotencyKey("98adc7f7-6963-473b-b29c-f3c9cdd7d994") .locationId("P034NEENMD09F") .build() );
-
βοΈ Parameters
-
-
rewardId:
Stringβ The ID of the loyalty reward to redeem.
-
idempotencyKey:
StringA unique string that identifies this
RedeemLoyaltyRewardrequest. Keys can be any valid string, but must be unique for every request.
-
locationId:
Stringβ The ID of the location where the reward is redeemed.
-
-
Loyalty Programs Promotions
client.loyalty.programs.promotions.list(programId) -> SyncPagingIterable<LoyaltyPromotion>
-
π Description
-
-
Lists the loyalty promotions associated with a loyalty program. Results are sorted by the
created_atdate in descending order (newest to oldest).
-
π Usage
-
-
client.loyalty().programs().promotions().list( ListPromotionsRequest .builder() .programId("program_id") .status(LoyaltyPromotionStatus.ACTIVE) .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
programId:
StringThe ID of the base loyalty program. To get the program ID, call RetrieveLoyaltyProgram using the
mainkeyword.
-
status:
Optional<LoyaltyPromotionStatus>The status to filter the results by. If a status is provided, only loyalty promotions with the specified status are returned. Otherwise, all loyalty promotions associated with the loyalty program are returned.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. The minimum value is 1 and the maximum value is 30. The default value is 30. For more information, see Pagination.
-
-
client.loyalty.programs.promotions.create(programId, request) -> CreateLoyaltyPromotionResponse
-
π Description
-
-
Creates a loyalty promotion for a loyalty program. A loyalty promotion enables buyers to earn points in addition to those earned from the base loyalty program.
This endpoint sets the loyalty promotion to the
ACTIVEorSCHEDULEDstatus, depending on theavailable_timesetting. A loyalty program can have a maximum of 10 loyalty promotions with anACTIVEorSCHEDULEDstatus.
-
π Usage
-
-
client.loyalty().programs().promotions().create( CreateLoyaltyPromotionRequest .builder() .programId("program_id") .loyaltyPromotion( LoyaltyPromotion .builder() .name("Tuesday Happy Hour Promo") .incentive( LoyaltyPromotionIncentive .builder() .type(LoyaltyPromotionIncentiveType.POINTS_MULTIPLIER) .pointsMultiplierData( LoyaltyPromotionIncentivePointsMultiplierData .builder() .multiplier("3.0") .build() ) .build() ) .availableTime( LoyaltyPromotionAvailableTimeData .builder() .timePeriods( Arrays.asList("BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT") ) .build() ) .triggerLimit( LoyaltyPromotionTriggerLimit .builder() .times(1) .interval(LoyaltyPromotionTriggerLimitInterval.DAY) .build() ) .minimumSpendAmountMoney( Money .builder() .amount(2000L) .currency(Currency.USD) .build() ) .qualifyingCategoryIds( Optional.of( Arrays.asList("XTQPYLR3IIU9C44VRCB3XD12") ) ) .build() ) .idempotencyKey("ec78c477-b1c3-4899-a209-a4e71337c996") .build() );
-
βοΈ Parameters
-
-
programId:
StringThe ID of the loyalty program to associate with the promotion. To get the program ID, call RetrieveLoyaltyProgram using the
mainkeyword.
-
loyaltyPromotion:
LoyaltyPromotionβ The loyalty promotion to create.
-
idempotencyKey:
StringA unique identifier for this request, which is used to ensure idempotency. For more information, see Idempotency.
-
-
client.loyalty.programs.promotions.get(programId, promotionId) -> GetLoyaltyPromotionResponse
-
π Description
-
-
Retrieves a loyalty promotion.
-
π Usage
-
-
client.loyalty().programs().promotions().get( GetPromotionsRequest .builder() .programId("program_id") .promotionId("promotion_id") .build() );
-
βοΈ Parameters
-
-
programId:
StringThe ID of the base loyalty program. To get the program ID, call RetrieveLoyaltyProgram using the
mainkeyword.
-
promotionId:
Stringβ The ID of the loyalty promotion to retrieve.
-
-
client.loyalty.programs.promotions.cancel(programId, promotionId) -> CancelLoyaltyPromotionResponse
-
π Description
-
-
Cancels a loyalty promotion. Use this endpoint to cancel an
ACTIVEpromotion earlier than the end date, cancel anACTIVEpromotion when an end date is not specified, or cancel aSCHEDULEDpromotion. Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before you create a new one.This endpoint sets the loyalty promotion to the
CANCELEDstate
-
π Usage
-
-
client.loyalty().programs().promotions().cancel( CancelPromotionsRequest .builder() .programId("program_id") .promotionId("promotion_id") .build() );
-
βοΈ Parameters
-
-
programId:
Stringβ The ID of the base loyalty program.
-
promotionId:
StringThe ID of the loyalty promotion to cancel. You can cancel a promotion that has an
ACTIVEorSCHEDULEDstatus.
-
-
Merchants CustomAttributeDefinitions
client.merchants.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
-
π Description
-
-
Lists the merchant-related custom attribute definitions that belong to a Square seller account. When all response pages are retrieved, the results include all custom attribute definitions that are visible to the requesting application, including those that are created by other applications and set to
VISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.merchants().customAttributeDefinitions().list( ListCustomAttributeDefinitionsRequest .builder() .visibilityFilter(VisibilityFilter.ALL) .limit(1) .cursor("cursor") .build() );
-
βοΈ Parameters
-
-
visibilityFilter:
Optional<VisibilityFilter>β Filters theCustomAttributeDefinitionresults by theirvisibilityvalues.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
-
client.merchants.customAttributeDefinitions.create(request) -> CreateMerchantCustomAttributeDefinitionResponse
-
π Description
-
-
Creates a merchant-related custom attribute definition for a Square seller account. Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application. A custom attribute definition specifies the
key,visibility,schema, and other properties for a custom attribute. After the definition is created, you can call UpsertMerchantCustomAttribute or BulkUpsertMerchantCustomAttributes to set the custom attribute for a merchant.
-
π Usage
-
-
client.merchants().customAttributeDefinitions().create( CreateMerchantCustomAttributeDefinitionRequest .builder() .customAttributeDefinition( CustomAttributeDefinition .builder() .key("alternative_seller_name") .schema( new HashMap<String, Object>() {{ put("$ref", "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String"); }} ) .name("Alternative Merchant Name") .description("This is the other name this merchant goes by.") .visibility(CustomAttributeDefinitionVisibility.VISIBILITY_READ_ONLY) .build() ) .build() );
-
βοΈ Parameters
-
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition to create. Note the following:
- With the exception of the
Selectiondata type, theschemais specified as a simple URL to the JSON schema definition hosted on the Square CDN. For more information, including supported values and constraints, see Supported data types. nameis required unlessvisibilityis set toVISIBILITY_HIDDEN.
- With the exception of the
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.merchants.customAttributeDefinitions.get(key) -> RetrieveMerchantCustomAttributeDefinitionResponse
-
π Description
-
-
Retrieves a merchant-related custom attribute definition from a Square seller account. To retrieve a custom attribute definition created by another application, the
visibilitysetting must beVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.merchants().customAttributeDefinitions().get( GetCustomAttributeDefinitionsRequest .builder() .key("key") .version(1) .build() );
-
βοΈ Parameters
-
-
key:
StringThe key of the custom attribute definition to retrieve. If the requesting application is not the definition owner, you must use the qualified key.
-
version:
Optional<Integer>The current version of the custom attribute definition, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a
BAD_REQUESTerror.
-
-
client.merchants.customAttributeDefinitions.update(key, request) -> UpdateMerchantCustomAttributeDefinitionResponse
-
π Description
-
-
Updates a merchant-related custom attribute definition for a Square seller account. Use this endpoint to update the following fields:
name,description,visibility, or theschemafor aSelectiondata type. Only the definition owner can update a custom attribute definition.
-
π Usage
-
-
client.merchants().customAttributeDefinitions().update( UpdateMerchantCustomAttributeDefinitionRequest .builder() .key("key") .customAttributeDefinition( CustomAttributeDefinition .builder() .description("Update the description as desired.") .visibility(CustomAttributeDefinitionVisibility.VISIBILITY_READ_ONLY) .build() ) .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to update.
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition that contains the fields to update. This endpoint supports sparse updates, so only new or changed fields need to be included in the request. Only the following fields can be updated:
namedescriptionvisibilityschemafor aSelectiondata type. Only changes to the named options or the maximum number of allowed selections are supported. For more information, see Update a merchant custom attribute definition. The version field must match the current version of the custom attribute definition to enable optimistic concurrency If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.merchants.customAttributeDefinitions.delete(key) -> DeleteMerchantCustomAttributeDefinitionResponse
-
π Description
-
-
Deletes a merchant-related custom attribute definition from a Square seller account. Deleting a custom attribute definition also deletes the corresponding custom attribute from the merchant. Only the definition owner can delete a custom attribute definition.
-
π Usage
-
-
client.merchants().customAttributeDefinitions().delete( DeleteCustomAttributeDefinitionsRequest .builder() .key("key") .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to delete.
-
-
Merchants CustomAttributes
client.merchants.customAttributes.batchDelete(request) -> BulkDeleteMerchantCustomAttributesResponse
-
π Description
-
-
Deletes custom attributes for a merchant as a bulk operation. To delete a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.merchants().customAttributes().batchDelete( BulkDeleteMerchantCustomAttributesRequest .builder() .values( new HashMap<String, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest>() {{ put("id1", BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest .builder() .key(Optional.of("alternative_seller_name")) .build()); put("id2", BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest .builder() .key(Optional.of("has_seen_tutorial")) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest>The data used to update the
CustomAttributeobjects. The keys must be unique and are used to map to the corresponding response.
-
-
client.merchants.customAttributes.batchUpsert(request) -> BulkUpsertMerchantCustomAttributesResponse
-
π Description
-
-
Creates or updates custom attributes for a merchant as a bulk operation. Use this endpoint to set the value of one or more custom attributes for a merchant. A custom attribute is based on a custom attribute definition in a Square seller account, which is created using the CreateMerchantCustomAttributeDefinition endpoint. This
BulkUpsertMerchantCustomAttributesendpoint accepts a map of 1 to 25 individual upsert requests and returns a map of individual upsert responses. Each upsert request has a unique ID and provides a merchant ID and custom attribute. Each upsert response is returned with the ID of the corresponding request. To create or update a custom attribute owned by another application, thevisibilitysetting must beVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.merchants().customAttributes().batchUpsert( BulkUpsertMerchantCustomAttributesRequest .builder() .values( new HashMap<String, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest>() {{ put("id1", BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest .builder() .merchantId("DM7VKY8Q63GNP") .customAttribute( CustomAttribute .builder() .key(Optional.of("alternative_seller_name")) .value(Optional.of("Ultimate Sneaker Store")) .build() ) .build()); put("id2", BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest .builder() .merchantId("DM7VKY8Q63GNP") .customAttribute( CustomAttribute .builder() .key(Optional.of("has_seen_tutorial")) .value(Optional.of(true)) .build() ) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest>A map containing 1 to 25 individual upsert requests. For each request, provide an arbitrary ID that is unique for this
BulkUpsertMerchantCustomAttributesrequest and the information needed to create or update a custom attribute.
-
-
client.merchants.customAttributes.list(merchantId) -> SyncPagingIterable<CustomAttribute>
-
π Description
-
-
Lists the custom attributes associated with a merchant. You can use the
with_definitionsquery parameter to also retrieve custom attribute definitions in the same call. When all response pages are retrieved, the results include all custom attributes that are visible to the requesting application, including those that are owned by other applications and set toVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.merchants().customAttributes().list( ListCustomAttributesRequest .builder() .merchantId("merchant_id") .visibilityFilter(VisibilityFilter.ALL) .limit(1) .cursor("cursor") .withDefinitions(true) .build() );
-
βοΈ Parameters
-
-
merchantId:
Stringβ The ID of the target merchant.
-
visibilityFilter:
Optional<VisibilityFilter>β Filters theCustomAttributeDefinitionresults by theirvisibilityvalues.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
withDefinitions:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of each custom attribute. Set this parameter totrueto get the name and description of each custom attribute, information about the data type, or other definition details. The default value isfalse.
-
-
client.merchants.customAttributes.get(merchantId, key) -> RetrieveMerchantCustomAttributeResponse
-
π Description
-
-
Retrieves a custom attribute associated with a merchant. You can use the
with_definitionquery parameter to also retrieve the custom attribute definition in the same call. To retrieve a custom attribute owned by another application, thevisibilitysetting must beVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.merchants().customAttributes().get( GetCustomAttributesRequest .builder() .merchantId("merchant_id") .key("key") .withDefinition(true) .version(1) .build() );
-
βοΈ Parameters
-
-
merchantId:
Stringβ The ID of the target merchant.
-
key:
StringThe key of the custom attribute to retrieve. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
withDefinition:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of the custom attribute. Set this parameter totrueto get the name and description of the custom attribute, information about the data type, or other definition details. The default value isfalse.
-
version:
Optional<Integer>The current version of the custom attribute, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a
BAD_REQUESTerror.
-
-
client.merchants.customAttributes.upsert(merchantId, key, request) -> UpsertMerchantCustomAttributeResponse
-
π Description
-
-
Creates or updates a custom attribute for a merchant. Use this endpoint to set the value of a custom attribute for a specified merchant. A custom attribute is based on a custom attribute definition in a Square seller account, which is created using the CreateMerchantCustomAttributeDefinition endpoint. To create or update a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.merchants().customAttributes().upsert( UpsertMerchantCustomAttributeRequest .builder() .merchantId("merchant_id") .key("key") .customAttribute( CustomAttribute .builder() .value("Ultimate Sneaker Store") .build() ) .build() );
-
βοΈ Parameters
-
-
merchantId:
Stringβ The ID of the target merchant.
-
key:
StringThe key of the custom attribute to create or update. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
customAttribute:
CustomAttributeThe custom attribute to create or update, with the following fields:
value. This value must conform to theschemaspecified by the definition. For more information, see Supported data types.- The version field must match the current version of the custom attribute definition to enable optimistic concurrency If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.merchants.customAttributes.delete(merchantId, key) -> DeleteMerchantCustomAttributeResponse
-
π Description
-
-
Deletes a custom attribute associated with a merchant. To delete a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.merchants().customAttributes().delete( DeleteCustomAttributesRequest .builder() .merchantId("merchant_id") .key("key") .build() );
-
βοΈ Parameters
-
-
merchantId:
Stringβ The ID of the target merchant.
-
key:
StringThe key of the custom attribute to delete. This key must match the
keyof a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
-
-
Orders CustomAttributeDefinitions
client.orders.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
-
π Description
-
-
Lists the order-related custom attribute definitions that belong to a Square seller account.
When all response pages are retrieved, the results include all custom attribute definitions that are visible to the requesting application, including those that are created by other applications and set to
VISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.orders().customAttributeDefinitions().list( ListCustomAttributeDefinitionsRequest .builder() .visibilityFilter(VisibilityFilter.ALL) .cursor("cursor") .limit(1) .build() );
-
βοΈ Parameters
-
-
visibilityFilter:
Optional<VisibilityFilter>β Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
-
client.orders.customAttributeDefinitions.create(request) -> CreateOrderCustomAttributeDefinitionResponse
-
π Description
-
-
Creates an order-related custom attribute definition. Use this endpoint to define a custom attribute that can be associated with orders.
After creating a custom attribute definition, you can set the custom attribute for orders in the Square seller account.
-
π Usage
-
-
client.orders().customAttributeDefinitions().create( CreateOrderCustomAttributeDefinitionRequest .builder() .customAttributeDefinition( CustomAttributeDefinition .builder() .key("cover-count") .schema( new HashMap<String, Object>() {{ put("$ref", "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number"); }} ) .name("Cover count") .description("The number of people seated at a table") .visibility(CustomAttributeDefinitionVisibility.VISIBILITY_READ_WRITE_VALUES) .build() ) .idempotencyKey("IDEMPOTENCY_KEY") .build() );
-
βοΈ Parameters
-
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition to create. Note the following:
- With the exception of the
Selectiondata type, theschemais specified as a simple URL to the JSON schema definition hosted on the Square CDN. For more information, including supported values and constraints, see Specifying the schema. - If provided,
namemust be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. - All custom attributes are visible in exported customer data, including those set to
VISIBILITY_HIDDEN.
- With the exception of the
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.orders.customAttributeDefinitions.get(key) -> RetrieveOrderCustomAttributeDefinitionResponse
-
π Description
-
-
Retrieves an order-related custom attribute definition from a Square seller account.
To retrieve a custom attribute definition created by another application, the
visibilitysetting must beVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.orders().customAttributeDefinitions().get( GetCustomAttributeDefinitionsRequest .builder() .key("key") .version(1) .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to retrieve.
-
version:
Optional<Integer>To enable optimistic concurrency control, include this optional field and specify the current version of the custom attribute.
-
-
client.orders.customAttributeDefinitions.update(key, request) -> UpdateOrderCustomAttributeDefinitionResponse
-
π Description
-
-
Updates an order-related custom attribute definition for a Square seller account.
Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to
VISIBILITY_HIDDEN.
-
π Usage
-
-
client.orders().customAttributeDefinitions().update( UpdateOrderCustomAttributeDefinitionRequest .builder() .key("key") .customAttributeDefinition( CustomAttributeDefinition .builder() .key("cover-count") .visibility(CustomAttributeDefinitionVisibility.VISIBILITY_READ_ONLY) .version(1) .build() ) .idempotencyKey("IDEMPOTENCY_KEY") .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to update.
-
customAttributeDefinition:
CustomAttributeDefinitionThe custom attribute definition that contains the fields to update. This endpoint supports sparse updates, so only new or changed fields need to be included in the request. For more information, see Updatable definition fields.
To enable optimistic concurrency control, include the optional
versionfield and specify the current version of the custom attribute definition.
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.orders.customAttributeDefinitions.delete(key) -> DeleteOrderCustomAttributeDefinitionResponse
-
π Description
-
-
Deletes an order-related custom attribute definition from a Square seller account.
Only the definition owner can delete a custom attribute definition.
-
π Usage
-
-
client.orders().customAttributeDefinitions().delete( DeleteCustomAttributeDefinitionsRequest .builder() .key("key") .build() );
-
βοΈ Parameters
-
-
key:
Stringβ The key of the custom attribute definition to delete.
-
-
Orders CustomAttributes
client.orders.customAttributes.batchDelete(request) -> BulkDeleteOrderCustomAttributesResponse
-
π Description
-
-
Deletes order custom attributes as a bulk operation.
Use this endpoint to delete one or more custom attributes from one or more orders. A custom attribute is based on a custom attribute definition in a Square seller account. (To create a custom attribute definition, use the CreateOrderCustomAttributeDefinition endpoint.)
This
BulkDeleteOrderCustomAttributesendpoint accepts a map of 1 to 25 individual delete requests and returns a map of individual delete responses. Each delete request has a unique ID and provides an order ID and custom attribute. Each delete response is returned with the ID of the corresponding request.To delete a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.orders().customAttributes().batchDelete( BulkDeleteOrderCustomAttributesRequest .builder() .values( new HashMap<String, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute>() {{ put("cover-count", BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute .builder() .orderId("7BbXGEIWNldxAzrtGf9GPVZTwZ4F") .key(Optional.of("cover-count")) .build()); put("table-number", BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute .builder() .orderId("7BbXGEIWNldxAzrtGf9GPVZTwZ4F") .key(Optional.of("table-number")) .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute>β A map of requests that correspond to individual delete operations for custom attributes.
-
-
client.orders.customAttributes.batchUpsert(request) -> BulkUpsertOrderCustomAttributesResponse
-
π Description
-
-
Creates or updates order custom attributes as a bulk operation.
Use this endpoint to delete one or more custom attributes from one or more orders. A custom attribute is based on a custom attribute definition in a Square seller account. (To create a custom attribute definition, use the CreateOrderCustomAttributeDefinition endpoint.)
This
BulkUpsertOrderCustomAttributesendpoint accepts a map of 1 to 25 individual upsert requests and returns a map of individual upsert responses. Each upsert request has a unique ID and provides an order ID and custom attribute. Each upsert response is returned with the ID of the corresponding request.To create or update a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.orders().customAttributes().batchUpsert( BulkUpsertOrderCustomAttributesRequest .builder() .values( new HashMap<String, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute>() {{ put("cover-count", BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute .builder() .customAttribute( CustomAttribute .builder() .key(Optional.of("cover-count")) .value(Optional.of("6")) .version(Optional.of(2)) .build() ) .orderId("7BbXGEIWNldxAzrtGf9GPVZTwZ4F") .build()); put("table-number", BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute .builder() .customAttribute( CustomAttribute .builder() .key(Optional.of("table-number")) .value(Optional.of("11")) .version(Optional.of(4)) .build() ) .orderId("7BbXGEIWNldxAzrtGf9GPVZTwZ4F") .build()); }} ) .build() );
-
βοΈ Parameters
-
-
values:
Map<String, BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute>β A map of requests that correspond to individual upsert operations for custom attributes.
-
-
client.orders.customAttributes.list(orderId) -> SyncPagingIterable<CustomAttribute>
-
π Description
-
-
Lists the custom attributes associated with an order.
You can use the
with_definitionsquery parameter to also retrieve custom attribute definitions in the same call.When all response pages are retrieved, the results include all custom attributes that are visible to the requesting application, including those that are owned by other applications and set to
VISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.orders().customAttributes().list( ListCustomAttributesRequest .builder() .orderId("order_id") .visibilityFilter(VisibilityFilter.ALL) .cursor("cursor") .limit(1) .withDefinitions(true) .build() );
-
βοΈ Parameters
-
-
orderId:
Stringβ The ID of the target order.
-
visibilityFilter:
Optional<VisibilityFilter>β Requests that all of the custom attributes be returned, or only those that are read-only or read-write.
-
cursor:
Optional<String>The cursor returned in the paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see Pagination.
-
limit:
Optional<Integer>The maximum number of results to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see Pagination.
-
withDefinitions:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of each custom attribute. Set this parameter totrueto get the name and description of each custom attribute, information about the data type, or other definition details. The default value isfalse.
-
-
client.orders.customAttributes.get(orderId, customAttributeKey) -> RetrieveOrderCustomAttributeResponse
-
π Description
-
-
Retrieves a custom attribute associated with an order.
You can use the
with_definitionquery parameter to also retrieve the custom attribute definition in the same call.To retrieve a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_ONLYorVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.orders().customAttributes().get( GetCustomAttributesRequest .builder() .orderId("order_id") .customAttributeKey("custom_attribute_key") .version(1) .withDefinition(true) .build() );
-
βοΈ Parameters
-
-
orderId:
Stringβ The ID of the target order.
-
customAttributeKey:
StringThe key of the custom attribute to retrieve. This key must match the key of an existing custom attribute definition.
-
version:
Optional<Integer>To enable optimistic concurrency control, include this optional field and specify the current version of the custom attribute.
-
withDefinition:
Optional<Boolean>Indicates whether to return the custom attribute definition in the
definitionfield of each custom attribute. Set this parameter totrueto get the name and description of each custom attribute, information about the data type, or other definition details. The default value isfalse.
-
-
client.orders.customAttributes.upsert(orderId, customAttributeKey, request) -> UpsertOrderCustomAttributeResponse
-
π Description
-
-
Creates or updates a custom attribute for an order.
Use this endpoint to set the value of a custom attribute for a specific order. A custom attribute is based on a custom attribute definition in a Square seller account. (To create a custom attribute definition, use the CreateOrderCustomAttributeDefinition endpoint.)
To create or update a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.orders().customAttributes().upsert( UpsertOrderCustomAttributeRequest .builder() .orderId("order_id") .customAttributeKey("custom_attribute_key") .customAttribute( CustomAttribute .builder() .key("table-number") .value("42") .version(1) .build() ) .build() );
-
βοΈ Parameters
-
-
orderId:
Stringβ The ID of the target order.
-
customAttributeKey:
StringThe key of the custom attribute to create or update. This key must match the key of an existing custom attribute definition.
-
customAttribute:
CustomAttributeThe custom attribute to create or update, with the following fields:
-
value. This value must conform to theschemaspecified by the definition. For more information, see Value data types. -
version. To enable optimistic concurrency control, include this optional field and specify the current version of the custom attribute.
-
-
idempotencyKey:
Optional<String>A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency.
-
-
client.orders.customAttributes.delete(orderId, customAttributeKey) -> DeleteOrderCustomAttributeResponse
-
π Description
-
-
Deletes a custom attribute associated with a customer profile.
To delete a custom attribute owned by another application, the
visibilitysetting must beVISIBILITY_READ_WRITE_VALUES. Note that seller-defined custom attributes (also known as custom fields) are always set toVISIBILITY_READ_WRITE_VALUES.
-
π Usage
-
-
client.orders().customAttributes().delete( DeleteCustomAttributesRequest .builder() .orderId("order_id") .customAttributeKey("custom_attribute_key") .build() );
-
βοΈ Parameters
-
-
orderId:
Stringβ The ID of the target order.
-
customAttributeKey:
StringThe key of the custom attribute to delete. This key must match the key of an existing custom attribute definition.
-
-
TeamMembers WageSetting
client.teamMembers.wageSetting.get(teamMemberId) -> GetWageSettingResponse
-
π Description
-
-
Retrieves a
WageSettingobject for a team member specified byTeamMember.id. For more information, see Troubleshooting the Team API.Square recommends using RetrieveTeamMember or SearchTeamMembers to get this information directly from the
TeamMember.wage_settingfield.
-
π Usage
-
-
client.teamMembers().wageSetting().get( GetWageSettingRequest .builder() .teamMemberId("team_member_id") .build() );
-
βοΈ Parameters
-
-
teamMemberId:
Stringβ The ID of the team member for which to retrieve the wage setting.
-
-
client.teamMembers.wageSetting.update(teamMemberId, request) -> UpdateWageSettingResponse
-
π Description
-
-
Creates or updates a
WageSettingobject. The object is created if aWageSettingwith the specifiedteam_member_iddoesn't exist. Otherwise, it fully replaces theWageSettingobject for the team member. TheWageSettingis returned on a successful update. For more information, see Troubleshooting the Team API.Square recommends using CreateTeamMember or UpdateTeamMember to manage the
TeamMember.wage_settingfield directly.
-
π Usage
-
-
client.teamMembers().wageSetting().update( UpdateWageSettingRequest .builder() .teamMemberId("team_member_id") .wageSetting( WageSetting .builder() .jobAssignments( Optional.of( Arrays.asList( JobAssignment .builder() .payType(JobAssignmentPayType.SALARY) .jobTitle("Manager") .annualRate( Money .builder() .amount(3000000L) .currency(Currency.USD) .build() ) .weeklyHours(40) .build(), JobAssignment .builder() .payType(JobAssignmentPayType.HOURLY) .jobTitle("Cashier") .hourlyRate( Money .builder() .amount(2000L) .currency(Currency.USD) .build() ) .build() ) ) ) .isOvertimeExempt(true) .build() ) .build() );
-
βοΈ Parameters
-
-
teamMemberId:
Stringβ The ID of the team member for which to update theWageSettingobject.
-
wageSetting:
WageSettingThe complete
WageSettingobject. For all job assignments, specify one of the following:job_id(recommended) - If needed, call ListJobs to get a list of all jobs. Requires Square API version 2024-12-18 or later.job_title- Use the exact, case-sensitive spelling of an existing title unless you want to create a new job. This value is ignored ifjob_idis also provided.
-
-
Terminal Actions
client.terminal.actions.create(request) -> CreateTerminalActionResponse
-
π Description
-
-
Creates a Terminal action request and sends it to the specified device.
-
π Usage
-
-
client.terminal().actions().create( CreateTerminalActionRequest .builder() .idempotencyKey("thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e") .action( TerminalAction .builder() .deviceId("{{DEVICE_ID}}") .deadlineDuration("PT5M") .type(TerminalActionActionType.SAVE_CARD) .saveCardOptions( SaveCardOptions .builder() .customerId("{{CUSTOMER_ID}}") .referenceId("user-id-1") .build() ) .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA unique string that identifies this
CreateActionrequest. Keys can be any valid string but must be unique for everyCreateActionrequest.See Idempotency keys for more information.
-
action:
TerminalActionβ The Action to create.
-
-
client.terminal.actions.search(request) -> SearchTerminalActionsResponse
-
π Description
-
-
Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.
-
π Usage
-
-
client.terminal().actions().search( SearchTerminalActionsRequest .builder() .query( TerminalActionQuery .builder() .filter( TerminalActionQueryFilter .builder() .createdAt( TimeRange .builder() .startAt("2022-04-01T00:00:00.000Z") .build() ) .build() ) .sort( TerminalActionQuerySort .builder() .sortOrder(SortOrder.DESC) .build() ) .build() ) .limit(2) .build() );
-
βοΈ Parameters
-
-
query:
Optional<TerminalActionQuery>Queries terminal actions based on given conditions and sort order. Leaving this unset will return all actions with the default sort order.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See Pagination for more information.
-
limit:
Optional<Integer>β Limit the number of results returned for a single request.
-
-
client.terminal.actions.get(actionId) -> GetTerminalActionResponse
-
π Description
-
-
Retrieves a Terminal action request by
action_id. Terminal action requests are available for 30 days.
-
π Usage
-
-
client.terminal().actions().get( GetActionsRequest .builder() .actionId("action_id") .build() );
-
βοΈ Parameters
-
-
actionId:
Stringβ Unique ID for the desiredTerminalAction.
-
-
client.terminal.actions.cancel(actionId) -> CancelTerminalActionResponse
-
π Description
-
-
Cancels a Terminal action request if the status of the request permits it.
-
π Usage
-
-
client.terminal().actions().cancel( CancelActionsRequest .builder() .actionId("action_id") .build() );
-
βοΈ Parameters
-
-
actionId:
Stringβ Unique ID for the desiredTerminalAction.
-
-
Terminal Checkouts
client.terminal.checkouts.create(request) -> CreateTerminalCheckoutResponse
-
π Description
-
-
Creates a Terminal checkout request and sends it to the specified device to take a payment for the requested amount.
-
π Usage
-
-
client.terminal().checkouts().create( CreateTerminalCheckoutRequest .builder() .idempotencyKey("28a0c3bc-7839-11ea-bc55-0242ac130003") .checkout( TerminalCheckout .builder() .amountMoney( Money .builder() .amount(2610L) .currency(Currency.USD) .build() ) .deviceOptions( DeviceCheckoutOptions .builder() .deviceId("dbb5d83a-7838-11ea-bc55-0242ac130003") .build() ) .referenceId("id11572") .note("A brief note") .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA unique string that identifies this
CreateCheckoutrequest. Keys can be any valid string but must be unique for everyCreateCheckoutrequest.See Idempotency keys for more information.
-
checkout:
TerminalCheckoutβ The checkout to create.
-
-
client.terminal.checkouts.search(request) -> SearchTerminalCheckoutsResponse
-
π Description
-
-
Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days.
-
π Usage
-
-
client.terminal().checkouts().search( SearchTerminalCheckoutsRequest .builder() .query( TerminalCheckoutQuery .builder() .filter( TerminalCheckoutQueryFilter .builder() .status("COMPLETED") .build() ) .build() ) .limit(2) .build() );
-
βοΈ Parameters
-
-
query:
Optional<TerminalCheckoutQuery>Queries Terminal checkouts based on given conditions and the sort order. Leaving these unset returns all checkouts with the default sort order.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. See Pagination for more information.
-
limit:
Optional<Integer>β Limits the number of results returned for a single request.
-
-
client.terminal.checkouts.get(checkoutId) -> GetTerminalCheckoutResponse
-
π Description
-
-
Retrieves a Terminal checkout request by
checkout_id. Terminal checkout requests are available for 30 days.
-
π Usage
-
-
client.terminal().checkouts().get( GetCheckoutsRequest .builder() .checkoutId("checkout_id") .build() );
-
βοΈ Parameters
-
-
checkoutId:
Stringβ The unique ID for the desiredTerminalCheckout.
-
-
client.terminal.checkouts.cancel(checkoutId) -> CancelTerminalCheckoutResponse
-
π Description
-
-
Cancels a Terminal checkout request if the status of the request permits it.
-
π Usage
-
-
client.terminal().checkouts().cancel( CancelCheckoutsRequest .builder() .checkoutId("checkout_id") .build() );
-
βοΈ Parameters
-
-
checkoutId:
Stringβ The unique ID for the desiredTerminalCheckout.
-
-
Terminal Refunds
client.terminal.refunds.create(request) -> CreateTerminalRefundResponse
-
π Description
-
-
Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see Refunds API.
-
π Usage
-
-
client.terminal().refunds().create( CreateTerminalRefundRequest .builder() .idempotencyKey("402a640b-b26f-401f-b406-46f839590c04") .refund( TerminalRefund .builder() .paymentId("5O5OvgkcNUhl7JBuINflcjKqUzXZY") .amountMoney( Money .builder() .amount(111L) .currency(Currency.CAD) .build() ) .reason("Returning items") .deviceId("f72dfb8e-4d65-4e56-aade-ec3fb8d33291") .build() ) .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
StringA unique string that identifies this
CreateRefundrequest. Keys can be any valid string but must be unique for everyCreateRefundrequest.See Idempotency keys for more information.
-
refund:
Optional<TerminalRefund>β The refund to create.
-
-
client.terminal.refunds.search(request) -> SearchTerminalRefundsResponse
-
π Description
-
-
Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.
-
π Usage
-
-
client.terminal().refunds().search( SearchTerminalRefundsRequest .builder() .query( TerminalRefundQuery .builder() .filter( TerminalRefundQueryFilter .builder() .status("COMPLETED") .build() ) .build() ) .limit(1) .build() );
-
βοΈ Parameters
-
-
query:
Optional<TerminalRefundQuery>Queries the Terminal refunds based on given conditions and the sort order. Calling
SearchTerminalRefundswithout an explicit query parameter returns all available refunds with the default sort order.
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query.
-
limit:
Optional<Integer>β Limits the number of results returned for a single request.
-
-
client.terminal.refunds.get(terminalRefundId) -> GetTerminalRefundResponse
-
π Description
-
-
Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days.
-
π Usage
-
-
client.terminal().refunds().get( GetRefundsRequest .builder() .terminalRefundId("terminal_refund_id") .build() );
-
βοΈ Parameters
-
-
terminalRefundId:
Stringβ The unique ID for the desiredTerminalRefund.
-
-
client.terminal.refunds.cancel(terminalRefundId) -> CancelTerminalRefundResponse
-
π Description
-
-
Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it.
-
π Usage
-
-
client.terminal().refunds().cancel( CancelRefundsRequest .builder() .terminalRefundId("terminal_refund_id") .build() );
-
βοΈ Parameters
-
-
terminalRefundId:
Stringβ The unique ID for the desiredTerminalRefund.
-
-
Webhooks EventTypes
client.webhooks.eventTypes.list() -> ListWebhookEventTypesResponse
-
π Description
-
-
Lists all webhook event types that can be subscribed to.
-
π Usage
-
-
client.webhooks().eventTypes().list( ListEventTypesRequest .builder() .apiVersion("api_version") .build() );
-
βοΈ Parameters
-
-
apiVersion:
Optional<String>β The API version for which to list event types. Setting this field overrides the default version used by the application.
-
-
Webhooks Subscriptions
client.webhooks.subscriptions.list() -> SyncPagingIterable<WebhookSubscription>
-
π Description
-
-
Lists all webhook subscriptions owned by your application.
-
π Usage
-
-
client.webhooks().subscriptions().list( ListSubscriptionsRequest .builder() .cursor("cursor") .includeDisabled(true) .sortOrder(SortOrder.DESC) .limit(1) .build() );
-
βοΈ Parameters
-
-
cursor:
Optional<String>A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query.
For more information, see Pagination.
-
includeDisabled:
Optional<Boolean>Includes disabled Subscriptions. By default, all enabled Subscriptions are returned.
-
sortOrder:
Optional<SortOrder>Sorts the returned list by when the Subscription was created with the specified order. This field defaults to ASC.
-
limit:
Optional<Integer>The maximum number of results to be returned in a single page. It is possible to receive fewer results than the specified limit on a given page. The default value of 100 is also the maximum allowed value.
Default: 100
-
-
client.webhooks.subscriptions.create(request) -> CreateWebhookSubscriptionResponse
-
π Description
-
-
Creates a webhook subscription.
-
π Usage
-
-
client.webhooks().subscriptions().create( CreateWebhookSubscriptionRequest .builder() .subscription( WebhookSubscription .builder() .name("Example Webhook Subscription") .eventTypes( Optional.of( Arrays.asList("payment.created", "payment.updated") ) ) .notificationUrl("https://example-webhook-url.com") .apiVersion("2021-12-15") .build() ) .idempotencyKey("63f84c6c-2200-4c99-846c-2670a1311fbf") .build() );
-
βοΈ Parameters
-
-
idempotencyKey:
Optional<String>β A unique string that identifies the CreateWebhookSubscription request.
-
subscription:
WebhookSubscriptionβ The Subscription to create.
-
-
client.webhooks.subscriptions.get(subscriptionId) -> GetWebhookSubscriptionResponse
-
π Description
-
-
Retrieves a webhook subscription identified by its ID.
-
π Usage
-
-
client.webhooks().subscriptions().get( GetSubscriptionsRequest .builder() .subscriptionId("subscription_id") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ [REQUIRED] The ID of the Subscription to retrieve.
-
-
client.webhooks.subscriptions.update(subscriptionId, request) -> UpdateWebhookSubscriptionResponse
-
π Description
-
-
Updates a webhook subscription.
-
π Usage
-
-
client.webhooks().subscriptions().update( UpdateWebhookSubscriptionRequest .builder() .subscriptionId("subscription_id") .subscription( WebhookSubscription .builder() .name("Updated Example Webhook Subscription") .enabled(false) .build() ) .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ [REQUIRED] The ID of the Subscription to update.
-
subscription:
Optional<WebhookSubscription>β The Subscription to update.
-
-
client.webhooks.subscriptions.delete(subscriptionId) -> DeleteWebhookSubscriptionResponse
-
π Description
-
-
Deletes a webhook subscription.
-
π Usage
-
-
client.webhooks().subscriptions().delete( DeleteSubscriptionsRequest .builder() .subscriptionId("subscription_id") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ [REQUIRED] The ID of the Subscription to delete.
-
-
client.webhooks.subscriptions.updateSignatureKey(subscriptionId, request) -> UpdateWebhookSubscriptionSignatureKeyResponse
-
π Description
-
-
Updates a webhook subscription by replacing the existing signature key with a new one.
-
π Usage
-
-
client.webhooks().subscriptions().updateSignatureKey( UpdateWebhookSubscriptionSignatureKeyRequest .builder() .subscriptionId("subscription_id") .idempotencyKey("ed80ae6b-0654-473b-bbab-a39aee89a60d") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ [REQUIRED] The ID of the Subscription to update.
-
idempotencyKey:
Optional<String>β A unique string that identifies the UpdateWebhookSubscriptionSignatureKey request.
-
-
client.webhooks.subscriptions.test(subscriptionId, request) -> TestWebhookSubscriptionResponse
-
π Description
-
-
Tests a webhook subscription by sending a test event to the notification URL.
-
π Usage
-
-
client.webhooks().subscriptions().test( TestWebhookSubscriptionRequest .builder() .subscriptionId("subscription_id") .eventType("payment.created") .build() );
-
βοΈ Parameters
-
-
subscriptionId:
Stringβ [REQUIRED] The ID of the Subscription to test.
-
eventType:
Optional<String>The event type that will be used to test the Subscription. The event type must be contained in the list of event types in the Subscription.
-
-