Skip to content

Stripe Charge

This component allows you to interact directly with the Stripe payment system. It is designed to help you create new payment charges, retrieve specific transaction details, list recent charges, or update existing ones.

In simple terms, this tool acts as a bridge between your Nappai automation and your Stripe account. It allows you to process payments, track when money is collected, and manage customer billing information without needing to write code or manually log into the Stripe dashboard.

How it Works

The Stripe Charge component connects to the Stripe API using the credentials you configure in your Nappai panel. Once connected, it performs actions based on the settings you provide.

  • Payment Processing: You can initiate a charge by providing the amount, currency, and payment source (such as a credit card token).
  • Data Retrieval: You can look up specific past transactions by their unique ID to see details like status and date.
  • Batch Listing: You can retrieve a list of recent charges, which is useful for reporting or checking if multiple payments were processed successfully.

The component handles the secure communication with Stripe’s servers and returns the results to your workflow, indicating whether the action succeeded or if an error occurred.

Connection & Credentials

This component requires configuring a Stripe API credential in the Nappai panel before it can interact with your Stripe account.

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

Note: Ensure you are using the correct API key (Test mode for development, Live mode for real transactions).

Inputs

The following fields are available to configure this component.

  • Operation: Select the action you want to perform. Options include creating a charge, retrieving a single charge, listing multiple charges, or updating a charge.
  • Visible in: All Operations
  • Get Mode: Determine if you want to retrieve a single charge by ID or list all charges.
  • Visible in: All Operations
  • Charge ID: The unique identifier for a specific charge (starts with ch_). Required if you are retrieving or updating a specific transaction.
  • Visible in: All Operations
  • Customer ID: The ID of the customer (starts with cus_) to associate with the charge or filter by.
  • Visible in: All Operations
  • Amount: The amount to charge, expressed in the smallest currency unit (e.g., cents for USD). For example, enter 1000 to charge $10.00.
  • Visible in: All Operations
  • Currency: The three-letter ISO currency code (e.g., usd, eur).
  • Visible in: All Operations
  • Source Token: The payment source token (starts with tok_). This is used for testing and development. Do not use pm_ prefixes here, as they require the Payment Intents API.
  • Visible in: All Operations
  • Description: An arbitrary text description for the charge, useful for internal record-keeping.
  • Visible in: All Operations
  • Limit: The maximum number of charges to return when listing. Values must be between 1 and 100.
  • Visible in: All Operations

Outputs

The component produces the following outputs to help you understand the result of the operation:

  • Charge Data: A detailed object containing all information about the charge, including the ID, amount, status, customer details, and timestamp. You can use this data in subsequent steps to track the payment.
  • Error Details: If the operation fails, this output provides information about why it failed (e.g., invalid card, insufficient funds, or API error).
  • Success Flag: A simple true/false indicator showing whether the operation completed successfully.

Output Data Example (JSON)

json { “id”: “ch_1234567890”, “amount”: 1000, “currency”: “usd”, “status”: “succeeded”, “created”: 1616161616, “customer”: “cus_9876543210”, “receipt_email”: “customer@example.com”, “description”: “Monthly Subscription Fee” }

Connectivity

This component is typically used in workflows that involve financial transactions or customer billing.

  • Connects To: Payment Intents or Customer Management components. After creating a charge, you might want to log the result to a database or send a confirmation email.
  • Connected From: Webhooks or Data Sources. You often receive a trigger (like a new order) that initiates the payment process.
  • Logical Flow: Data flows from a trigger (e.g., a new order) -> Stripe Charge (processes payment) -> Data Storage or Notification (confirms success or handles failure).

Usage Example

Scenario: Processing a One-Time Payment

  1. Operation: Select “Create Charge”.
  2. Amount: Enter 5000 (representing $50.00).
  3. Currency: Select usd.
  4. Source Token: Use a test token like tok_visa to simulate a successful Visa payment.
  5. Description: Enter “Order #12345”.
  6. Result: The component returns a success flag and the charge object. You can then use this data to update your internal records or send a receipt to the customer.

Scenario: Checking Transaction Status

  1. Operation: Select “Retrieve Charge”.
  2. Charge ID: Enter the ID of a specific transaction (e.g., ch_abc...).
  3. Result: The component returns the full details of that specific charge, allowing you to verify if the payment was successful or declined.

Important Notes

  • Development Mode: This component is designed primarily for development and testing environments. Transactions processed here may use Stripe’s Test Mode and do not involve real money.
  • Test Tokens: When testing, use specific test tokens (like tok_visa for success or tok_chargeDeclined for failures) rather than real card numbers.
  • Payment Methods: Do not use Payment Method IDs (pm_...) in the Source Token field. That functionality belongs to the Payment Intents API, which is handled differently.

Tips and Best Practices

  • Always Check Success Flags: In your workflow, always add a check for the Success Flag output to handle errors gracefully (e.g., notify the user if a payment failed).
  • Use Descriptions: Always provide a clear Description for charges to make it easier to identify transactions later in your Stripe dashboard or reports.
  • Amount Formatting: Remember that amounts are in the smallest currency unit (cents/pence). $1.00 is 100, not 1.
  • Test in Sandbox: Use the Source Token inputs with test tokens (tok_visa, tok_mastercard) to simulate different outcomes without charging real credit cards.

Security Considerations

  • API Key Safety: Never expose your live Stripe API keys in public repositories or share them unnecessarily. Use environment variables or Nappai’s secure credential storage.
  • Test Mode vs. Live Mode: Be careful to ensure you are using the correct API key (Test vs. Live) to avoid accidental real-world transactions during development.
  • Data Privacy: Ensure that any sensitive customer data passed through this component complies with relevant data protection regulations (like GDPR), as payment information is highly sensitive.