Desktop/Mobile Website Browser - Klarna
Accept Klarna payments on your website by redirecting the shopper to Klarna.
Step 1. Initialize a Payment Intent
Create a Payment Intent with the Create a Payment Intent API API.
You are strongly suggested to send any available order.shipping
to increase the success rate of Klarna payments.
POST /api/v1/pa/payment_intents/create
To process Klarna transactions, you must provide the order.products
field. The total value of (quantity
* unit_price
) for all products must match the overall amount. Discount is supported, that means the overall amount
can be less than the total value of all products. In this case, we will generate a discount item according to the amount diff automatically.
If your businesses are in below verticals: Marketplace, Intangible Goods, or Online Education, additional information is required when creating Payment Intent. Please refer to Klarna Extra Merchant Data (EMD) for details.
Step 2. Redirect to Klarna to complete payment
When a shopper selects to pay with Klarna on your desktop/mobile browser, call the Confirm a Payment Intent API API to get a redirect URL.
You are strongly suggested to send the shopper billing information payment_method.klarna.billing
to increase the success rate of Klarna payments.
POST /api/v1/pa/payment_intents/{id}/confirm
By default, Klarna transactions require manual capture to reduce dispute from unfulfilled orders. If your business model fulfills the product/service at the time of payment such as intangible goods, you may opt to enable auto-capture by passing the optional auto_capture
parameter.
You will get a response similar to the following.
You should redirect the shopper to the Klarna page with the next_action.url
returned in the confirm Payment Intent response. Shoppers will be able to continue to complete the payment on that page.
Step 3. Query the payment result status
To get the payment result, we suggest you poll the status of the Payment Intent via the Retrieve a Payment Intent API API. You may start polling the Payment Intent status after the shopper is redirected back to your website, i.e., the return_url
passed when creating the Payment Intent.
GET /api/v1/pa/payment_intents/{id}
In addition, Airwallex will notify you of the payment result asynchronously via the webhooks. Please refer to the webhook documentation to set up your webhook accordingly. Although subscribing to webhook events is optional, it is recommended to subscribe to the payment_intent.requires_capture
webhook which indicates that the shopper has paid the order, and the payment_intent.succeeded
webhook which indicates that the payment intent is fulfilled.
For auto capture payments (the
payment_method_options.klarna.auto_capture
is set totrue
), you will receive thepayment_intent.succeeded webhook
if you registered which indicates that the payment intent is fulfilled.For manual capture payments, you will receive
payment_intent.requires_capture
webhook if you registered, and this indicates the shopper has paid the order. you can refer to Step 4 below to capture this payment.
Step 4. Manual capture Klarna payment
After you ship your products to the shopper, you can call the Capture a PaymentIntent API API to capture the payments. Note that partial capture is supported. If you perform partial capture, the remaining amount will be returned to the shopper immediately.
You must capture Klarna payments within 28 days after authorization. You can do this through Webapp or API call. If an authorized payment is not captured within 28 days, the transaction itself will expire.
Please do not capture the payments before you fulfill your products as this may raise the likelihood of shopper dispute.
POST /api/v1/pa/payment_intents/{id}/capture
You will get a response similar to the following.