Listcustomers
Overview
This node is designed for use within the Vantage analytics and data platform to facilitate the retrieval of customer data from the Stripe payment processing API. This function connects to Stripe, fetches customer details based on provided parameters, and returns structured data for use in various applications. It is particularly useful for businesses that need to analyze customer information, manage subscriptions, or engage with their clients based on payment history.
Settings
This node has several important settings that allow users to customize how customer data is fetched from Stripe. Below are the detailed descriptions of each setting:
-
Email
- Input Type: String
- Description: This setting specifies the email address of the customer whose information you wish to retrieve. If provided, it filters the results to include only the customer with the specified email. If this value is not explicitly set in the inputs, it will default to the value defined in the
configobject. - Default Value: The default value is
undefinedunless set in theconfig.
-
Limit
- Input Type: Numeric
- Description: The
limitsetting determines the maximum number of customer records that should be fetched in a single API call. A larger limit allows you to retrieve more data at once, but may increase response times and load on the server. If this value is not provided in the inputs, it defaults to a standard limit of 10 customers. - Default Value: 10
-
Starting After
- Input Type: String
- Description: This setting is used for pagination. It specifies an object ID that acts as a pointer to fetch records that appear after the specified object in the result set. This is useful for retrieving additional records in a paginated manner.
- Default Value: The default value is
undefined, meaning that pagination will start from the beginning unless this value is set.
-
Ending Before
- Input Type: String
- Description: Similar to
starting_after, this setting allows fetching results that appear before a given object ID. It is helpful in scenarios where you need to retrieve a specific subset of customer data based on existing records. - Default Value: The default value is
undefined, signifying that results will not be limited by this parameter unless provided.
How It Works
-
Connection Establishment: The function first tries to create an instance of the Stripe connection using a secure connection, which handles authentication and setups for different integrations.
-
Parameter Resolution: It then processes inputs and retrieves respective values for
email,limit,starting_after, andending_before. If the inputs are not provided, it falls back to the configuration settings. -
API Call: The
integration.listCustomers()method is invoked with the specified parameters. This call retrieves customer data from Stripe according to the configured filters and pagination options. -
Output Data: The resulting
outputDatacontaining customer details is returned. If any error occurs during the process (e.g., issues with the Stripe service), a structured error message is returned instead.
Error Handling
In the case of an internal error during the integration module’s execution, the function will catch the error and respond with a structured JSON object that contains an error message, making it easier for users to debug issues related to their Stripe integration.
Use Cases & Examples
Use Case 1: E-commerce Business Customer Analysis
A retail company wants to analyze the purchasing patterns of its customers. They can use this node to filter customer data based on specific emails and engage customers based on their buying history.
Use Case 2: Marketing Campaign Targeting
A marketing team needs to target customers who have previously purchased a specific product. By using this node to pull all customers who have purchased a specific item, they can tailor their campaigns to those individuals.
Configuration Example
For an e-commerce business that wants to retrieve customer data specifically for each customer associated with the email customer@example.com, limits the output to 20 customers, and intends to skip over a previous batch, the configuration might look as follows:
{
"inputs": {
"email": "customer@example.com",
"limit": 20,
"starting_after": "cus_12345"
},
"config": {
"email": null,
"limit": 10,
"starting_after": null,
"ending_before": null
}
}In this case:
- The output would include up to 20 customers, filtering through to find those linked with the specified email.
- Pagination would skip over any customers listed prior to
cus_12345, allowing for tailored data retrieval based on the business’s needs.
Billing Impacts
Using this node does not directly impact billing unless the number of API calls exceeds the limits set by the Stripe service, which could incur additional costs. It is advisable for users to manage API call pacing and limits to optimize pricing according to their usage of Stripe's services.