# Klarna MCP

> Klarna MCP manages your entire e-commerce payment and order lifecycle. It lets your AI agent handle everything from creating checkout sessions to capturing payments, issuing refunds, or updating shipping details using simple natural language commands.

## Overview
- **Category:** money-moves
- **Price:** Free
- **Tags:** checkout, buy-now-pay-later, order-management, payment-gateway, fulfillment, fintech

## Description

Your AI client can now manage complex payment flows without needing to log into a separate portal. This MCP connects directly to Klarna's APIs, letting you automate both the initial checkout phase and everything that happens after the purchase is made. You simply tell your agent what needs doing—like 'refund order 98765-XYZ' or 'update shipping for order ABC'—and it executes the steps through natural conversation. This capability makes monitoring payment status, processing captures, and handling refunds significantly faster than traditional methods. By connecting this MCP via Vinkius, you give your agent access to a complete suite of financial tools, treating the entire merchant account as just another set of functions available to your AI client.

## Tools

### cancel_authorized_order
Cancels an order that was authorized for payment but hasn't been captured yet.

### capture_klarna_order
Triggers the final payment processing and captures the funds for a confirmed order.

### create_payment_session
Initializes a new Klarna payment session, requiring details like the amount, currency, and specific items purchased.

### get_order_details
Retrieves comprehensive status and financial data for any specified Klarna order ID.

### get_payment_session
Gets the current details of an existing payment session using its unique identifier.

### create_klarna_order
Places a formal order, requiring a valid authorization token obtained earlier in the checkout process.

### refund_klarna_order
Processes a refund against an already captured and finalized order payment.

### update_order_shipping
Updates the shipping address or tracking number associated with an existing customer order.

## Prompt Examples

**Prompt:** 
```
Create a Klarna payment session for $150.00 in USD.
```

**Response:** 
```
I've initialized the session. The order amount is 15000 (cents). Here is your session ID: 'abc-123' and the client token for your frontend widget.
```

**Prompt:** 
```
Show details for Klarna order ID '98765-XYZ'.
```

**Response:** 
```
I've retrieved order 98765-XYZ. The current status is 'AUTHORIZED' and it has not been captured yet. The total amount is $150.00 USD.
```

**Prompt:** 
```
Capture order '98765-XYZ' for the full amount of $150.00.
```

**Response:** 
```
Successfully triggered capture for order 98765-XYZ. Klarna has processed the payment, and the status has been updated to 'CAPTURED'.
```

## Capabilities

### Initiating Checkout Sessions
The system creates payment sessions by requesting specific order amounts and item details.

### Placing Confirmed Orders
It formally places an order using a secured authorization token from your checkout widget.

### Completing Payments
You capture authorized orders to trigger the actual payment from the customer's account.

### Financial Adjustments
The system processes full or partial refunds, and it cancels any authorized but uncaptured orders.

### Fulfillment Updates
It updates shipping information and tracking numbers for existing orders directly in the record.

### Data Lookup
You retrieve detailed status, financial totals, and metadata for any given Klarna order ID.

## Use Cases

### The Customer Changes Their Mind
A user needs to cancel an order that was just placed. They ask their agent to 'Cancel the authorized order for ID 123'. The agent uses `cancel_authorized_order` and confirms the cancellation, saving the operations team from manually navigating the refund flow.

### Handling a Shipping Address Change
The customer calls support because they moved. Instead of emailing an address change request to fulfillment, the agent uses `update_order_shipping` with the new details, immediately updating the order record and letting shipping proceed.

### Processing a Mid-Month Refund
A product return needs a partial refund. The controller asks their agent to 'Refund $50 on order 98765-XYZ'. The agent uses `refund_klarna_order` and confirms the exact amount and status change.

### Confirming Payment Readiness
The developer needs to check if a payment session is ready for checkout. They ask the agent to 'Check details for payment session XYZ-ABC'. The agent uses `get_payment_session` and returns the live status data.

## Benefits

- Process complex financial adjustments instantly. You can issue a partial refund using the `refund_klarna_order` tool, eliminating manual portal clicks for billing issues.
- Automate your checkout flow entirely. Start by calling `create_payment_session`, which generates the client token needed to move forward in the purchase process.
- Maintain full visibility into transactions with one command. Use `get_order_details` to pull status, totals, and metadata for any order ID you provide.
- Handle post-purchase logistics effortlessly. If a customer changes their address, use `update_order_shipping` instead of emailing support or logging into the backend system.
- Securely finalize sales cycles. The process involves using `create_klarna_order` after receiving an authorization token, followed by calling `capture_klarna_order` to collect funds.
- Prevent financial loss with control functions. If a sale is authorized but never completed, you can use `cancel_authorized_order` to prevent accidental charges.

## How It Works

The bottom line is that your agent handles all the complex authentication and API interactions so you don't have to touch a dashboard.

1. Subscribe to this MCP and provide your required credentials: the Klarna API Key (Username), Shared Secret, and Region Domain.
2. Ask your AI client to perform an action, such as 'Get details for order 98765-XYZ' or 'Create a payment session for $150.00'.
3. The MCP executes the necessary API calls and returns the specific status, tokens, or data you requested in plain text.

## Frequently Asked Questions

**How do I refund a Klarna order using the Klarna MCP?**
Use the `refund_klarna_order` tool. You just need to provide the specific order ID and the amount you want refunded, and the agent handles processing the full or partial refund.

**Can I check if a payment session is active with Klarna MCP?**
Yes, use `get_payment_session` to retrieve all current details for an existing payment session ID. This confirms its status and available data points.

**What's the difference between placing an order and capturing it with Klarna MCP?**
Placing a formal order uses `create_klarna_order` (which needs a token), but that doesn't take money. You must then use `capture_klarna_order` to actually trigger the payment from the customer.

**Can I update shipping information using Klarna MCP?**
Yes, run the `update_order_shipping` tool. Just give it the order ID and the new tracking or address details, and the record gets updated instantly.