Airwallex logo
Airwallex logo

Recurring Payments - Klarna

Klarna supports a variety of recurring & tokenized payment use cases such as subscriptions (with or without free trial), on-demand, and mixed payments.

When processing a payment for the first time

Step 1: Create a Customer

Create a customer with the Create a Customer API API if the customer is new, otherwise this step is optional.

Step 2: Create a Payment Intent

Create a Payment Intent with the Create a Payment Intent API API.

POST /api/v1/pa/payment_intents/create

JSON
1{
2 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",
3 "amount": 100,
4 "currency": "EUR",
5 "order": {
6 "products": [
7 {
8 "name": "apple",
9 "quantity": 5,
10 "unit_price": 20,
11 }
12 ],
13 "shipping": {
14 "first_name": "John",
15 "last_name": "Shooper",
16 "phone_number": "+491713920016",
17 "address": {
18 "country_code": "DE",
19 "city": "Berlin",
20 "postcode": "546080",
21 "street": "16 Sandilands Road"
22 }
23 }
24 },
25 "merchant_order_id": "85d7b0e0-7235-11ea-862e-9f6aa1adfca6",
26 "return_url": "https://www.airwallex.com"
27}

If the payment is not intended to charge the shopper for the first time, such as a subscription with a free trial, please set the amount to zero.

If the payment has a fixed frequency, such as a yearly subscription, please add subscription to order.products.type and indicate the expected amount for each payment.

JSON
1{
2 "amount": 0,
3 "order": {
4 "products": [
5 {
6 "type": "subscription",
7 "code": "3414314111",
8 "name": "qqhtest0002",
9 "sku": "piece",
10 "quantity": 1,
11 "unit_price": 100,
12 "desc": "test desc",
13 "url": "test_url",
14 "seller": {
15 "identifier": "seller1",
16 "name": "seller_name"
17 },
18 "effective_start_at": "2025-08-01T12:00:00Z",
19 "effective_end_at": "2025-08-01T12:00:00Z"
20 }
21 ],
22 ...
23 },
24 ...
25}

Otherwise, please pass the dummy product info:

JSON
1{
2 "amount": 0,
3 "order": {
4 "products": [
5 {
6 "type": "physical",
7 "code": "3414314111",
8 "name": "apple",
9 "sku": "piece",
10 "quantity": 1,
11 "unit_price": 0,
12 "desc": "test desc",
13 "url": "test_url",
14 "seller": {
15 "identifier": "seller1",
16 "name": "seller_name"
17 },
18 "effective_start_at": "2025-08-01T12:00:00Z",
19 "effective_end_at": "2025-08-01T12:00:00Z"
20 }
21 ],
22 ...
23 },
24 ...
25}

You are strongly advised to send any available additional_info.customer_activity_data.purchase_summaries to improve the success rate. Klarna uses such info for shopper credit and risk evaluations.

When you want to redirect the shopper to authorize the Consent with Klarna, call the Confirm a Payment Intent API API with the Payment Consent info to get a redirect URL.

Note that Klarna has different types of recurring & tokenized payments, this needs to be passed as recurring_type:

Recurring typeDescriptionsSample use case
TOKENIZEAllow shoppers to grant a recurring Payment Consent without an initial payment.
Only use when the intent amount is set to zero
Subscription with a free trial
BUY_AND_TOKENIZEAllow shoppers to grant a recurring Payment Consent with an initial payment. Subsequent payments will apply the same payment schedule as the initial payment.
- For subsequent payments, the payment fund source and schedule will be identical to the first payment. For example, if the initial payment is pay-in-4 by Direct Debt, subsequent payments will also be pay-in-4 on the same Direct Debt.
- The available payment schedule will differ based on the recurring frequency. A payment schedule is only available if it’s shorter than the recurring frequency. For example, the typical pay-in-4 has a 2-month shopper payment schedule. If the subscription is a monthly subscription (<2 months), pay-in-4 will not be available.
Subscription without a free trial
BUY_AND_DEFAULT_TOKENIZEAllow shoppers to grant a recurring Payment Consent with an initial payment. Subsequent transactions are pay-in-full transactions.
- For subsequent payments, the payment fund source will be identical to the first payment, however, they will always be a pay-in-full transaction. For example, if the initial payment is pay-in-4 by credit card, subsequent payments will be pay-in-full on the same card.
- Mixed payment: Includes a one-time product and a monthly subscription;
- Additional charge: Includes a one-time product with an additional service charged separately.

POST /api/v1/pa/payment_intents/{id}/confirm

JSON
1{
2 "request_id": "{{$guid}}",
3 "customer_id": "{{customer_id}}",
4 "payment_method": {
5 "type": "klarna",
6 "klarna": {
7 "recurring_type" : "BUY_AND_TOKENIZE",
8 "country_code": "DE",
9 "language": "en",
10 "billing": {
11 "date_of_birth": "1970-07-10",
12 "email": "[email protected]",
13 "first_name": "Test",
14 "last_name": "Person-us",
15 "personal_id": "434254235423",
16 "phone_number": "+491713920016",
17 "address": {
18 "country_code": "DE",
19 "city": "Berlin",
20 "postcode": "546080",
21 "street": "16 Sandilands Road"
22 }
23 }
24 }
25 },
26 "payment_method_options": {
27 "klarna": {
28 "auto_capture": false
29 }
30 },
31 "payment_consent": {
32 "next_triggered_by": "merchant",
33 "merchant_trigger_reason": "scheduled",
34 "terms_of_use" : {
35 "payment_amount_type" : "FIXED",
36 "fixed_payment_amount" : 100,
37 "billing_cycle_charge_day" : 3 // charged on the 3rd day of each payment_schedule interval
38 "payment_schedule" : {
39 "period" : 2, // 2 times
40 "period_unit" : "month" // per month
41 }
42 }
43 }
44}

If the subsequent payments are scheduled on a fixed frequency, please send the payment schedule in terms_of_use.

JSON
1 ...
2 ,
3 "payment_consent": {
4 "next_triggered_by": "merchant",
5 "merchant_trigger_reason": "scheduled",
6 "terms_of_use" : {
7 "payment_amount_type" : "FIXED",
8 "fixed_payment_amount" : 100,
9 "billing_cycle_charge_day" : 2
10 "payment_schedule" : {
11 "period" : 1,
12 "period_unit" : "month"
13 }
14 }
15 }

If the subsequent payments are triggered by the shopper, such as mixed payments, please send terms_of_use similar to the following:

JSON
1 ...
2 ,
3 "payment_consent": {
4 "next_triggered_by": "customer",
5 "merchant_trigger_reason": "unscheduled",
6 "terms_of_use" : {
7 "payment_amount_type" : "VARIABLE",
8 "max_payment_amount" : 1000,
9 "min_payment_amount" : 100
10 }
11 }
12 ...

Once the shopper completes the payment, the Payment Consent will be verified automatically, and Airwallex will notify you of the Payment Consent status asynchronously via the webhook. Please refer to the webhook documentation to set up your webhook accordingly.

To query the payment status and capture the Payment Intent, please refer to Klarna one-off payment flow Step 3 and Step 4.

When initiating a subsequent transaction

Step 1: Initialize a Payment Intent

When you are ready to process the subsequent recurring payment, create a Payment Intent with the Create a Payment Intent API API.

Please send products for each subsequent payment, regardless of the initial recurring_type.products should be specific to each payment, especially for mixed payments where the subsequent products information might differ from the initial payment.

POST /api/v1/pa/payment_intents/create

JSON
1{
2 ...
3 "order" : {
4 ...
5 "products": [
6 {
7 "type": "subscription",
8 "code": "3414314111",
9 "name": "qqhtest0002",
10 "sku": "piece",
11 "quantity": 1,
12 "unit_price": 100,
13 "desc": "test desc",
14 "url": "test_url",
15 "seller": {
16 "identifier": "seller1",
17 "name": "seller_name"
18 },
19 "effective_start_at": "2025-08-01T12:00:00Z",
20 "effective_end_at": "2025-08-01T12:00:00Z"
21 }
22 ]
23 }
24}

Confirm the subsequent payment with the verified Payment Consent by calling the Confirm a Payment Intent API API.

POST /api/v1/pa/payment_intents/{id}/confirm

JSON
1{
2 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",
3 "payment_consent_id": "cst_sgstjgzhsh7hhmj8hr0",
4 "payment_method_options": {
5 "klarna": {
6 "auto_capture": "true"
7 }
8 }
9}
Was this page helpful?