4 min read

getOneInvoice Documentation

Purpose

This node retrieve a specific invoice from the Stripe payment processing service. It establishes a connection with the Stripe API, takes an invoice ID as input, and returns the details of that invoice. This component is essential for applications that require invoice-related data for billing, reporting, or customer service purposes.

Settings

Inputs

The getOneInvoice component accepts the following input:

  1. invoiceId
    • Type: String
    • Description: This is the unique identifier for the invoice you want to retrieve from the Stripe service. It is crucial for the operation of the component, as it specifies which invoice data should be fetched.
    • Effects of Changing: Providing a different invoice ID will alter the returned invoice data. If no valid ID is provided, the component will throw an error.
    • Default Value: None; this input is required.

Configuration

The getOneInvoice component can also accept configuration settings:

  1. invoiceId (in the config object)
    • Type: String
    • Description: Similar to the input, this allows you to set a default invoice ID in the component's configuration. This ID can be used if the inputs.invoiceId is not provided.
    • Effects of Changing: Changing this value will pre-fill the invoice ID field, which may reduce the burden on the user to enter this information manually.
    • Default Value: None; this configuration is optional but recommended for ease of use.

Context

The component also uses a context parameter:

  1. context
    • Type: Object
    • Description: This is an optional parameter that carries environmental or user session data, which may be necessary for building the connection with the Stripe service.
    • Effects of Changing: Depending on the values passed into this context, the connection to Stripe may behave differently, especially if different credentials or configuration options are included.
    • Default Value: An empty object {} if not provided.

How It Works

The node executes the following steps:

  1. It tries to create an instance of a connection to the Stripe API by calling the the integration connection function with 'stripe' as the integration name and a context object for additional configuration.
  2. The invoice ID is retrieved either from the inputs or the configuration.
  3. If the invoice ID is unavailable, an error is thrown stating that an Invoice ID is required.
  4. If the invoice ID is available, it calls the getOneInvoice method on the Stripe integration instance, passing the invoice ID to retrieve the invoice data.
  5. The output data is returned in an object with the key output1. If any errors occur during this process, a structured error message is returned instead.

Expected Data

Use Cases & Examples

Use Cases

  1. Customer Support Query: A customer reaches out to support for details of a specific invoice. The support agent can use this component to fetch the necessary data quickly to assist the customer.

  2. Automated Billing Reports: A business needs to generate daily reports of invoices issued. By integrating getOneInvoice into their reporting tool, they can dynamically extract the latest invoice details for each customer.

  3. Refund Processing: During a refund process, staff must verify the details of an invoice before proceeding. This component lets them quickly retrieve invoice information needed for verification.

Example Configuration

Suppose a company called "ExampleCorp" is using the getOneInvoice component to support their customer service agents in retrieving invoice details. The configuration may look like this:

json
{
  "inputs": {
    "invoiceId": "inv_123456789"
  },
  "config": {
    "invoiceId": "inv_default_id_02"
  },
  "context": {
    "userId": "user_001",
    "organizationId": "org_01"
  }
}

In this configuration:

This setup allows the support team to quickly access necessary invoice data, enhancing the speed and quality of customer interaction.