Skip to main content

Class: PayVault

Constructors​

constructor​

• new PayVault(«destructured»)

Constructs a new PayVault client.

Parameters​

NameType
«destructured»PayVaultConstructorProps

Defined in​

PayVault.ts:32

Properties​

endpoint​

• endpoint: string

Defined in​

PayVault.ts:19


storeId​

• storeId: string

Defined in​

PayVault.ts:20

Accessors​

headers​

• get headers(): Object

Returns the headers required for API requests, given the current class variables.

Returns​

Object

NameType
Content-Typestring
x-api-Keystring

Defined in​

PayVault.ts:42

Methods​

createApiKey​

▸ createApiKey(): Promise<ApiKey>

Creates a new API key.

Returns​

Promise<ApiKey>

A promise that resolves to the created API key.

Defined in​

PayVault.ts:249


createCart​

▸ createCart(cartContent): Promise<CreateCartResponse>

Parameters​

NameType
cartContentCreateCartRequest

Returns​

Promise<CreateCartResponse>

Defined in​

PayVault.ts:160


createProduct​

▸ createProduct(productDetails): Promise<any>

Creates a new product with the provided details.

Parameters​

NameTypeDescription
productDetailsProductCreateRequestAn object containing the product details.

Returns​

Promise<any>

A promise that resolves when the product is created.

Defined in​

PayVault.ts:176


deleteApiKey​

▸ deleteApiKey(key): Promise<ApiKey>

Deletes the API key with the provided key.

Parameters​

NameTypeDescription
keystringThe key of the API key to delete.

Returns​

Promise<ApiKey>

A promise that resolves when the API key is deleted.

Defined in​

PayVault.ts:282


deleteApiKeys​

▸ deleteApiKeys(keys): Promise<ApiKey[]>

Deletes multiple API keys with the provided keys.

Parameters​

NameTypeDescription
keysstring[]An array of API keys to delete.

Returns​

Promise<ApiKey[]>

A promise that resolves when all API keys are deleted.

Defined in​

PayVault.ts:293


deleteProduct​

▸ deleteProduct(productId): Promise<any>

Deletes the product with the provided product ID.

Parameters​

NameTypeDescription
productIdstring | numberThe ID of the product to delete.

Returns​

Promise<any>

A promise that resolves when the product is deleted.

Defined in​

PayVault.ts:222


deleteProducts​

▸ deleteProducts(productIds): Promise<any>

Deletes multiple products with the provided product IDs.

Parameters​

NameTypeDescription
productIds(string | number)[]An array of product IDs to delete.

Returns​

Promise<any>

A promise that resolves when all products are deleted.

Defined in​

PayVault.ts:233


deleteStore​

▸ deleteStore(): Promise<any>

Deletes the store with the provided store ID.

Returns​

Promise<any>

A promise that resolves when the store is deleted.

Defined in​

PayVault.ts:150


getApiKey​

▸ getApiKey(key): Promise<ApiKey>

Retrieves the API key information for the provided key.

Parameters​

NameTypeDescription
keystringThe API key to retrieve information for.

Returns​

Promise<ApiKey>

A promise that resolves to the API key details.

Defined in​

PayVault.ts:261


getProductInfo​

▸ getProductInfo(productId): Promise<Product>

Retrieves the product information for the provided product ID.

Parameters​

NameTypeDescription
productIdstring | numberThe ID of the product.

Returns​

Promise<Product>

A promise that resolves to the product details.

Defined in​

PayVault.ts:201


getStoreInfo​

▸ getStoreInfo(): Promise<StoreDetails>

Retrieves the store information for the provided store ID.

Returns​

Promise<StoreDetails>

A promise that resolves to the store details.

Defined in​

PayVault.ts:103


listApiKey​

▸ listApiKey(): Promise<ApiKey[]>

Lists all API keys for the current store.

Returns​

Promise<ApiKey[]>

A promise that resolves to an array of API keys.

Defined in​

PayVault.ts:271


listAvailableStores​

▸ listAvailableStores(): Promise<StoreDetails[]>

Lists all available stores.

Returns​

Promise<StoreDetails[]>

A promise that resolves to an array of store details.

Defined in​

PayVault.ts:140


listStoreProducts​

▸ listStoreProducts(): Promise<Product[]>

Lists all products for the current store.

Returns​

Promise<Product[]>

A promise that resolves to an array of products.

Defined in​

PayVault.ts:211


request​

▸ request(path, options?): Promise<Response>

Sends an API request to the specified path with the given options.

Parameters​

NameTypeDescription
pathstringThe path of the API endpoint.
optionsRequestInitThe options for the fetch request.

Returns​

Promise<Response>

Defined in​

PayVault.ts:54


requestJson​

▸ requestJson(path, options?): Promise<any>

Abstraction on the standard request, but forces the response to json.

Parameters​

NameTypeDescription
pathstringThe path of the API endpoint.
optionsRequestInitThe options for the fetch request.

Returns​

Promise<any>

Defined in​

PayVault.ts:91


updateProduct​

▸ updateProduct(productId, productDetails): Promise<any>

Updates the product with the provided product ID and details.

Parameters​

NameTypeDescription
productIdstringThe ID of the product to update.
productDetailsProductCreateRequestAn object containing the product details.

Returns​

Promise<any>

A promise that resolves when the product is updated.

Defined in​

PayVault.ts:189


updateStoreInfo​

▸ updateStoreInfo(storeDetails): Promise<StoreDetails>

Updates the store information with the provided details.

Parameters​

NameTypeDescription
storeDetailsStoreDetailsUpdateA partial object containing the store details to update.

Returns​

Promise<StoreDetails>

A promise that resolves to the updated store details.

Defined in​

PayVault.ts:115


▸ updateStoreLogo(storeLogo): Promise<StoreDetails>

Updates the store logo with the provided file.

Parameters​

NameTypeDescription
storeLogoFileA File object representing the new store logo.

Returns​

Promise<StoreDetails>

A promise that resolves to the updated store details.

Defined in​

PayVault.ts:127


uploadFile​

▸ uploadFile(path, options?): Promise<any>

Uploads a file to the specified path with the given options.

Parameters​

NameTypeDescription
pathstringThe path of the API endpoint.
optionsRequestInitThe options for the fetch request.

Returns​

Promise<any>

Defined in​

PayVault.ts:73