Class: PayVault
Constructors
constructor
• new PayVault(«destructured»)
Constructs a new PayVault client.
Parameters
| Name | Type |
|---|---|
«destructured» | PayVaultConstructorProps |
Defined in
Properties
endpoint
• endpoint: string
Defined in
storeId
• storeId: string
Defined in
Accessors
headers
• get headers(): Object
Returns the headers required for API requests, given the current class variables.
Returns
Object
| Name | Type |
|---|---|
Content-Type | string |
x-api-Key | string |
Defined in
Methods
createApiKey
▸ createApiKey(): Promise<ApiKey>
Creates a new API key.
Returns
Promise<ApiKey>
A promise that resolves to the created API key.
Defined in
createCart
▸ createCart(cartContent): Promise<CreateCartResponse>
Parameters
| Name | Type |
|---|---|
cartContent | CreateCartRequest |
Returns
Promise<CreateCartResponse>
Defined in
createProduct
▸ createProduct(productDetails): Promise<any>
Creates a new product with the provided details.
Parameters
| Name | Type | Description |
|---|---|---|
productDetails | ProductCreateRequest | An object containing the product details. |
Returns
Promise<any>
A promise that resolves when the product is created.
Defined in
deleteApiKey
▸ deleteApiKey(key): Promise<ApiKey>
Deletes the API key with the provided key.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | The key of the API key to delete. |
Returns
Promise<ApiKey>
A promise that resolves when the API key is deleted.
Defined in
deleteApiKeys
▸ deleteApiKeys(keys): Promise<ApiKey[]>
Deletes multiple API keys with the provided keys.
Parameters
| Name | Type | Description |
|---|---|---|
keys | string[] | An array of API keys to delete. |
Returns
Promise<ApiKey[]>
A promise that resolves when all API keys are deleted.
Defined in
deleteProduct
▸ deleteProduct(productId): Promise<any>
Deletes the product with the provided product ID.
Parameters
| Name | Type | Description |
|---|---|---|
productId | string | number | The ID of the product to delete. |
Returns
Promise<any>
A promise that resolves when the product is deleted.
Defined in
deleteProducts
▸ deleteProducts(productIds): Promise<any>
Deletes multiple products with the provided product IDs.
Parameters
| Name | Type | Description |
|---|---|---|
productIds | (string | number)[] | An array of product IDs to delete. |
Returns
Promise<any>
A promise that resolves when all products are deleted.
Defined in
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
getApiKey
▸ getApiKey(key): Promise<ApiKey>
Retrieves the API key information for the provided key.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | The API key to retrieve information for. |
Returns
Promise<ApiKey>
A promise that resolves to the API key details.
Defined in
getProductInfo
▸ getProductInfo(productId): Promise<Product>
Retrieves the product information for the provided product ID.
Parameters
| Name | Type | Description |
|---|---|---|
productId | string | number | The ID of the product. |
Returns
Promise<Product>
A promise that resolves to the product details.
Defined in
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
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
listAvailableStores
▸ listAvailableStores(): Promise<StoreDetails[]>
Lists all available stores.
Returns
Promise<StoreDetails[]>
A promise that resolves to an array of store details.
Defined in
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
request
▸ request(path, options?): Promise<Response>
Sends an API request to the specified path with the given options.
Parameters
| Name | Type | Description |
|---|---|---|
path | string | The path of the API endpoint. |
options | RequestInit | The options for the fetch request. |
Returns
Promise<Response>
Defined in
requestJson
▸ requestJson(path, options?): Promise<any>
Abstraction on the standard request, but forces the response to json.
Parameters
| Name | Type | Description |
|---|---|---|
path | string | The path of the API endpoint. |
options | RequestInit | The options for the fetch request. |
Returns
Promise<any>
Defined in
updateProduct
▸ updateProduct(productId, productDetails): Promise<any>
Updates the product with the provided product ID and details.
Parameters
| Name | Type | Description |
|---|---|---|
productId | string | The ID of the product to update. |
productDetails | ProductCreateRequest | An object containing the product details. |
Returns
Promise<any>
A promise that resolves when the product is updated.
Defined in
updateStoreInfo
▸ updateStoreInfo(storeDetails): Promise<StoreDetails>
Updates the store information with the provided details.
Parameters
| Name | Type | Description |
|---|---|---|
storeDetails | StoreDetailsUpdate | A partial object containing the store details to update. |
Returns
Promise<StoreDetails>
A promise that resolves to the updated store details.
Defined in
updateStoreLogo
▸ updateStoreLogo(storeLogo): Promise<StoreDetails>
Updates the store logo with the provided file.
Parameters
| Name | Type | Description |
|---|---|---|
storeLogo | File | A File object representing the new store logo. |
Returns
Promise<StoreDetails>
A promise that resolves to the updated store details.
Defined in
uploadFile
▸ uploadFile(path, options?): Promise<any>
Uploads a file to the specified path with the given options.
Parameters
| Name | Type | Description |
|---|---|---|
path | string | The path of the API endpoint. |
options | RequestInit | The options for the fetch request. |
Returns
Promise<any>