@square/site-theme-sdk / Modules / api/customers / Customers
api/customers.Customers
• new Customers(initObj
)
Name | Type |
---|---|
initObj |
InitConfig |
• initConfig: InitConfig
• buyersServiceClient: BuyersServiceClient
▸ getCoordinates(): Promise
<GetCoordinatesResponse
>
Used to try and get the coordinates of the buyer based on their IP address. If the coordinates can't be determined, this method returns an empty object.
try {
const coordinates = await sdk.customers.getCoordinates();
} catch (error) {
// Handle errors
}
Promise
<GetCoordinatesResponse
>
Throws
Error
▸ getLoyaltyAccount(request
): Promise
<GetLoyaltyAccountResponse
| NoLoyaltyAccountResponse
>
Search for an existing customer loyalty account by phone number. If no loyalty account exists, this method returns an empty object.
try {
const loyaltyAccount = await sdk.customers.getLoyaltyAccount();
} catch (error) {
// Handle errors
}
Name | Type |
---|---|
request |
GetLoyaltyAccountRequest |
Promise
<GetLoyaltyAccountResponse
| NoLoyaltyAccountResponse
>
Throws
Error