Skip to content

Stripe Plan

This component allows you to manage subscription billing plans in your Stripe account. You can use it to create new plans, retrieve details of existing plans, or delete plans that are no longer needed. It acts as a bridge between your automation workflow and Stripe’s payment infrastructure, ensuring that your billing processes are accurate and up-to-date.

How it Works

The Stripe Plan component connects directly to the Stripe API using the credentials you provide. It is designed to handle three main actions:

  1. Create: It sends a request to Stripe to generate a new billing plan with specific details (like price, currency, and billing frequency).
  2. Retrieve: It looks up a specific plan in Stripe using its unique ID to get its current details, or lists multiple plans based on a limit.
  3. Delete: It removes a specified plan from your Stripe account.

Internally, the component validates your inputs (such as ensuring the currency code is correct) and handles the communication with Stripe’s servers. It then returns the result of the action, telling you if it was successful or if any errors occurred.

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 (specifically the API Key).
  3. In your workflow, select the saved credential in the Credential input field of this node.

Inputs

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 the action you want to perform: “By ID” (to retrieve or delete a specific plan) or “All” (to list multiple plans).

    • Visible in: All operations
  • Mode: Select the specific action to perform: “By ID” (retrieve one specific record) or “All” (list multiple records).

    • Visible in: All operations
  • Plan ID: The unique ID of the plan (starting with plan_...). Required when retrieving or deleting a specific plan.

    • Visible in: All operations
  • Amount: The price of the plan in the smallest currency unit (e.g., 1000 represents $10.00). Required for creating plans.

    • Visible in: All operations
  • Currency: The three-letter ISO currency code (e.g., “usd”, “eur”).

    • Visible in: All operations
  • Billing Interval: The frequency at which the plan bills customers (e.g., “day”, “week”, “month”, “year”). Required for creating plans.

    • Visible in: All operations
  • Interval Count: The number of intervals between billings (e.g., 3 for a quarterly plan).

    • Visible in: All operations
  • Product ID: The ID of an existing Product (starting with prod_...) to attach this plan to. Required for creating plans.

    • Visible in: All operations
  • Trial Period Days: The number of days a customer can try the plan for free.

    • Visible in: All operations
  • Limit: The maximum number of records to return when listing plans (1-100).

    • Visible in: All operations

Outputs

The component produces the following outputs after execution:

  • Plan: A JSON object containing the full details of the plan (if successful). This includes fields like id, amount, currency, and interval.
  • Success: A boolean value (True or False) indicating whether the operation completed successfully.
  • Error Message: A string describing any error that occurred (e.g., “Plan already exists”). This will be empty if the operation is successful.

Output Data Example (JSON)

json { “id”: “plan_123456789”, “object”: “plan”, “amount”: 1000, “currency”: “usd”, “interval”: “month”, “interval_count”: 1, “product”: “prod_abcdef”, “created”: 1600000000 }

Connectivity

This component is typically used in the following contexts within a workflow:

  1. Subscription Management: Connect to components that manage user accounts or subscriptions. For example, after a user signs up, you might use this component to assign them a specific billing plan.
  2. Billing Automation: Use this component to set up new billing structures for new products. You would typically connect the output (Success) to downstream tasks that notify administrators or update internal databases.
  3. Data Retrieval: Use the “Retrieve” function to fetch plan details for display in reports or dashboards. Connect the Plan output to data visualization components.

Usage Example

Scenario: Creating a Monthly Subscription Plan

  1. Set Operation to “By ID” or ensure you are in Create mode.
  2. Enter Amount as 1000 (representing $10.00).
  3. Select Currency as usd.
  4. Set Billing Interval to month.
  5. Enter the Product ID associated with the service you are selling.
  6. Connect the Success output to a notification component to alert your team that the new plan is active.

Tips and Best Practices

  • Amount Format: Remember that Stripe expects amounts in the smallest currency unit (cents). For $10.00, enter 1000, not 10.
  • Unique Identifiers: When creating plans, ensure that the combination of the plan name and currency is unique in Stripe to avoid errors.
  • Deleting Plans: Be cautious when deleting plans. If active subscriptions are linked to the plan, Stripe may prevent the deletion or require specific handling. Check the Error Message output to see if this occurs.
  • Using Mapping Mode: Use Mapping Mode to dynamically set prices or intervals based on data from previous steps in your workflow, such as selecting a currency based on the user’s location.

Security Considerations

  • API Key Protection: Never share your Stripe API Key in your workflow documentation or in shared notes. Always use the secure Credential system provided by Nappai.
  • Least Privilege: Ensure your Stripe API key has the necessary permissions for the actions you are performing (e.g., read-only for retrieving plans, write access for creating/deleting).