@velocity-bpa/n8n-nodes-klarna
v1.0.0
Published
n8n node for Klarna payment processing and order management
Downloads
117
Readme
n8n-nodes-klarna
[Velocity BPA Licensing Notice]
This n8n node is licensed under the Business Source License 1.1 (BSL 1.1).
Use of this node by for-profit organizations in production environments requires a commercial license from Velocity BPA.
For licensing information, visit https://velobpa.com/licensing or contact [email protected].
This n8n community node integrates with Klarna's payment platform, providing access to 5 core resources for managing payment sessions, orders, captures, refunds, and settlements. Automate your Klarna payment workflows with comprehensive support for the complete payment lifecycle from session creation to settlement reconciliation.
Features
- Payment Session Management - Create, update, and manage Klarna payment sessions for checkout flows
- Order Processing - Handle order creation, authorization, and lifecycle management
- Capture Operations - Process full and partial captures for authorized orders
- Refund Handling - Execute refunds with support for partial amounts and reason codes
- Settlement Tracking - Monitor and reconcile settlement reports and transaction data
- Comprehensive Error Handling - Built-in retry logic and detailed error messages
- Flexible Authentication - Secure API key-based authentication with environment support
- Production Ready - Full type safety and validation for reliable payment processing
Installation
Community Nodes (Recommended)
- Open n8n
- Go to Settings → Community Nodes
- Click Install a community node
- Enter
n8n-nodes-klarna - Click Install
Manual Installation
cd ~/.n8n
npm install n8n-nodes-klarnaDevelopment Installation
git clone https://github.com/Velocity-BPA/n8n-nodes-klarna.git
cd n8n-nodes-klarna
npm install
npm run build
mkdir -p ~/.n8n/custom
ln -s $(pwd) ~/.n8n/custom/n8n-nodes-klarna
n8n startCredentials Setup
| Field | Description | Required | |-------|-------------|----------| | API Key | Your Klarna API key from the merchant portal | Yes | | Environment | Production or Sandbox environment | Yes | | Region | API region (EU, NA, OC) | Yes |
Resources & Operations
1. Payment Session
| Operation | Description | |-----------|-------------| | Create | Create a new payment session for checkout | | Get | Retrieve payment session details | | Update | Update payment session information | | Delete | Cancel and remove a payment session |
2. Order
| Operation | Description | |-----------|-------------| | Create | Create a new order from payment session | | Get | Retrieve order details and status | | Update | Modify order information | | Cancel | Cancel an existing order | | Extend Authorization | Extend order authorization period |
3. Capture
| Operation | Description | |-----------|-------------| | Create | Capture funds for an authorized order | | Get | Retrieve capture details | | Get All | List all captures for an order | | Update | Update capture information |
4. Refund
| Operation | Description | |-----------|-------------| | Create | Issue a refund for captured funds | | Get | Retrieve refund details | | Get All | List all refunds for an order |
5. Settlement
| Operation | Description | |-----------|-------------| | Get Report | Retrieve settlement report | | Get Transactions | List settlement transactions | | Get Payouts | Retrieve payout information |
Usage Examples
// Create a payment session
{
"purchase_country": "US",
"purchase_currency": "USD",
"locale": "en-US",
"order_amount": 2500,
"order_tax_amount": 250,
"order_lines": [
{
"name": "Gaming Laptop",
"quantity": 1,
"unit_price": 2500,
"tax_rate": 1000,
"total_amount": 2500,
"total_tax_amount": 250
}
]
}// Capture an order
{
"order_id": "order_12345",
"captured_amount": 2500,
"description": "Full order capture",
"order_lines": [
{
"name": "Gaming Laptop",
"quantity": 1,
"unit_price": 2500,
"total_amount": 2500
}
]
}// Process a refund
{
"order_id": "order_12345",
"refunded_amount": 500,
"description": "Partial refund - shipping cost",
"order_lines": [
{
"name": "Shipping refund",
"quantity": 1,
"unit_price": 500,
"total_amount": 500
}
]
}// Get settlement report
{
"settlement_date": "2024-01-15",
"currency": "USD",
"payment_method": "card"
}Error Handling
| Error | Description | Solution | |-------|-------------|----------| | 401 Unauthorized | Invalid API credentials | Verify API key and environment settings | | 404 Not Found | Resource does not exist | Check order ID, session ID, or resource identifier | | 400 Bad Request | Invalid request parameters | Validate required fields and data formats | | 409 Conflict | Resource state conflict | Check order status before performing operations | | 422 Unprocessable Entity | Business logic validation failed | Review order amounts, currency, and line items | | 429 Too Many Requests | Rate limit exceeded | Implement request throttling and retry logic |
Development
npm install
npm run build
npm test
npm run lint
npm run devAuthor
Velocity BPA
- Website: velobpa.com
- GitHub: Velocity-BPA
Licensing
This n8n community node is licensed under the Business Source License 1.1.
Free Use
Permitted for personal, educational, research, and internal business use.
Commercial Use
Use of this node within any SaaS, PaaS, hosted platform, managed service, or paid automation offering requires a commercial license.
For licensing inquiries: [email protected]
See LICENSE, COMMERCIAL_LICENSE.md, and LICENSING_FAQ.md for details.
Contributing
Contributions are welcome! Please ensure:
- Code follows existing style conventions
- All tests pass (
npm test) - Linting passes (
npm run lint) - Documentation is updated for new features
- Commit messages are descriptive
Support
- Issues: GitHub Issues
- Klarna API Documentation: developers.klarna.com
- Klarna Developer Community: Klarna Developer Portal
