(account)
Use the Accounts API to access shoppers' accounts to empower your checkout and facilitate shoppers' choices.
- getDetails - Retrieve account details
- addAddress - Add an address
- updateAddress - Edit an existing address
- deleteAddress - Delete an existing address
- addPaymentMethod - Add a payment method
- deletePaymentMethod - Delete an existing payment method
Retrieve a shopper's account details, such as addresses and payment information. The account's details are filtered to be relevant to your merchant account, and some fields may be missing for some accounts. See the schema for details.
import { BoltTypescriptSDK } from "@boltpay/bolt-typescript-sdk";
const boltTypescriptSDK = new BoltTypescriptSDK({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await boltTypescriptSDK.account.getDetails("<value>", "<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { BoltTypescriptSDKCore } from "@boltpay/bolt-typescript-sdk/core.js";
import { accountGetDetails } from "@boltpay/bolt-typescript-sdk/funcs/accountGetDetails.js";
// Use `BoltTypescriptSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const boltTypescriptSDK = new BoltTypescriptSDKCore({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await accountGetDetails(boltTypescriptSDK, "<value>", "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
xPublishableKey |
string | ✔️ | The publicly shareable identifier used to identify your Bolt merchant division. |
xMerchantClientId |
string | ➖ | A unique identifier for a shopper's device, generated by Bolt. The value is retrieved with Bolt.state.merchantClientId in your frontend context, per-shopper. This header is required for proper attribution of this operation to your analytics reports. Omitting this header may result in incorrect statistics. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountGetResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 4XX | application/json |
errors.FieldError | 4XX | application/json |
errors.SDKError | 5XX | */* |
Add an address to the shopper's account
import { BoltTypescriptSDK } from "@boltpay/bolt-typescript-sdk";
import { CountryCode } from "@boltpay/bolt-typescript-sdk/models/components";
const boltTypescriptSDK = new BoltTypescriptSDK({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await boltTypescriptSDK.account.addAddress({
firstName: "Alice",
lastName: "Baker",
company: "ACME Corporation",
streetAddress1: "535 Mission St, Ste 1401",
streetAddress2: "c/o Shipping Department",
locality: "San Francisco",
postalCode: "94105",
region: "CA",
countryCode: CountryCode.Us,
email: "[email protected]",
phone: "+14155550199",
}, "<value>", "<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { BoltTypescriptSDKCore } from "@boltpay/bolt-typescript-sdk/core.js";
import { accountAddAddress } from "@boltpay/bolt-typescript-sdk/funcs/accountAddAddress.js";
import { CountryCode } from "@boltpay/bolt-typescript-sdk/models/components";
// Use `BoltTypescriptSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const boltTypescriptSDK = new BoltTypescriptSDKCore({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await accountAddAddress(boltTypescriptSDK, {
firstName: "Alice",
lastName: "Baker",
company: "ACME Corporation",
streetAddress1: "535 Mission St, Ste 1401",
streetAddress2: "c/o Shipping Department",
locality: "San Francisco",
postalCode: "94105",
region: "CA",
countryCode: CountryCode.Us,
email: "[email protected]",
phone: "+14155550199",
}, "<value>", "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
xPublishableKey |
string | ✔️ | The publicly shareable identifier used to identify your Bolt merchant division. |
addressListing |
components.AddressListingInput | ✔️ | N/A |
xMerchantClientId |
string | ➖ | A unique identifier for a shopper's device, generated by Bolt. The value is retrieved with Bolt.state.merchantClientId in your frontend context, per-shopper. This header is required for proper attribution of this operation to your analytics reports. Omitting this header may result in incorrect statistics. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountAddressCreateResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 4XX | application/json |
errors.FieldError | 4XX | application/json |
errors.SDKError | 5XX | */* |
Edit an existing address on the shopper's account. This does not edit addresses that are already associated with other resources, such as transactions or shipments.
import { BoltTypescriptSDK } from "@boltpay/bolt-typescript-sdk";
import { CountryCode } from "@boltpay/bolt-typescript-sdk/models/components";
const boltTypescriptSDK = new BoltTypescriptSDK({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await boltTypescriptSDK.account.updateAddress({
firstName: "Alice",
lastName: "Baker",
company: "ACME Corporation",
streetAddress1: "535 Mission St, Ste 1401",
streetAddress2: "c/o Shipping Department",
locality: "San Francisco",
postalCode: "94105",
region: "CA",
countryCode: CountryCode.Us,
email: "[email protected]",
phone: "+14155550199",
}, "D4g3h5tBuVYK9", "<value>", "<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { BoltTypescriptSDKCore } from "@boltpay/bolt-typescript-sdk/core.js";
import { accountUpdateAddress } from "@boltpay/bolt-typescript-sdk/funcs/accountUpdateAddress.js";
import { CountryCode } from "@boltpay/bolt-typescript-sdk/models/components";
// Use `BoltTypescriptSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const boltTypescriptSDK = new BoltTypescriptSDKCore({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await accountUpdateAddress(boltTypescriptSDK, {
firstName: "Alice",
lastName: "Baker",
company: "ACME Corporation",
streetAddress1: "535 Mission St, Ste 1401",
streetAddress2: "c/o Shipping Department",
locality: "San Francisco",
postalCode: "94105",
region: "CA",
countryCode: CountryCode.Us,
email: "[email protected]",
phone: "+14155550199",
}, "D4g3h5tBuVYK9", "<value>", "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | The ID of the address to edit | [object Object] |
xPublishableKey |
string | ✔️ | The publicly shareable identifier used to identify your Bolt merchant division. | |
addressListing |
components.AddressListingInput | ✔️ | N/A | |
xMerchantClientId |
string | ➖ | A unique identifier for a shopper's device, generated by Bolt. The value is retrieved with Bolt.state.merchantClientId in your frontend context, per-shopper. This header is required for proper attribution of this operation to your analytics reports. Omitting this header may result in incorrect statistics. |
|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
|
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountAddressEditResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 4XX | application/json |
errors.FieldError | 4XX | application/json |
errors.SDKError | 5XX | */* |
Delete an existing address. Deleting an address does not invalidate or remove the address from transactions or shipments that are associated with it.
import { BoltTypescriptSDK } from "@boltpay/bolt-typescript-sdk";
const boltTypescriptSDK = new BoltTypescriptSDK({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await boltTypescriptSDK.account.deleteAddress("D4g3h5tBuVYK9", "<value>", "<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { BoltTypescriptSDKCore } from "@boltpay/bolt-typescript-sdk/core.js";
import { accountDeleteAddress } from "@boltpay/bolt-typescript-sdk/funcs/accountDeleteAddress.js";
// Use `BoltTypescriptSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const boltTypescriptSDK = new BoltTypescriptSDKCore({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await accountDeleteAddress(boltTypescriptSDK, "D4g3h5tBuVYK9", "<value>", "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | The ID of the address to delete | [object Object] |
xPublishableKey |
string | ✔️ | The publicly shareable identifier used to identify your Bolt merchant division. | |
xMerchantClientId |
string | ➖ | A unique identifier for a shopper's device, generated by Bolt. The value is retrieved with Bolt.state.merchantClientId in your frontend context, per-shopper. This header is required for proper attribution of this operation to your analytics reports. Omitting this header may result in incorrect statistics. |
|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
|
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountAddressDeleteResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 4XX | application/json |
errors.FieldError | 4XX | application/json |
errors.SDKError | 5XX | */* |
Add a payment method to a shopper's Bolt Account Wallet. For security purposes, this request must come from your backend.
Note: Before using this API, the credit card details must be tokenized by Bolt's credit card tokenization service. Please review our Bolt Payment Field Component or Install the Bolt Tokenizer documentation.
import { BoltTypescriptSDK } from "@boltpay/bolt-typescript-sdk";
import { AddressReferenceIdTag, CreditCardNetwork, DotTag } from "@boltpay/bolt-typescript-sdk/models/components";
const boltTypescriptSDK = new BoltTypescriptSDK({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await boltTypescriptSDK.account.addPaymentMethod({
dotTag: DotTag.CreditCard,
billingAddress: {
dotTag: AddressReferenceIdTag.Id,
id: "D4g3h5tBuVYK9",
},
network: CreditCardNetwork.Visa,
bin: "411111",
last4: "1004",
expiration: "2025-03",
token: "a1B2c3D4e5F6G7H8i9J0k1L2m3N4o5P6Q7r8S9t0",
}, "<value>", "<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { BoltTypescriptSDKCore } from "@boltpay/bolt-typescript-sdk/core.js";
import { accountAddPaymentMethod } from "@boltpay/bolt-typescript-sdk/funcs/accountAddPaymentMethod.js";
import { AddressReferenceIdTag, CreditCardNetwork, DotTag } from "@boltpay/bolt-typescript-sdk/models/components";
// Use `BoltTypescriptSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const boltTypescriptSDK = new BoltTypescriptSDKCore({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await accountAddPaymentMethod(boltTypescriptSDK, {
dotTag: DotTag.CreditCard,
billingAddress: {
dotTag: AddressReferenceIdTag.Id,
id: "D4g3h5tBuVYK9",
},
network: CreditCardNetwork.Visa,
bin: "411111",
last4: "1004",
expiration: "2025-03",
token: "a1B2c3D4e5F6G7H8i9J0k1L2m3N4o5P6Q7r8S9t0",
}, "<value>", "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
xPublishableKey |
string | ✔️ | The publicly shareable identifier used to identify your Bolt merchant division. |
paymentMethod |
components.PaymentMethodInput | ✔️ | N/A |
xMerchantClientId |
string | ➖ | A unique identifier for a shopper's device, generated by Bolt. The value is retrieved with Bolt.state.merchantClientId in your frontend context, per-shopper. This header is required for proper attribution of this operation to your analytics reports. Omitting this header may result in incorrect statistics. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountAddPaymentMethodResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 4XX | application/json |
errors.FieldError | 4XX | application/json |
errors.CreditCardError | 4XX | application/json |
errors.SDKError | 5XX | */* |
Delete an existing payment method. Deleting a payment method does not invalidate or remove it from transactions or orders that are associated with it.
import { BoltTypescriptSDK } from "@boltpay/bolt-typescript-sdk";
const boltTypescriptSDK = new BoltTypescriptSDK({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await boltTypescriptSDK.account.deletePaymentMethod("D4g3h5tBuVYK9", "<value>", "<value>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { BoltTypescriptSDKCore } from "@boltpay/bolt-typescript-sdk/core.js";
import { accountDeletePaymentMethod } from "@boltpay/bolt-typescript-sdk/funcs/accountDeletePaymentMethod.js";
// Use `BoltTypescriptSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const boltTypescriptSDK = new BoltTypescriptSDKCore({
security: {
oauth: "<YOUR_OAUTH_HERE>",
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await accountDeletePaymentMethod(boltTypescriptSDK, "D4g3h5tBuVYK9", "<value>", "<value>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | The ID of the payment method to delete | [object Object] |
xPublishableKey |
string | ✔️ | The publicly shareable identifier used to identify your Bolt merchant division. | |
xMerchantClientId |
string | ➖ | A unique identifier for a shopper's device, generated by Bolt. The value is retrieved with Bolt.state.merchantClientId in your frontend context, per-shopper. This header is required for proper attribution of this operation to your analytics reports. Omitting this header may result in incorrect statistics. |
|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
|
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.AccountPaymentMethodDeleteResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.ErrorT | 4XX | application/json |
errors.FieldError | 4XX | application/json |
errors.SDKError | 5XX | */* |