|
| 1 | +--- |
| 2 | +sidebar_label: Klarna |
| 3 | +sidebar_position: 4 |
| 4 | +tags: |
| 5 | + - Guide |
| 6 | +--- |
| 7 | + |
| 8 | +# Klarna Admin API Guide |
| 9 | + |
| 10 | +**Klarna** is a fully integrated payment method via NEXT Payments and Stripe, supported both in the storefront checkout and via the Admin API. |
| 11 | + |
| 12 | +Klarna transactions send the customer through a Klarna redirect flow, with the resulting order information provided back to your application. Below are the steps needed to get Klarna set up and working on the Admin API. |
| 13 | + |
| 14 | +### API Payment Redirect Flow |
| 15 | + |
| 16 | +```mdx-code-block |
| 17 | +
|
| 18 | +import RedirectPaymentFlow from '@site/_snippets/_redirect-payment-flow.mdx'; |
| 19 | +
|
| 20 | +<RedirectPaymentFlow /> |
| 21 | +``` |
| 22 | + |
| 23 | +### Create Order on Admin API |
| 24 | + |
| 25 | +When creating a new order using Klarna using the orders_create API method, you must specify the `payment_method=klarna` as well as provide a `payment_return_url`. The `payment_return_url` is your endpoint that will receive a POST request containing the final order data. |
| 26 | + |
| 27 | + |
| 28 | +```json title="Payment Details for Order with Klarna" |
| 29 | +{ |
| 30 | + "payment_method": "klarna", |
| 31 | + "payment_details": { |
| 32 | + "payment_return_url": "<external checkout url>", |
| 33 | + "payment_gateway": "<gateway id>", // optional |
| 34 | + "payment_gateway_group": "<gateway group id>" // optional |
| 35 | + } |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +:::tip |
| 40 | +You can optionally provide a `payment_gateway` when creating the order to use a Klarna account connected to a specific gateway. |
| 41 | + |
| 42 | +::: |
| 43 | + |
| 44 | +### Redirect Customer to Klarna |
| 45 | +The response when creating the order will provide a `payment_complete_url`. Your application should redirect the customer to this URL for completing the payment on Klarna. |
| 46 | + |
| 47 | +```json title="Response with Payment Complete URL" |
| 48 | +{ |
| 49 | + "reference_transaction_id": null, |
| 50 | + "payment_complete_url": "<unique checkout url>" |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +### Receiving Order Data |
| 55 | +```mdx-code-block |
| 56 | +
|
| 57 | +import RedirectPaymentStep3 from '@site/_snippets/_redirect-payment-flows-step-3.mdx'; |
| 58 | +
|
| 59 | +<RedirectPaymentStep3 /> |
| 60 | +
|
| 61 | +``` |
| 62 | + |
| 63 | +### Upsells |
| 64 | + |
| 65 | +Klarna supports one-click upsells through the [ordersAddLineItemsCreate](/docs/api/admin/reference/#/operations/ordersAddLineItemsCreate) API, enabling additional items to be added to the order with a payment transaction. |
| 66 | + |
| 67 | +### Recurring |
| 68 | + |
| 69 | +Klarna via NEXT Payments supports recurring transactions and can be used as a payment method for an order with subscription items. |
0 commit comments