Package Information
Available Nodes
Documentation
n8n-nodes-midtrans
This is an n8n community node. It lets you use Midtrans SNAP API in your n8n workflows.
Midtrans is a leading payment gateway in Indonesia that provides comprehensive payment solutions for businesses. The SNAP API allows you to create secure payment links and process online transactions.
n8n is a fair-code licensed workflow automation platform.
Installation
Operations
Credentials
Compatibility
Usage
Resources
Installation
Follow the installation guide in the n8n community nodes documentation.
You can install this package using npm:
npm install @yudhaputrama/n8n-nodes-midtrans
Operations
The Midtrans SNAP node supports the following operations:
Transaction
- Create SNAP Transaction: Create a new payment transaction using Midtrans SNAP API
- Generate secure payment links
- Support for multiple payment methods (credit cards, bank transfers, e-wallets, etc.)
- Customizable transaction details including items, customer information, and payment options
- Support for transaction expiry settings
- Custom fields for additional data
Credentials
To use this node, you need to set up Midtrans API credentials:
Prerequisites
- Sign up for a Midtrans account at https://midtrans.com
- Complete the account verification process
- Access your Midtrans Dashboard
Setting up credentials
- In your Midtrans Dashboard, go to Settings → Access Keys
- Copy your Server Key (it starts with
SB-
for sandbox orVT-server-
for production) - In n8n, create new Midtrans API credentials with:
- Environment: Choose "Sandbox" for testing or "Production" for live transactions
- Server Key: Paste your Midtrans server key
Important: Always use sandbox credentials for testing. Only use production credentials when you're ready to process real payments.
Compatibility
- Minimum n8n version: 1.0.0
- Tested with n8n versions: 1.0.0+
- Node.js version: 20.15+
Usage
Basic Transaction Creation
- Add the Midtrans SNAP node to your workflow
- Configure your Midtrans API credentials
- Set the required fields:
- Order ID: Unique identifier for your transaction
- Gross Amount: Transaction amount in Indonesian Rupiah (IDR)
Advanced Configuration
The node supports extensive customization:
- Item Details: Add product information including name, price, quantity, brand, and category
- Customer Details: Include customer information and billing/shipping addresses
- Payment Methods: Specify which payment methods to enable
- Credit Card Settings: Configure 3D Secure and other credit card options
- Expiry Settings: Set transaction expiry time
- Custom Fields: Add custom data to transactions
Example Response
Successful transactions return:
{
"token": "d379aa71-99eb-4dd1-b9bb-eefe813746e9",
"redirect_url": "https://app.sandbox.midtrans.com/snap/v3/redirection/071e0c3d-dade-4148-a1b5-296ee8735b79"
}
Use the redirect_url
to redirect customers to the payment page, or embed the payment form using the token
with Midtrans SNAP.js.