Buyer IdentityAPI
The API for interacting with the buyer identity.
Anchor to standardapiStandardApi
The base API object provided to purchase
extension targets.
- Anchor to buyerIdentitybuyerIdentity
Information about the buyer that is interacting with the checkout.
Requires access to protected customer data.
Docs_Standard_BuyerIdentityApi
- buyerIdentity
Information about the buyer that is interacting with the checkout. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
BuyerIdentity
export interface Docs_Standard_BuyerIdentityApi
extends Pick<StandardApi, 'buyerIdentity'> {}
BuyerIdentity
- customer
The buyer's customer account. The value is undefined if the buyer isn’t a known customer for this shop or if they haven't logged in yet. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
StatefulRemoteSubscribable<Customer | undefined>
- email
The email address of the buyer that is interacting with the cart. The value is `undefined` if the app does not have access to customer data. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
StatefulRemoteSubscribable<string | undefined>
- phone
The phone number of the buyer that is interacting with the cart. The value is `undefined` if the app does not have access to customer data. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
StatefulRemoteSubscribable<string | undefined>
- purchasingCompany
Provides details of the company and the company location that the business customer is purchasing on behalf of. This includes information that can be used to identify the company and the company location that the business customer belongs to. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
StatefulRemoteSubscribable<PurchasingCompany | undefined>
export interface BuyerIdentity {
/**
* The buyer's customer account. The value is undefined if the buyer isn’t a
* known customer for this shop or if they haven't logged in yet.
*
* {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
customer: StatefulRemoteSubscribable<Customer | undefined>;
/**
* The email address of the buyer that is interacting with the cart.
* The value is `undefined` if the app does not have access to customer data.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
email: StatefulRemoteSubscribable<string | undefined>;
/**
* The phone number of the buyer that is interacting with the cart.
* The value is `undefined` if the app does not have access to customer data.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
phone: StatefulRemoteSubscribable<string | undefined>;
/**
* Provides details of the company and the company location that the business customer is purchasing on behalf of.
* This includes information that can be used to identify the company and the company location that the business
* customer belongs to.
*
* {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
purchasingCompany: StatefulRemoteSubscribable<PurchasingCompany | undefined>;
}
Customer
Information about a customer who has previously purchased from this shop. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
- acceptsEmailMarketing
Defines if the customer accepts email marketing activities. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
boolean
- acceptsMarketing
Defines if the customer email accepts marketing activities. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). > Caution: This field is deprecated and will be removed in a future version. Use `acceptsEmailMarketing` or `acceptsSmsMarketing` instead.
boolean
- acceptsSmsMarketing
Defines if the customer accepts SMS marketing activities. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
boolean
- email
The email of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- firstName
The first name of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- fullName
The full name of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- id
Customer ID. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- image
The image associated with the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
ImageDetails
- lastName
The last name of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- ordersCount
The number of previous orders made by this customer. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
number
- phone
The phone number of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- storeCreditAccounts
The Store Credit Accounts owned by the customer and usable during the checkout process. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
StoreCreditAccount[]
export interface Customer {
/**
* Customer ID.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*
* @example 'gid://shopify/Customer/123'
*/
id: string;
/**
* The email of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
email?: string;
/**
* The phone number of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
phone?: string;
/**
* The full name of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
fullName?: string;
/**
* The first name of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
firstName?: string;
/**
* The last name of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
lastName?: string;
/**
* The image associated with the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
image: ImageDetails;
/**
* Defines if the customer email accepts marketing activities.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*
* > Caution: This field is deprecated and will be removed in a future version. Use `acceptsEmailMarketing` or `acceptsSmsMarketing` instead.
*
* @deprecated Use `acceptsEmailMarketing` or `acceptsSmsMarketing` instead.
*/
acceptsMarketing: boolean;
/**
* Defines if the customer accepts email marketing activities.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
acceptsEmailMarketing: boolean;
/**
* Defines if the customer accepts SMS marketing activities.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
acceptsSmsMarketing: boolean;
/**
* The Store Credit Accounts owned by the customer and usable during the checkout process.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*
* @private
*/
storeCreditAccounts: StoreCreditAccount[];
/**
* The number of previous orders made by this customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
ordersCount: number;
}
ImageDetails
- altText
The alternative text for the image.
string
- url
The image URL.
string
export interface ImageDetails {
/**
* The image URL.
*/
url: string;
/**
* The alternative text for the image.
*/
altText?: string;
}
StoreCreditAccount
Information about a Store Credit Account.
- balance
The current balance of the Store Credit Account.
Money
- id
A globally-unique identifier.
string
export interface StoreCreditAccount {
/**
* A globally-unique identifier.
* @example 'gid://shopify/StoreCreditAccount/1'
*/
id: string;
/**
* The current balance of the Store Credit Account.
*/
balance: Money;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: CurrencyCode;
}
CurrencyCode
'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL'
PurchasingCompany
The information about a company that the business customer is purchasing on behalf of.
- company
Includes information of the company that the business customer is purchasing on behalf of. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
Company
- location
Includes information of the company location that the business customer is purchasing on behalf of. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
CompanyLocation
export interface PurchasingCompany {
/**
* Includes information of the company that the business customer is purchasing on behalf of.
*
* {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
company: Company;
/**
* Includes information of the company location that the business customer is purchasing on behalf of.
*
* {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
location: CompanyLocation;
}
Company
- externalId
The external ID of the company that can be set by the merchant. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- id
The company ID. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The name of the company. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface Company {
/**
* The company ID.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
id: string;
/**
* The name of the company.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
name: string;
/**
* The external ID of the company that can be set by the merchant.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
externalId?: string;
}
CompanyLocation
- externalId
The external ID of the company location that can be set by the merchant. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- id
The company location ID. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The name of the company location. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface CompanyLocation {
/**
* The company location ID.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
id: string;
/**
* The name of the company location.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
name: string;
/**
* The external ID of the company location that can be set by the merchant.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
externalId?: string;
}
Anchor to useCustomeruse Customer()
Returns the current Customer
. The value is undefined
if the buyer isn't a known customer for this shop or if they haven't logged in yet.
UseCustomerGeneratedType
Returns the current `Customer`. The value is `undefined` if the buyer isn't a known customer for this shop or if they haven't logged in yet.
Customer | undefined
export function useCustomer<
Target extends RenderExtensionTarget = RenderExtensionTarget,
>(): Customer | undefined {
const buyerIdentity = useApi<Target>().buyerIdentity;
if (!buyerIdentity) {
throw new ScopeNotGrantedError(
'Using buyer identity requires having personal customer data permissions granted to your app.',
);
}
return useSubscription(buyerIdentity.customer);
}
Customer
Information about a customer who has previously purchased from this shop. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
- acceptsEmailMarketing
Defines if the customer accepts email marketing activities. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
boolean
- acceptsMarketing
Defines if the customer email accepts marketing activities. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). > Caution: This field is deprecated and will be removed in a future version. Use `acceptsEmailMarketing` or `acceptsSmsMarketing` instead.
boolean
- acceptsSmsMarketing
Defines if the customer accepts SMS marketing activities. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
boolean
- email
The email of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- firstName
The first name of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- fullName
The full name of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- id
Customer ID. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- image
The image associated with the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
ImageDetails
- lastName
The last name of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- ordersCount
The number of previous orders made by this customer. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
number
- phone
The phone number of the customer. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- storeCreditAccounts
The Store Credit Accounts owned by the customer and usable during the checkout process. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
StoreCreditAccount[]
export interface Customer {
/**
* Customer ID.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*
* @example 'gid://shopify/Customer/123'
*/
id: string;
/**
* The email of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
email?: string;
/**
* The phone number of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
phone?: string;
/**
* The full name of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
fullName?: string;
/**
* The first name of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
firstName?: string;
/**
* The last name of the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
lastName?: string;
/**
* The image associated with the customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
image: ImageDetails;
/**
* Defines if the customer email accepts marketing activities.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*
* > Caution: This field is deprecated and will be removed in a future version. Use `acceptsEmailMarketing` or `acceptsSmsMarketing` instead.
*
* @deprecated Use `acceptsEmailMarketing` or `acceptsSmsMarketing` instead.
*/
acceptsMarketing: boolean;
/**
* Defines if the customer accepts email marketing activities.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
acceptsEmailMarketing: boolean;
/**
* Defines if the customer accepts SMS marketing activities.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
acceptsSmsMarketing: boolean;
/**
* The Store Credit Accounts owned by the customer and usable during the checkout process.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*
* @private
*/
storeCreditAccounts: StoreCreditAccount[];
/**
* The number of previous orders made by this customer.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
ordersCount: number;
}
ImageDetails
- altText
The alternative text for the image.
string
- url
The image URL.
string
export interface ImageDetails {
/**
* The image URL.
*/
url: string;
/**
* The alternative text for the image.
*/
altText?: string;
}
StoreCreditAccount
Information about a Store Credit Account.
- balance
The current balance of the Store Credit Account.
Money
- id
A globally-unique identifier.
string
export interface StoreCreditAccount {
/**
* A globally-unique identifier.
* @example 'gid://shopify/StoreCreditAccount/1'
*/
id: string;
/**
* The current balance of the Store Credit Account.
*/
balance: Money;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: CurrencyCode;
}
CurrencyCode
'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL'
Anchor to useEmailuse Email()
Returns the email address of the buyer that is interacting with the cart. The value is undefined
if the app does not have access to customer data.
Anchor to useEmail-returnsReturns
UseEmailGeneratedType
Returns the email address of the buyer that is interacting with the cart. The value is `undefined` if the app does not have access to customer data.
string | undefined
export function useEmail<
Target extends RenderExtensionTarget = RenderExtensionTarget,
>(): string | undefined {
const buyerIdentity = useApi<Target>().buyerIdentity;
if (!buyerIdentity) {
throw new ScopeNotGrantedError(
'Using buyer identity requires having personal customer data permissions granted to your app.',
);
}
return useSubscription(buyerIdentity.email);
}
Anchor to usePhoneuse Phone()
Returns the phone number of the buyer that is interacting with the cart. The value is undefined
if the app does not have access to customer data.
Anchor to usePhone-returnsReturns
UsePhoneGeneratedType
Returns the phone number of the buyer that is interacting with the cart. The value is `undefined` if the app does not have access to customer data.
string | undefined
export function usePhone<
Target extends RenderExtensionTarget = RenderExtensionTarget,
>(): string | undefined {
const buyerIdentity = useApi<Target>().buyerIdentity;
if (!buyerIdentity) {
throw new ScopeNotGrantedError(
'Using buyer identity requires having personal customer data permissions granted to your app.',
);
}
return useSubscription(buyerIdentity.phone);
}
Anchor to usePurchasingCompanyuse Purchasing Company()
Provides information about the company and its location that the business customer is purchasing on behalf of during a B2B checkout. It includes details that can be utilized to identify both the company and its corresponding location to which the business customer belongs.
The value is undefined
if a business customer isn't logged in. This function throws an error if the app doesn't have access to customer data.
UsePurchasingCompanyGeneratedType
Provides information about the company and its location that the business customer is purchasing on behalf of during a B2B checkout. It includes details that can be utilized to identify both the company and its corresponding location to which the business customer belongs. The value is `undefined` if a business customer isn't logged in. This function throws an error if the app doesn't have access to customer data.
PurchasingCompany | undefined
export function usePurchasingCompany<
Target extends RenderExtensionTarget = RenderExtensionTarget,
>(): PurchasingCompany | undefined {
const buyerIdentity = useApi<Target>().buyerIdentity;
if (!buyerIdentity) {
throw new ScopeNotGrantedError(
'Using buyer identity requires having personal customer data permissions granted to your app.',
);
}
return useSubscription(buyerIdentity.purchasingCompany);
}
PurchasingCompany
The information about a company that the business customer is purchasing on behalf of.
- company
Includes information of the company that the business customer is purchasing on behalf of. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
Company
- location
Includes information of the company location that the business customer is purchasing on behalf of. {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
CompanyLocation
export interface PurchasingCompany {
/**
* Includes information of the company that the business customer is purchasing on behalf of.
*
* {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
company: Company;
/**
* Includes information of the company location that the business customer is purchasing on behalf of.
*
* {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
location: CompanyLocation;
}
Company
- externalId
The external ID of the company that can be set by the merchant. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- id
The company ID. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The name of the company. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface Company {
/**
* The company ID.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
id: string;
/**
* The name of the company.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
name: string;
/**
* The external ID of the company that can be set by the merchant.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
externalId?: string;
}
CompanyLocation
- externalId
The external ID of the company location that can be set by the merchant. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- id
The company location ID. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The name of the company location. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface CompanyLocation {
/**
* The company location ID.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
id: string;
/**
* The name of the company location.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
name: string;
/**
* The external ID of the company location that can be set by the merchant.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
*/
externalId?: string;
}