Skip to content

Stripe Price

This component serves as a bridge between your Nappai automation workflows and the Stripe payment platform. It allows you to define how customers are charged for specific products or services. You can use it to create new price configurations (such as monthly subscriptions or one-time payments) or to look up details of existing prices in your Stripe account. This ensures that your automated processes correctly bill customers based on the rules you set up.

How it Works

The component interacts directly with the Stripe API to manage “Price” objects. A Price in Stripe defines the amount and currency for a product, as well as how frequently a customer is charged if it is a recurring subscription.

When you configure this component, you provide details such as the product it belongs to, the currency (e.g., USD, EUR), and the amount. You can also specify if the price is recurring (like a monthly membership) and how often it repeats (monthly, yearly, etc.).

Internally, the component sends this information to Stripe to create a new record or searches for an existing record based on a specific ID or criteria. It then returns the results of this action, telling you if the operation was successful and providing the unique ID assigned by Stripe for the new or found price. This data can then be used in subsequent steps of your workflow, such as creating invoices or updating customer records.

Connection & Credentials

This component requires configuring a credential in the Nappai panel before interacting with the external service:

  1. Go to the Credentials section in your Nappai panel.
  2. Create a new credential of the type Stripe API and fill in the required fields (API Key).
  3. In your workflow, select the saved credential in the Credential input field of this node.

Inputs

Mapping Mode

This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:

  • Fixed: You type the value directly into the field.
  • Mapped: You connect the output of another component to use its result as the value.
  • Javascript: You write Javascript code to dynamically calculate the value.

This flexibility allows you to create more dynamic and connected workflows.

Input Fields

The following fields are available to configure this component. Each field may be visible in different operations:

  • Operation: Select what action you want to perform. This field determines the available inputs for the rest of the node.

    • Visible in: None (Standard control field)
  • Mode: Choose between retrieving a single specific record or listing multiple records. Use ‘By ID’ to get one price, or ‘All’ to list many prices.

    • Visible in: None (Standard control field)
  • Price ID: The unique identifier for a price object (starts with ‘price_…’). This is required when you want to retrieve a specific price you already know about.

    • Visible in: None (Standard control field)
  • Amount: The unit amount in the smallest currency unit. For example, enter 1000 for $10.00. This is typically used when creating new prices.

    • Visible in: None (Standard control field)
  • Currency: The three-letter ISO currency code (e.g., ‘usd’, ‘eur’). This is required to define the currency of the price.

    • Visible in: None (Standard control field)
  • Product ID: The ID of the product associated with this price (starts with ‘prod_…’). This links the price to a specific item or service in your Stripe catalog.

    • Visible in: None (Standard control field)
  • Type: Select the type of price. This helps configure whether the price is for a one-time payment or a recurring subscription.

    • Visible in: None (Standard control field)
  • Billing Interval: If the price is recurring, select the interval at which customers are charged (e.g., ‘month’, ‘year’). This is only required when the Type is set to recurring.

    • Visible in: None (Standard control field)
  • Limit: When listing multiple records, use this to set the maximum number of prices to return (between 1 and 100). This helps manage performance when dealing with large datasets.

    • Visible in: None (Standard control field)

Outputs

The component provides feedback on whether the operation succeeded and returns the data from Stripe.

  • Success: A boolean value (True/False) indicating if the operation completed without errors.
  • Price ID: The unique ID generated by Stripe for the price (e.g., ‘price_1M…’). You can use this in future steps to reference this specific price.
  • Price Object: A detailed dictionary containing all the information about the price, including its status, currency, and metadata. This is useful if you need to inspect all details of the price in subsequent steps.
  • Error Message: If the operation fails, this field contains a description of what went wrong, helping you troubleshoot the issue.
  • Raw Response: The complete JSON response from the Stripe API. This is useful for advanced debugging or if you need specific data fields not exposed by the standard outputs.

Output Data Example (JSON)json

{ “success”: true, “price_id”: “price_1N2O3P4Q5R6S”, “price_object”: { “id”: “price_1N2O3P4Q5R6S”, “product”: “prod_ABC123”, “currency”: “usd”, “unit_amount”: 2000, “nickname”: “Premium Monthly Plan”, “recurring”: { “interval”: “month” }, “created”: 1620000000 }, “error_message”: null }

Connectivity

This component is typically used in workflows related to payment management, subscription handling, or product catalog management.

  • Upstream Connections: It often receives data from components that gather customer information, product details, or payment preferences. The Product ID and Currency fields are commonly mapped from previous steps that define what is being sold and in which currency.
  • Downstream Connections: The outputs, particularly Price ID and Success, are frequently connected to components that create Invoices, Subscriptions, or Charge records. For example, once a Price is created, its Price ID can be passed to a “Create Subscription” component to set up a recurring payment for a customer.

Usage Example

Scenario: Creating a New Subscription Price

  1. Setup: You have a product named “Premium Service” in Stripe.
  2. Action: You want to automate the creation of a monthly price for this service.
  3. Configuration:
    • Select Mode as “Create” (implied by input context).
    • Enter Product ID for your premium service.
    • Set Currency to usd.
    • Set Amount to 1999 (representing $19.99).
    • Set Billing Interval to month.
  4. Result: The component creates the price in Stripe and returns the Price ID. You can then use this ID in a subsequent component to automatically create subscriptions for new customers signing up for this service.

Tips and Best Practices

  • Always Test with Small Amounts: When creating new prices, consider using a small amount (e.g., $0.50 or 50 cents) during testing to avoid accidental charges on real customers.
  • Use Consistent IDs: Keep track of your Product IDs. Using the correct Product ID is crucial for the price to appear correctly in your Stripe dashboard.
  • Handle Errors: Check the Success output in your workflow. If it is false, use the Error Message output to understand why the operation failed and adjust your inputs accordingly.
  • Limit Data Retrieval: When listing prices (Mode: All), set the Limit to a reasonable number (e.g., 50) to ensure the workflow runs efficiently and doesn’t timeout on large datasets.

Security Considerations

  • Secure API Keys: Ensure your Stripe API Key is kept secret and only stored in the secure Credentials section of Nappai. Never share your API key in plain text within your workflow documentation or public repositories.
  • Read-Only Keys: If you only need to retrieve prices and not create or modify them, consider using a Read-Only API key for enhanced security.