@bigcommerce/checkout-sdk / CheckoutStoreSelector
Responsible for getting the state of the current checkout.
This object has a set of methods that allow you to get a specific piece of checkout information, such as shipping and billing details.
- getBillingAddress
- getBillingAddressFields
- getBillingCountries
- getCart
- getCheckout
- getConfig
- getConsignments
- getCoupons
- getCustomer
- getCustomerAccountFields
- getExtensionByRegion
- getExtensions
- getFlashMessages
- getGiftCertificates
- getInstruments
- getOrder
- getPaymentMethod
- getPaymentMethods
- getPaymentProviderCustomer
- getPickupOptions
- getSelectedPaymentMethod
- getSelectedShippingOption
- getShippingAddress
- getShippingAddressFields
- getShippingCountries
- getShippingOptions
- getSignInEmail
- getUserExperienceSettings
- isPaymentDataRequired
- isPaymentDataSubmitted
▸ getBillingAddress(): undefined
| BillingAddress
Gets the billing address of an order.
undefined
| BillingAddress
The billing address object if it is loaded, otherwise undefined.
▸ getBillingAddressFields(countryCode
): FormField
[]
Gets a set of form fields that should be presented to customers in order to capture their billing address for a specific country.
Name | Type | Description |
---|---|---|
countryCode |
string |
A 2-letter country code (ISO 3166-1 alpha-2). |
The set of billing address form fields if it is loaded, otherwise undefined.
▸ getBillingCountries(): undefined
| Country
[]
Gets a list of countries available for billing.
undefined
| Country
[]
The list of countries if it is loaded, otherwise undefined.
▸ getCart(): undefined
| Cart
Gets the current cart.
undefined
| Cart
The current cart object if it is loaded, otherwise undefined.
▸ getCheckout(): undefined
| Checkout
Gets the current checkout.
undefined
| Checkout
The current checkout if it is loaded, otherwise undefined.
▸ getConfig(): undefined
| StoreConfig
Gets the checkout configuration of a store.
undefined
| StoreConfig
The configuration object if it is loaded, otherwise undefined.
▸ getConsignments(): undefined
| Consignment
[]
Gets a list of consignments.
If there are no consignments created for to the current checkout, the list will be empty.
undefined
| Consignment
[]
The list of consignments if any, otherwise undefined.
▸ getCoupons(): undefined
| Coupon
[]
Gets a list of coupons that are applied to the current checkout.
undefined
| Coupon
[]
The list of applied coupons if there is any, otherwise undefined.
▸ getCustomer(): undefined
| Customer
Gets the current customer.
undefined
| Customer
The current customer object if it is loaded, otherwise undefined.
▸ getCustomerAccountFields(): FormField
[]
Gets a set of form fields that should be presented in order to create a customer.
The set of customer account form fields if it is loaded, otherwise undefined.
▸ getExtensionByRegion(region
): undefined
| Extension
Gets the extension associated with a given region.
alpha
Name | Type | Description |
---|---|---|
region |
ExtensionRegion |
A checkout extension region. |
undefined
| Extension
The extension corresponding to the specified region, otherwise undefined.
▸ getExtensions(): undefined
| Extension
[]
Gets a list of extensions available for checkout.
alpha
undefined
| Extension
[]
The list of extensions if it is loaded, otherwise undefined.
▸ getFlashMessages(type?
): undefined
| FlashMessage
[]
Gets the available flash messages.
Flash messages contain messages set by the server, e.g: when trying to sign in using an invalid email link.
Name | Type | Description |
---|---|---|
type? |
"error" | "info" | "warning" | "success" |
The type of flash messages to be returned. Optional |
undefined
| FlashMessage
[]
The flash messages if available, otherwise undefined.
▸ getGiftCertificates(): undefined
| GiftCertificate
[]
Gets a list of gift certificates that are applied to the current checkout.
undefined
| GiftCertificate
[]
The list of applied gift certificates if there is any, otherwise undefined.
▸ getInstruments(): undefined
| CardInstrument
[]
Gets a list of payment instruments associated with the current customer.
undefined
| CardInstrument
[]
The list of payment instruments if it is loaded, otherwise undefined.
▸ getInstruments(paymentMethod
): undefined
| PaymentInstrument
[]
Name | Type |
---|---|
paymentMethod |
PaymentMethod <any > |
undefined
| PaymentInstrument
[]
▸ getOrder(): undefined
| Order
Gets the current order.
undefined
| Order
The current order if it is loaded, otherwise undefined.
▸ getPaymentMethod(methodId
, gatewayId?
): undefined
| PaymentMethod
<any
>
Gets a payment method by an id.
The method returns undefined if unable to find a payment method with the specified id, either because it is not available for the customer, or it is not loaded.
Name | Type | Description |
---|---|---|
methodId |
string |
The identifier of the payment method. |
gatewayId? |
string |
The identifier of a payment provider providing the payment method. |
undefined
| PaymentMethod
<any
>
The payment method object if loaded and available, otherwise, undefined.
▸ getPaymentMethods(): undefined
| PaymentMethod
<any
>[]
Gets a list of payment methods available for checkout.
undefined
| PaymentMethod
<any
>[]
The list of payment methods if it is loaded, otherwise undefined.
▸ getPaymentProviderCustomer(): undefined
| BraintreeAcceleratedCheckoutCustomer
Gets payment provider customers data.
alpha
undefined
| BraintreeAcceleratedCheckoutCustomer
The object with payment provider customer data
▸ getPickupOptions(consignmentId
, searchArea
): undefined
| PickupOptionResult
[]
Gets a list of pickup options for specified parameters.
Name | Type | Description |
---|---|---|
consignmentId |
string |
Id of consignment. |
searchArea |
SearchArea |
An object containing of radius and co-ordinates. |
undefined
| PickupOptionResult
[]
The set of shipping address form fields if it is loaded, otherwise undefined.
▸ getSelectedPaymentMethod(): undefined
| PaymentMethod
<any
>
Gets the payment method that is selected for checkout.
undefined
| PaymentMethod
<any
>
The payment method object if there is a selected method; undefined if otherwise.
▸ getSelectedShippingOption(): undefined
| ShippingOption
Gets the selected shipping option for the current checkout.
undefined
| ShippingOption
The shipping option object if there is a selected option, otherwise undefined.
▸ getShippingAddress(): undefined
| Address
Gets the shipping address of the current checkout.
If the address is partially complete, it may not have shipping options associated with it.
undefined
| Address
The shipping address object if it is loaded, otherwise undefined.
▸ getShippingAddressFields(countryCode
): FormField
[]
Gets a set of form fields that should be presented to customers in order to capture their shipping address for a specific country.
Name | Type | Description |
---|---|---|
countryCode |
string |
A 2-letter country code (ISO 3166-1 alpha-2). |
The set of shipping address form fields if it is loaded, otherwise undefined.
▸ getShippingCountries(): undefined
| Country
[]
Gets a list of countries available for shipping.
undefined
| Country
[]
The list of countries if it is loaded, otherwise undefined.
▸ getShippingOptions(): undefined
| ShippingOption
[]
Gets a list of shipping options available for the shipping address.
If there is no shipping address assigned to the current checkout, the list of shipping options will be empty.
undefined
| ShippingOption
[]
The list of shipping options if any, otherwise undefined.
▸ getSignInEmail(): undefined
| SignInEmail
Gets the sign-in email.
undefined
| SignInEmail
The sign-in email object if sent, otherwise undefined
▸ getUserExperienceSettings(): undefined
| UserExperienceSettings
Gets user experience settings.
undefined
| UserExperienceSettings
The object of user experience settings if it is loaded, otherwise undefined.
▸ isPaymentDataRequired(useStoreCredit?
): boolean
Checks if payment data is required or not.
If payment data is required, customers should be prompted to enter their payment details.
if (state.checkout.isPaymentDataRequired()) {
// Render payment form
} else {
// Render "Payment is not required for this order" message
}
Name | Type | Description |
---|---|---|
useStoreCredit? |
boolean |
If true, check whether payment data is required with store credit applied; otherwise, check without store credit. |
boolean
True if payment data is required, otherwise false.
▸ isPaymentDataSubmitted(methodId
, gatewayId?
): boolean
Checks if payment data is submitted or not.
If payment data is already submitted using a payment method, customers should not be prompted to enter their payment details again.
Name | Type | Description |
---|---|---|
methodId |
string |
The identifier of the payment method. |
gatewayId? |
string |
The identifier of a payment provider providing the payment method. |
boolean
True if payment data is submitted, otherwise false.