Skip to content

Latest commit

 

History

History
101 lines (61 loc) · 2.4 KB

api_customers.Customers.md

File metadata and controls

101 lines (61 loc) · 2.4 KB

@square/site-theme-sdk / Modules / api/customers / Customers

Class: Customers

api/customers.Customers

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Customers(initObj)

Parameters

Name Type
initObj InitConfig

Properties

initConfig

initConfig: InitConfig


buyersServiceClient

buyersServiceClient: BuyersServiceClient

Methods

getCoordinates

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
	}

Returns

Promise<GetCoordinatesResponse>

Throws

Error


getLoyaltyAccount

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
	}

Parameters

Name Type
request GetLoyaltyAccountRequest

Returns

Promise<GetLoyaltyAccountResponse | NoLoyaltyAccountResponse>

Throws

Error