Stripe Payment Intent
This component allows you to automate payment processes using Stripe, a leading payment gateway. It serves as the central hub for managing “Payment Intents,” which are secure ways to handle complex payments that may require additional steps, such as identity verification (3D Secure).
Whether you are setting up a one-time charge, managing recurring subscriptions, or verifying a payment status, this component helps you control the entire flow. It connects your Nappai automation system directly to Stripe, ensuring that transactions are processed securely and accurately.
How it Works
The component acts as a bridge between your Nappai workflows and the Stripe API. Here is a simple breakdown of how it functions:
- Authentication: It connects to your Stripe account using a secure API key that you configure in the Nappai panel.
- Action Selection: You tell the component what you want to do, such as creating a new payment, checking the status of an existing one, or capturing funds.
- Data Handling: You provide necessary details like the amount to be charged and the currency. The component then communicates with Stripe to process this information.
- Result Return: After the process, it returns the status of the payment (e.g., successful, pending, or failed) along with important details like transaction IDs, which you can use in subsequent steps of your automation.
Connection & Credentials
To use this component, you must first set up a connection to your Stripe account. This ensures that Nappai has permission to interact with your payment data securely.
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type Stripe API.
- Enter your API Key (obtained from your Stripe Dashboard) and save the credential.
- In your workflow, select this saved credential in the Credential input field of the Stripe Payment Intent component.
Inputs
Mapping Mode
This component supports Mapping Mode. When enabled, you can dynamically connect inputs from other parts of your workflow instead of typing static values. For example, you can map the Amount directly from a previous calculation step.
Input Fields
The following fields are available to configure this component. Please note that visibility depends on the operation you select.
- Operation: [DropdownInput] Select the specific action you want to perform with the payment intent. Common options include creating a new intent, retrieving details, or confirming a payment.
- Mode: [DropdownInput] Determines how records are fetched. Use ‘By ID’ to retrieve a specific payment transaction using its unique ID, or ‘All’ to list multiple records.
- Payment Intent ID: [MessageInput] The unique identifier for a Stripe Payment Intent (starts with
pi_...). This is required for most actions like Cancel, Capture, Confirm, Update, and Get. - Customer ID: [MessageInput] The ID of the Stripe Customer (starts with
cus_...). This links the payment to a specific user profile. It is optional during creation but useful for recurring payments. - Amount: [MessageInput] The amount to be charged, expressed in the smallest currency unit (e.g., cents). For example, to charge $10.00 USD, enter
1000. Required for Create operations. - Currency: [DropdownInput] The three-letter ISO currency code (e.g.,
usd,eur). Required for creating new payment intents. - Description: [MessageInput] A custom text description for the payment, often used for internal record-keeping or receipts.
- Payment Method ID: [StrInput] The ID of the specific payment method to use (e.g.,
pm_card_visa). For testing, you can use predefined test IDs likepm_card_visaorpm_card_chargeDeclined. - Confirm Immediately: [DropdownInput] If selected, the payment intent is confirmed automatically upon creation. This is useful for fixed-amount payments where you want to charge the customer instantly.
- Capture Method: [DropdownInput] Defines when the money is collected. Use ‘automatic’ to capture funds immediately after confirmation, or ‘manual’ to place a hold and capture later.
- Allow Redirects: [DropdownInput] Controls whether the user is redirected to a third-party page for payment (like 3D Secure verification). Use ‘always’ to allow all methods or ‘never’ to disable redirects.
- Return URL: [MessageInput] The URL the user is sent to after completing a payment that requires redirection. Required if ‘Allow Redirects’ is set to ‘always’.
- Setup Future Usage: [DropdownInput] Specifies if this payment method should be saved for future use, such as in recurring subscription payments.
- Limit: [IntInput] An integer value to limit the number of records returned when listing multiple intents.
Outputs
Once the component executes an action, it provides several outputs that you can use in subsequent steps of your workflow.
- Success: A boolean value (
TrueorFalse) indicating whether the operation completed without errors. - Status: A string showing the current state of the payment intent (e.g.,
succeeded,processing,requires_action,canceled). - Intent ID: The unique identifier for the payment intent (e.g.,
pi_...), which you can save for future reference or updates. - Charge ID: If the payment was successful, this provides the ID of the actual charge (e.g.,
ch_...). - Error Message: If the operation fails, this field contains a detailed message explaining the error, helping you troubleshoot the issue.
- Client Secret: A secure key used for confirming the payment from the user’s browser (frontend). Note: Handle this secret securely; do not expose it in public logs.
Output Data Example (JSON)json
{ “success”: true, “status”: “succeeded”, “intent_id”: “pi_1234567890abcdef”, “charge_id”: “ch_1234567890abcdef”, “error_message”: null, “client_secret”: “sk_test_…” }
Connectivity
This component typically connects to other nodes in your automation workflow in the following logical sequence:
- Data Sources: It often receives data from Data Tables or Form Inputs that contain customer details (like
Customer ID) and payment amounts (Amount,Currency). - Conditional Branches: After executing, the component’s
Successoutput is frequently connected to If/Else or Condition nodes. This allows you to branch the workflow based on whether the payment wassucceededorfailed. - Notifications: If the
Statusindicates a failure, the workflow might connect to Email or Slack components to alert support staff. - Database Updates: If the payment is successful, the
Intent IDandCharge IDare often sent to a Database or CRM component to update the customer’s order status.
Usage Example
Scenario: Creating and Confirming a One-Time Payment
- Add Component: Drag the Stripe Payment Intent component into your workflow.
- Configure Credential: Select your Stripe API credential.
- Select Operation: Choose Create from the Operation dropdown.
- Set Details:
- Enter the Amount as
1000for $10.00. - Select usd for Currency.
- Check Confirm Immediately to charge the card right away.
- Enter the Amount as
- Connect Outputs:
- Connect the Success output to a Then block.
- If true, send a Receipt via email.
- If false, check the Error Message to diagnose the issue.
Tips and Best Practices
- Always Test with Test Cards: Use Stripe’s test mode with sample cards (like
4242 4242 4242 4242) before running live transactions to avoid accidental charges. - Handle Errors Gracefully: Always check the
SuccessandError Messageoutputs in your workflow to handle failures politely for your users. - Use IDs for Tracking: Save the
Intent IDreturned by this component in your database. You will need it if you need to cancel or update a payment later. - Be Clear with Amounts: Remember that amounts are in the smallest currency unit. $10.00 is
1000cents, not10.
Security Considerations
- Protect Your API Key: Never share or hardcode your Stripe API Key. Always use the Credential system in Nappai to keep it secure.
- Handle Client Secret Safely: The
Client Secretis sensitive information. It should only be used in backend processes or securely passed to the frontend for payment confirmation. Do not log this value in plain text. - Validate Inputs: Ensure that payment amounts and currencies are validated before sending them to Stripe to prevent invalid transaction errors.