Bug: [FEATURE]: [KLARNA] Klarna Kustom Checkout Integration



### Feature Description

Klarna supports two types of payment methods:
1. Klarna Payments
2. Klarna Kustom Checkout

This issue includes integration of Klarna KCO

### Possible Implementation

Based on the PML got, there will be a switching between both Klarna Payments and Klarna Checkout. Klarna Checkout will include the complete checkout process along with payment.

### Have you spent some time checking if this feature request has been raised before?

- [X] I checked and didn't find a similar issue

### Have you read the Contributing Guidelines?

- [X] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

Yes, I am willing to submit a PR!
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index ee5654cfb6b..f86998cfc6f 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -11766,70 +11766,6 @@
           }
         }
       },
-      "OrderDetails": {
-        "type": "object",
-        "required": [
-          "product_name",
-          "quantity"
-        ],
-        "properties": {
-          "product_name": {
-            "type": "string",
-            "description": "Name of the product that is being purchased",
-            "example": "shirt",
-            "maxLength": 255
-          },
-          "quantity": {
-            "type": "integer",
-            "format": "int32",
-            "description": "The quantity of the product to be purchased",
-            "example": 1,
-            "minimum": 0
-          },
-          "requires_shipping": {
-            "type": "boolean",
-            "nullable": true
-          },
-          "product_img_link": {
-            "type": "string",
-            "description": "The image URL of the product",
-            "nullable": true
-          },
-          "product_id": {
-            "type": "string",
-            "description": "ID of the product that is being purchased",
-            "nullable": true
-          },
-          "category": {
-            "type": "string",
-            "description": "Category of the product that is being purchased",
-            "nullable": true
-          },
-          "sub_category": {
-            "type": "string",
-            "description": "Sub category of the product that is being purchased",
-            "nullable": true
-          },
-          "brand": {
-            "type": "string",
-            "description": "Brand of the product that is being purchased",
-            "nullable": true
-          },
-          "product_type": {
-            "allOf": [
-              {
-                "$ref": "#/components/schemas/ProductType"
-              }
-            ],
-            "nullable": true
-          },
-          "product_tax_code": {
-            "type": "string",
-            "description": "The tax code for the product",
-            "nullable": true
-          }
-        }
-      },
       "OrderDetailsWithAmount": {
         "type": "object",
         "required": [
@@ -11852,7 +11788,21 @@
             "minimum": 0
           },
           "amount": {
-            "$ref": "#/components/schemas/MinorUnit"
+            "type": "integer",
+            "format": "int64",
+            "description": "the amount per quantity of product"
+          },
+          "tax_rate": {
+            "type": "number",
+            "format": "double",
+            "description": "tax rate applicable to the product",
+            "nullable": true
+          },
+          "total_tax_amount": {
+            "type": "integer",
+            "format": "int64",
+            "description": "total tax amount applicable to the product",
+            "nullable": true
           },
           "requires_shipping": {
             "type": "boolean",
@@ -12265,6 +12215,17 @@
               }
             }
           },
+          {
+            "type": "object",
+            "required": [
+              "klarna_checkout"
+            ],
+            "properties": {
+              "klarna_checkout": {
+                "type": "object"
+              }
+            }
+          },
           {
             "type": "object",
             "required": [
@@ -12398,6 +12359,13 @@
             "description": "The payment attempt amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,",
             "example": 6540
           },
+          "order_tax_amount": {
+            "type": "integer",
+            "format": "int64",
+            "description": "The payment attempt tax_amount.",
+            "example": 6540,
+            "nullable": true
+          },
           "currency": {
             "allOf": [
               {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 2464cdf62db..57b15cf0af1 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -731,6 +731,10 @@ pub struct PaymentsRequest {
     // Makes the field mandatory in PaymentsCreateRequest
     pub amount: Option<Amount>,
 
+    /// Total tax amount applicable to the order
+    #[schema(value_type = Option<i64>, example = 6540)]
+    pub order_tax_amount: Option<MinorUnit>,
+
     /// The three letter ISO currency code in uppercase. Eg: 'USD' to charge US Dollars
     #[schema(example = "USD", value_type = Option<Currency>)]
     #[mandatory_in(PaymentsCreateRequest = Currency)]
@@ -1298,6 +1302,9 @@ pub struct PaymentAttemptResponse {
     /// The payment attempt amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,
     #[schema(value_type = i64, example = 6540)]
     pub amount: MinorUnit,
+    /// The payment attempt tax_amount.
+    #[schema(value_type = Option<i64>, example = 6540)]
+    pub order_tax_amount: Option<MinorUnit>,
     /// The currency of the amount of the payment attempt
     #[schema(value_type = Option<Currency>, example = "USD")]
     pub currency: Option<enums::Currency>,
@@ -1848,6 +1855,7 @@ pub enum PayLaterData {
         /// The token for the sdk workflow
         token: String,
     },
+    KlarnaCheckout {},
     /// For Affirm redirect as PayLater Option
     AffirmRedirect {},
     /// For AfterpayClearpay redirect as PayLater Option
@@ -1905,6 +1913,7 @@ impl GetAddressFromPaymentMethodData for PayLaterData {
             | Self::WalleyRedirect {}
             | Self::AlmaRedirect {}
             | Self::KlarnaSdk { .. }
+            | Self::KlarnaCheckout {}
             | Self::AffirmRedirect {}
             | Self::AtomeRedirect {} => None,
         }
@@ -2366,6 +2375,7 @@ impl GetPaymentMethodType for PayLaterData {
         match self {
             Self::KlarnaRedirect { .. } => api_enums::PaymentMethodType::Klarna,
             Self::KlarnaSdk { .. } => api_enums::PaymentMethodType::Klarna,
+            Self::KlarnaCheckout {} => api_enums::PaymentMethodType::Klarna,
             Self::AffirmRedirect {} => api_enums::PaymentMethodType::Affirm,
             Self::AfterpayClearpayRedirect { .. } => api_enums::PaymentMethodType::AfterpayClearpay,
             Self::PayBrightRedirect {} => api_enums::PaymentMethodType::PayBright,
@@ -5461,7 +5471,7 @@ pub struct PaymentsRetrieveRequest {
     pub expand_attempts: Option<bool>,
 }
 
-#[derive(Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
+#[derive(Debug, Default, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
 pub struct OrderDetailsWithAmount {
     /// Name of the product that is being purchased
     #[schema(max_length = 255, example = "shirt")]
@@ -5470,7 +5480,13 @@ pub struct OrderDetailsWithAmount {
     #[schema(example = 1)]
     pub quantity: u16,
     /// the amount per quantity of product
+    #[schema(value_type = i64)]
     pub amount: MinorUnit,
+    /// tax rate applicable to the product
+    pub tax_rate: Option<f64>,
+    /// total tax amount applicable to the product
+    #[schema(value_type = Option<i64>)]
+    pub total_tax_amount: Option<MinorUnit>,
     // Does the order includes shipping
     pub requires_shipping: Option<bool>,
     /// The image URL of the product
@@ -5491,32 +5507,6 @@ pub struct OrderDetailsWithAmount {
 
 impl masking::SerializableSecret for OrderDetailsWithAmount {}
 
-#[derive(Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
-pub struct OrderDetails {
-    /// Name of the product that is being purchased
-    #[schema(max_length = 255, example = "shirt")]
-    pub product_name: String,
-    /// The quantity of the product to be purchased
-    #[schema(example = 1)]
-    pub quantity: u16,
-    // Does the order include shipping
-    pub requires_shipping: Option<bool>,
-    /// The image URL of the product
-    pub product_img_link: Option<String>,
-    /// ID of the product that is being purchased
-    pub product_id: Option<String>,
-    /// Category of the product that is being purchased
-    pub category: Option<String>,
-    /// Sub category of the product that is being purchased
-    pub sub_category: Option<String>,
-    /// Brand of the product that is being purchased
-    pub brand: Option<String>,
-    /// Type of the product that is being purchased
-    pub product_type: Option<ProductType>,
-    /// The tax code for the product
-    pub product_tax_code: Option<String>,
-}
-
 #[derive(Default, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
 pub struct RedirectResponse {
     #[schema(value_type = Option<String>)]
diff --git a/crates/diesel_models/src/types.rs b/crates/diesel_models/src/types.rs
index 94f1fa8d266..6562abab4d6 100644
--- a/crates/diesel_models/src/types.rs
+++ b/crates/diesel_models/src/types.rs
@@ -30,6 +30,10 @@ pub struct OrderDetailsWithAmount {
     pub product_type: Option<common_enums::ProductType>,
     /// The tax code for the product
     pub product_tax_code: Option<String>,
+    /// tax rate applicable to the product
+    pub tax_rate: Option<f64>,
+    /// total tax amount applicable to the product
+    pub total_tax_amount: Option<MinorUnit>,
 }
 
 impl masking::SerializableSecret for OrderDetailsWithAmount {}
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
index 479abf13b13..a60e8bdc79e 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
@@ -746,6 +746,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
                     email: Some(match paylater {
                         PayLaterData::KlarnaRedirect {} => item.router_data.get_billing_email()?,
                         PayLaterData::KlarnaSdk { token: _ }
+                        | PayLaterData::KlarnaCheckout {}
                         | PayLaterData::AffirmRedirect {}
                         | PayLaterData::AfterpayClearpayRedirect {}
                         | PayLaterData::PayBrightRedirect {}
diff --git a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
index 08ca9a54fa4..5abc93b3f88 100644
--- a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
@@ -85,6 +85,7 @@ impl TryFrom<(&types::TokenizationRouterData, PayLaterData)> for SquareTokenRequ
             PayLaterData::AfterpayClearpayRedirect { .. }
             | PayLaterData::KlarnaRedirect { .. }
             | PayLaterData::KlarnaSdk { .. }
+            | PayLaterData::KlarnaCheckout {}
             | PayLaterData::AffirmRedirect { .. }
             | PayLaterData::PayBrightRedirect { .. }
             | PayLaterData::WalleyRedirect { .. }
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index 7a30a434a5d..41dc60f8248 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -751,6 +751,7 @@ impl TryFrom<&PayLaterData> for ZenPaymentsRequest {
         match value {
             PayLaterData::KlarnaRedirect { .. }
             | PayLaterData::KlarnaSdk { .. }
+            | PayLaterData::KlarnaCheckout {}
             | PayLaterData::AffirmRedirect {}
             | PayLaterData::AfterpayClearpayRedirect { .. }
             | PayLaterData::PayBrightRedirect {}
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 6dce48e6996..cf32d966e05 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -2092,6 +2092,7 @@ pub enum PaymentMethodDataType {
     SwishQr,
     KlarnaRedirect,
     KlarnaSdk,
+    KlarnaCheckout,
     AffirmRedirect,
     AfterpayClearpayRedirect,
     PayBrightRedirect,
@@ -2216,6 +2217,7 @@ impl From<PaymentMethodData> for PaymentMethodDataType {
             PaymentMethodData::PayLater(pay_later_data) => match pay_later_data {
                 payment_method_data::PayLaterData::KlarnaRedirect { .. } => Self::KlarnaRedirect,
                 payment_method_data::PayLaterData::KlarnaSdk { .. } => Self::KlarnaSdk,
+                payment_method_data::PayLaterData::KlarnaCheckout {} => Self::KlarnaCheckout,
                 payment_method_data::PayLaterData::AffirmRedirect {} => Self::AffirmRedirect,
                 payment_method_data::PayLaterData::AfterpayClearpayRedirect { .. } => {
                     Self::AfterpayClearpayRedirect
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index 0e8722644bd..6e353afd399 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -133,6 +133,8 @@ impl ApiModelToDieselModelConvertor<ApiOrderDetailsWithAmount> for OrderDetailsW
             brand,
             product_type,
             product_tax_code,
+            tax_rate,
+            total_tax_amount,
         } = from;
         Self {
             product_name,
@@ -146,6 +148,8 @@ impl ApiModelToDieselModelConvertor<ApiOrderDetailsWithAmount> for OrderDetailsW
             brand,
             product_type,
             product_tax_code,
+            tax_rate,
+            total_tax_amount,
         }
     }
 
@@ -162,6 +166,8 @@ impl ApiModelToDieselModelConvertor<ApiOrderDetailsWithAmount> for OrderDetailsW
             brand,
             product_type,
             product_tax_code,
+            tax_rate,
+            total_tax_amount,
         } = self;
         ApiOrderDetailsWithAmount {
             product_name,
@@ -175,6 +181,8 @@ impl ApiModelToDieselModelConvertor<ApiOrderDetailsWithAmount> for OrderDetailsW
             brand,
             product_type,
             product_tax_code,
+            tax_rate,
+            total_tax_amount,
         }
     }
 }
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index db35766f33a..0ca2338926a 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -155,6 +155,7 @@ pub enum CardRedirectData {
 pub enum PayLaterData {
     KlarnaRedirect {},
     KlarnaSdk { token: String },
+    KlarnaCheckout {},
     AffirmRedirect {},
     AfterpayClearpayRedirect {},
     PayBrightRedirect {},
@@ -896,6 +897,7 @@ impl From<api_models::payments::PayLaterData> for PayLaterData {
         match value {
             api_models::payments::PayLaterData::KlarnaRedirect { .. } => Self::KlarnaRedirect {},
             api_models::payments::PayLaterData::KlarnaSdk { token } => Self::KlarnaSdk { token },
+            api_models::payments::PayLaterData::KlarnaCheckout {} => Self::KlarnaCheckout {},
             api_models::payments::PayLaterData::AffirmRedirect {} => Self::AffirmRedirect {},
             api_models::payments::PayLaterData::AfterpayClearpayRedirect { .. } => {
                 Self::AfterpayClearpayRedirect {}
@@ -1549,6 +1551,7 @@ impl GetPaymentMethodType for PayLaterData {
         match self {
             Self::KlarnaRedirect { .. } => api_enums::PaymentMethodType::Klarna,
             Self::KlarnaSdk { .. } => api_enums::PaymentMethodType::Klarna,
+            Self::KlarnaCheckout {} => api_enums::PaymentMethodType::Klarna,
             Self::AffirmRedirect {} => api_enums::PaymentMethodType::Affirm,
             Self::AfterpayClearpayRedirect { .. } => api_enums::PaymentMethodType::AfterpayClearpay,
             Self::PayBrightRedirect {} => api_enums::PaymentMethodType::PayBright,
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 2f68b481d88..0e25e195c73 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -29,6 +29,7 @@ pub struct PaymentsAuthorizeData {
     /// get_total_surcharge_amount() // returns surcharge_amount + tax_on_surcharge_amount
     /// ```
     pub amount: i64,
+    pub order_tax_amount: Option<MinorUnit>,
     pub email: Option<pii::Email>,
     pub customer_name: Option<Secret<String>>,
     pub currency: storage_enums::Currency,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 7ad5645e75a..91466761009 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -378,7 +378,6 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::payments::SwishQrData,
         api_models::payments::AirwallexData,
         api_models::payments::NoonData,
-        api_models::payments::OrderDetails,
         api_models::payments::OrderDetailsWithAmount,
         api_models::payments::NextActionType,
         api_models::payments::WalletData,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 5a5454e2505..deb5e7900f2 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -340,7 +340,6 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::payments::SwishQrData,
         api_models::payments::AirwallexData,
         api_models::payments::NoonData,
-        api_models::payments::OrderDetails,
         api_models::payments::OrderDetailsWithAmount,
         api_models::payments::NextActionType,
         api_models::payments::WalletData,
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 16cab2fda47..6e7663a35b7 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -2321,7 +2321,8 @@ impl
                 check_required_field(billing_address, "billing")?;
                 Ok(AdyenPaymentMethod::Atome)
             }
-            domain::payments::PayLaterData::KlarnaSdk { .. } => {
+            domain::payments::PayLaterData::KlarnaCheckout {}
+            | domain::payments::PayLaterData::KlarnaSdk { .. } => {
                 Err(errors::ConnectorError::NotImplemented(
                     utils::get_unimplemented_payment_method_error_message("Adyen"),
                 )
diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rs
index d2bdaae0493..77e2a027d83 100644
--- a/crates/router/src/connector/klarna.rs
+++ b/crates/router/src/connector/klarna.rs
@@ -448,7 +448,24 @@ impl
         let endpoint =
             build_region_specific_endpoint(self.base_url(connectors), &req.connector_meta_data)?;
 
-        Ok(format!("{endpoint}ordermanagement/v1/orders/{order_id}"))
+        let payment_experience = req.request.payment_experience;
+
+        match payment_experience {
+            Some(common_enums::PaymentExperience::InvokeSdkClient) => {
+                Ok(format!("{endpoint}ordermanagement/v1/orders/{order_id}"))
+            }
+            Some(common_enums::PaymentExperience::RedirectToUrl) => {
+                Ok(format!("{endpoint}checkout/v3/orders/{order_id}"))
+            }
+            None => Err(error_stack::report!(errors::ConnectorError::NotSupported {
+                message: "payment_experience not supported".to_string(),
+                connector: "klarna",
+            })),
+            _ => Err(error_stack::report!(errors::ConnectorError::NotSupported {
+                message: "payment_experience not supported".to_string(),
+                connector: "klarna",
+            })),
+        }
     }
 
     fn build_request(
@@ -653,6 +670,122 @@ impl
                     })),
                 }
             }
+            domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaCheckout {}) => {
+                match (payment_experience, payment_method_type) {
+                    (
+                        common_enums::PaymentExperience::RedirectToUrl,
+                        common_enums::PaymentMethodType::Klarna,
+                    ) => Ok(format!("{endpoint}checkout/v3/orders",)),
+                    (
+                        common_enums::PaymentExperience::DisplayQrCode
+                        | common_enums::PaymentExperience::DisplayWaitScreen
+                        | common_enums::PaymentExperience::InvokePaymentApp
+                        | common_enums::PaymentExperience::InvokeSdkClient
+                        | common_enums::PaymentExperience::LinkWallet
+                        | common_enums::PaymentExperience::OneClick
+                        | common_enums::PaymentExperience::RedirectToUrl
+                        | common_enums::PaymentExperience::CollectOtp,
+                        common_enums::PaymentMethodType::Ach
+                        | common_enums::PaymentMethodType::Affirm
+                        | common_enums::PaymentMethodType::AfterpayClearpay
+                        | common_enums::PaymentMethodType::Alfamart
+                        | common_enums::PaymentMethodType::AliPay
+                        | common_enums::PaymentMethodType::AliPayHk
+                        | common_enums::PaymentMethodType::Alma
+                        | common_enums::PaymentMethodType::ApplePay
+                        | common_enums::PaymentMethodType::Atome
+                        | common_enums::PaymentMethodType::Bacs
+                        | common_enums::PaymentMethodType::BancontactCard
+                        | common_enums::PaymentMethodType::Becs
+                        | common_enums::PaymentMethodType::Benefit
+                        | common_enums::PaymentMethodType::Bizum
+                        | common_enums::PaymentMethodType::Blik
+                        | common_enums::PaymentMethodType::Boleto
+                        | common_enums::PaymentMethodType::BcaBankTransfer
+                        | common_enums::PaymentMethodType::BniVa
+                        | common_enums::PaymentMethodType::BriVa
+                        | common_enums::PaymentMethodType::CardRedirect
+                        | common_enums::PaymentMethodType::CimbVa
+                        | common_enums::PaymentMethodType::ClassicReward
+                        | common_enums::PaymentMethodType::Credit
+                        | common_enums::PaymentMethodType::CryptoCurrency
+                        | common_enums::PaymentMethodType::Cashapp
+                        | common_enums::PaymentMethodType::Dana
+                        | common_enums::PaymentMethodType::DanamonVa
+                        | common_enums::PaymentMethodType::Debit
+                        | common_enums::PaymentMethodType::DirectCarrierBilling
+                        | common_enums::PaymentMethodType::Efecty
+                        | common_enums::PaymentMethodType::Eps
+                        | common_enums::PaymentMethodType::Evoucher
+                        | common_enums::PaymentMethodType::Giropay
+                        | common_enums::PaymentMethodType::Givex
+                        | common_enums::PaymentMethodType::GooglePay
+                        | common_enums::PaymentMethodType::GoPay
+                        | common_enums::PaymentMethodType::Gcash
+                        | common_enums::PaymentMethodType::Ideal
+                        | common_enums::PaymentMethodType::Interac
+                        | common_enums::PaymentMethodType::Indomaret
+                        | common_enums::PaymentMethodType::Klarna
+                        | common_enums::PaymentMethodType::KakaoPay
+                        | common_enums::PaymentMethodType::MandiriVa
+                        | common_enums::PaymentMethodType::Knet
+                        | common_enums::PaymentMethodType::MbWay
+                        | common_enums::PaymentMethodType::MobilePay
+                        | common_enums::PaymentMethodType::Momo
+                        | common_enums::PaymentMethodType::MomoAtm
+                        | common_enums::PaymentMethodType::Multibanco
+                        | common_enums::PaymentMethodType::LocalBankRedirect
+                        | common_enums::PaymentMethodType::OnlineBankingThailand
+                        | common_enums::PaymentMethodType::OnlineBankingCzechRepublic
+                        | common_enums::PaymentMethodType::OnlineBankingFinland
+                        | common_enums::PaymentMethodType::OnlineBankingFpx
+                        | common_enums::PaymentMethodType::OnlineBankingPoland
+                        | common_enums::PaymentMethodType::OnlineBankingSlovakia
+                        | common_enums::PaymentMethodType::Oxxo
+                        | common_enums::PaymentMethodType::PagoEfectivo
+                        | common_enums::PaymentMethodType::PermataBankTransfer
+                        | common_enums::PaymentMethodType::OpenBankingUk
+                        | common_enums::PaymentMethodType::PayBright
+                        | common_enums::PaymentMethodType::Paypal
+                        | common_enums::PaymentMethodType::Paze
+                        | common_enums::PaymentMethodType::Pix
+                        | common_enums::PaymentMethodType::PaySafeCard
+                        | common_enums::PaymentMethodType::Przelewy24
+                        | common_enums::PaymentMethodType::Pse
+                        | common_enums::PaymentMethodType::RedCompra
+                        | common_enums::PaymentMethodType::RedPagos
+                        | common_enums::PaymentMethodType::SamsungPay
+                        | common_enums::PaymentMethodType::Sepa
+                        | common_enums::PaymentMethodType::Sofort
+                        | common_enums::PaymentMethodType::Swish
+                        | common_enums::PaymentMethodType::TouchNGo
+                        | common_enums::PaymentMethodType::Trustly
+                        | common_enums::PaymentMethodType::Twint
+                        | common_enums::PaymentMethodType::UpiCollect
+                        | common_enums::PaymentMethodType::UpiIntent
+                        | common_enums::PaymentMethodType::Venmo
+                        | common_enums::PaymentMethodType::Vipps
+                        | common_enums::PaymentMethodType::Walley
+                        | common_enums::PaymentMethodType::WeChatPay
+                        | common_enums::PaymentMethodType::SevenEleven
+                        | common_enums::PaymentMethodType::Lawson
+                        | common_enums::PaymentMethodType::LocalBankTransfer
+                        | common_enums::PaymentMethodType::MiniStop
+                        | common_enums::PaymentMethodType::FamilyMart
+                        | common_enums::PaymentMethodType::Seicomart
+                        | common_enums::PaymentMethodType::PayEasy
+                        | common_enums::PaymentMethodType::Mifinity
+                        | common_enums::PaymentMethodType::Fps
+                        | common_enums::PaymentMethodType::DuitNow
+                        | common_enums::PaymentMethodType::PromptPay
+                        | common_enums::PaymentMethodType::VietQr
+                        | common_enums::PaymentMethodType::OpenBankingPIS,
+                    ) => Err(error_stack::report!(errors::ConnectorError::NotSupported {
+                        message: payment_method_type.to_string(),
+                        connector: "klarna",
+                    })),
+                }
+            }
 
             domain::PaymentMethodData::Card(_)
             | domain::PaymentMethodData::CardRedirect(_)
@@ -726,7 +859,7 @@ impl
         event_builder: Option<&mut ConnectorEvent>,
         res: Response,
     ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
-        let response: klarna::KlarnaPaymentsResponse = res
+        let response: klarna::KlarnaAuthResponse = res
             .response
             .parse_struct("KlarnaPaymentsResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
diff --git a/crates/router/src/connector/klarna/transformers.rs b/crates/router/src/connector/klarna/transformers.rs
index 803dc4a428d..0826b0f2665 100644
--- a/crates/router/src/connector/klarna/transformers.rs
+++ b/crates/router/src/connector/klarna/transformers.rs
@@ -1,7 +1,9 @@
 use api_models::payments;
 use common_utils::{pii, types::MinorUnit};
 use error_stack::{report, ResultExt};
-use hyperswitch_domain_models::router_data::KlarnaSdkResponse;
+use hyperswitch_domain_models::{
+    router_data::KlarnaSdkResponse, router_response_types::RedirectForm,
+};
 use masking::{ExposeInterface, Secret};
 use serde::{Deserialize, Serialize};
 
@@ -10,7 +12,7 @@ use crate::{
         self, AddressData, AddressDetailsData, PaymentsAuthorizeRequestData, RouterData,
     },
     core::errors,
-    types::{self, api, storage::enums, transformers::ForeignFrom},
+    types::{self, api, domain, storage::enums, transformers::ForeignFrom},
 };
 
 #[derive(Debug, Serialize)]
@@ -61,9 +63,29 @@ impl TryFrom<&Option<pii::SecretSerdeValue>> for KlarnaConnectorMetadataObject {
     }
 }
 
-#[derive(Default, Debug, Serialize)]
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum PaymentMethodSpecifics {
+    KlarnaCheckout(KlarnaCheckoutRequestData),
+    KlarnaSdk,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+pub struct MerchantURLs {
+    terms: String,
+    checkout: String,
+    confirmation: String,
+    push: String,
+}
+
+#[derive(Default, Debug, Serialize, Deserialize)]
+pub struct KlarnaCheckoutRequestData {
+    merchant_urls: MerchantURLs,
+    options: CheckoutOptions,
+}
+
+#[derive(Default, Debug, Deserialize, Serialize)]
 pub struct KlarnaPaymentsRequest {
-    auto_capture: bool,
     order_lines: Vec<OrderLines>,
     order_amount: MinorUnit,
     purchase_country: enums::CountryAlpha2,
@@ -71,15 +93,32 @@ pub struct KlarnaPaymentsRequest {
     merchant_reference1: Option<String>,
     merchant_reference2: Option<String>,
     shipping_address: Option<KlarnaShippingAddress>,
+    auto_capture: Option<bool>,
+    order_tax_amount: Option<MinorUnit>,
+    #[serde(flatten)]
+    payment_method_specifics: Option<PaymentMethodSpecifics>,
 }
 
 #[derive(Debug, Deserialize, Serialize)]
-pub struct KlarnaPaymentsResponse {
+#[serde(untagged)]
+pub enum KlarnaAuthResponse {
+    KlarnaPaymentsAuthResponse(PaymentsResponse),
+    KlarnaCheckoutAuthResponse(CheckoutResponse),
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub struct PaymentsResponse {
     order_id: String,
     fraud_status: KlarnaFraudStatus,
     authorized_payment_method: Option<AuthorizedPaymentMethod>,
 }
 
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub struct CheckoutResponse {
+    order_id: String,
+    status: KlarnaCheckoutStatus,
+    html_snippet: String,
+}
 #[derive(Debug, Clone, Deserialize, Serialize)]
 pub struct AuthorizedPaymentMethod {
     #[serde(rename = "type")]
@@ -106,7 +145,7 @@ pub struct KlarnaSessionRequest {
     shipping_address: Option<KlarnaShippingAddress>,
 }
 
-#[derive(Debug, Serialize)]
+#[derive(Debug, Serialize, Deserialize)]
 pub struct KlarnaShippingAddress {
     city: String,
     country: enums::CountryAlpha2,
@@ -120,6 +159,10 @@ pub struct KlarnaShippingAddress {
     street_address2: Option<Secret<String>>,
 }
 
+#[derive(Default, Debug, Serialize, Deserialize)]
+pub struct CheckoutOptions {
+    auto_capture: bool,
+}
 #[derive(Deserialize, Serialize, Debug)]
 pub struct KlarnaSessionResponse {
     pub client_token: Secret<String>,
@@ -149,6 +192,8 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsSessionRouterData>> for KlarnaSes
                         quantity: data.quantity,
                         unit_price: data.amount,
                         total_amount: data.amount * data.quantity,
+                        total_tax_amount: None,
+                        tax_rate: None,
                     })
                     .collect(),
                 shipping_address: get_address_info(item.router_data.get_optional_shipping())
@@ -190,29 +235,100 @@ impl TryFrom<&KlarnaRouterData<&types::PaymentsAuthorizeRouterData>> for KlarnaP
         item: &KlarnaRouterData<&types::PaymentsAuthorizeRouterData>,
     ) -> Result<Self, Self::Error> {
         let request = &item.router_data.request;
-        match request.order_details.clone() {
-            Some(order_details) => Ok(Self {
-                purchase_country: item.router_data.get_billing_country()?,
-                purchase_currency: request.currency,
-                order_amount: item.amount,
-                order_lines: order_details
-                    .iter()
-                    .map(|data| OrderLines {
-                        name: data.product_name.clone(),
-                        quantity: data.quantity,
-                        unit_price: data.amount,
-                        total_amount: data.amount * data.quantity,
-                    })
-                    .collect(),
-                merchant_reference1: Some(item.router_data.connector_request_reference_id.clone()),
-                merchant_reference2: item.router_data.request.merchant_order_reference_id.clone(),
-                auto_capture: request.is_auto_capture()?,
-                shipping_address: get_address_info(item.router_data.get_optional_shipping())
-                    .transpose()?,
-            }),
-            None => Err(report!(errors::ConnectorError::MissingRequiredField {
-                field_name: "order_details"
-            })),
+        let payment_method_data = request.payment_method_data.clone();
+        let return_url = item.router_data.request.get_return_url()?;
+        let webhook_url = item.router_data.request.get_webhook_url()?;
+        match payment_method_data {
+            domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaSdk { .. }) => {
+                match request.order_details.clone() {
+                    Some(order_details) => Ok(Self {
+                        purchase_country: item.router_data.get_billing_country()?,
+                        purchase_currency: request.currency,
+                        order_amount: item.amount,
+                        order_lines: order_details
+                            .iter()
+                            .map(|data| OrderLines {
+                                name: data.product_name.clone(),
+                                quantity: data.quantity,
+                                unit_price: data.amount,
+                                total_amount: data.amount * data.quantity,
+                                total_tax_amount: None,
+                                tax_rate: None,
+                            })
+                            .collect(),
+                        merchant_reference1: Some(
+                            item.router_data.connector_request_reference_id.clone(),
+                        ),
+                        merchant_reference2: item
+                            .router_data
+                            .request
+                            .merchant_order_reference_id
+                            .clone(),
+                        auto_capture: Some(request.is_auto_capture()?),
+                        shipping_address: get_address_info(
+                            item.router_data.get_optional_shipping(),
+                        )
+                        .transpose()?,
+                        order_tax_amount: None,
+                        payment_method_specifics: None,
+                    }),
+                    None => Err(report!(errors::ConnectorError::MissingRequiredField {
+                        field_name: "order_details"
+                    })),
+                }
+            }
+            domain::PaymentMethodData::PayLater(domain::PayLaterData::KlarnaCheckout {}) => {
+                match request.order_details.clone() {
+                    Some(order_details) => Ok(Self {
+                        purchase_country: item.router_data.get_billing_country()?,
+                        purchase_currency: request.currency,
+                        order_amount: item.amount
+                            - request.order_tax_amount.unwrap_or(MinorUnit::zero()),
+                        order_tax_amount: request.order_tax_amount,
+                        order_lines: order_details
+                            .iter()
+                            .map(|data| OrderLines {
+                                name: data.product_name.clone(),
+                                quantity: data.quantity,
+                                unit_price: data.amount,
+                                total_amount: data.amount * data.quantity,
+                                total_tax_amount: data.total_tax_amount,
+                                tax_rate: data.tax_rate,
+                            })
+                            .collect(),
+                        payment_method_specifics: Some(PaymentMethodSpecifics::KlarnaCheckout(
+                            KlarnaCheckoutRequestData {
+                                merchant_urls: MerchantURLs {
+                                    terms: return_url.clone(),
+                                    checkout: return_url.clone(),
+                                    confirmation: return_url,
+                                    push: webhook_url,
+                                },
+                                options: CheckoutOptions {
+                                    auto_capture: request.is_auto_capture()?,
+                                },
+                            },
+                        )),
+                        shipping_address: get_address_info(
+                            item.router_data.get_optional_shipping(),
+                        )
+                        .transpose()?,
+                        merchant_reference1: Some(
+                            item.router_data.connector_request_reference_id.clone(),
+                        ),
+                        merchant_reference2: item
+                            .router_data
+                            .request
+                            .merchant_order_reference_id
+                            .clone(),
+                        auto_capture: None,
+                    }),
+                    None => Err(report!(errors::ConnectorError::MissingRequiredField {
+                        field_name: "order_details"
+                    })),
+                }
+            }
+            _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
         }
     }
 }
@@ -240,53 +356,82 @@ fn get_address_info(
     })
 }
 
-impl TryFrom<types::PaymentsResponseRouterData<KlarnaPaymentsResponse>>
+impl TryFrom<types::PaymentsResponseRouterData<KlarnaAuthResponse>>
     for types::PaymentsAuthorizeRouterData
 {
     type Error = error_stack::Report<errors::ConnectorError>;
+
     fn try_from(
-        item: types::PaymentsResponseRouterData<KlarnaPaymentsResponse>,
+        item: types::PaymentsResponseRouterData<KlarnaAuthResponse>,
     ) -> Result<Self, Self::Error> {
-        let connector_response = types::ConnectorResponseData::with_additional_payment_method_data(
-            match item.response.authorized_payment_method {
-                Some(authorized_payment_method) => {
-                    types::AdditionalPaymentMethodConnectorResponse::from(authorized_payment_method)
-                }
-                None => {
-                    types::AdditionalPaymentMethodConnectorResponse::PayLater { klarna_sdk: None }
-                }
-            },
-        );
-
-        Ok(Self {
-            response: Ok(types::PaymentsResponseData::TransactionResponse {
-                resource_id: types::ResponseId::ConnectorTransactionId(
-                    item.response.order_id.clone(),
-                ),
-                redirection_data: Box::new(None),
-                mandate_reference: Box::new(None),
-                connector_metadata: None,
-                network_txn_id: None,
-                connector_response_reference_id: Some(item.response.order_id.clone()),
-                incremental_authorization_allowed: None,
-                charge_id: None,
+        match item.response {
+            KlarnaAuthResponse::KlarnaPaymentsAuthResponse(ref response) => {
+                let connector_response =
+                    response
+                        .authorized_payment_method
+                        .as_ref()
+                        .map(|authorized_payment_method| {
+                            types::ConnectorResponseData::with_additional_payment_method_data(
+                                types::AdditionalPaymentMethodConnectorResponse::from(
+                                    authorized_payment_method.clone(),
+                                ),
+                            )
+                        });
+
+                Ok(Self {
+                    response: Ok(types::PaymentsResponseData::TransactionResponse {
+                        resource_id: types::ResponseId::ConnectorTransactionId(
+                            response.order_id.clone(),
+                        ),
+                        redirection_data: Box::new(None),
+                        mandate_reference: Box::new(None),
+                        connector_metadata: None,
+                        network_txn_id: None,
+                        connector_response_reference_id: Some(response.order_id.clone()),
+                        incremental_authorization_allowed: None,
+                        charge_id: None,
+                    }),
+                    status: enums::AttemptStatus::foreign_from((
+                        response.fraud_status.clone(),
+                        item.data.request.is_auto_capture()?,
+                    )),
+                    connector_response,
+                    ..item.data
+                })
+            }
+            KlarnaAuthResponse::KlarnaCheckoutAuthResponse(ref response) => Ok(Self {
+                response: Ok(types::PaymentsResponseData::TransactionResponse {
+                    resource_id: types::ResponseId::ConnectorTransactionId(
+                        response.order_id.clone(),
+                    ),
+                    redirection_data: Box::new(Some(RedirectForm::Html {
+                        html_data: response.html_snippet.clone(),
+                    })),
+                    mandate_reference: Box::new(None),
+                    connector_metadata: None,
+                    network_txn_id: None,
+                    connector_response_reference_id: Some(response.order_id.clone()),
+                    incremental_authorization_allowed: None,
+                    charge_id: None,
+                }),
+                status: enums::AttemptStatus::foreign_from((
+                    response.status.clone(),
+                    item.data.request.is_auto_capture()?,
+                )),
+                connector_response: None,
+                ..item.data
             }),
-            status: enums::AttemptStatus::foreign_from((
-                item.response.fraud_status,
-                item.data.request.is_auto_capture()?,
-            )),
-            connector_response: Some(connector_response),
-            ..item.data
-        })
+        }
     }
 }
-
-#[derive(Debug, Serialize)]
+#[derive(Default, Debug, Serialize, Deserialize)]
 pub struct OrderLines {
     name: String,
     quantity: u16,
     unit_price: MinorUnit,
     total_amount: MinorUnit,
+    total_tax_amount: Option<MinorUnit>,
+    tax_rate: Option<f64>,
 }
 
 #[derive(Debug, Serialize)]
@@ -325,6 +470,13 @@ pub enum KlarnaFraudStatus {
     Rejected,
 }
 
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum KlarnaCheckoutStatus {
+    CheckoutComplete,
+    CheckoutIncomplete,
+}
+
 impl ForeignFrom<(KlarnaFraudStatus, bool)> for enums::AttemptStatus {
     fn foreign_from((klarna_status, is_auto_capture): (KlarnaFraudStatus, bool)) -> Self {
         match klarna_status {
@@ -341,13 +493,42 @@ impl ForeignFrom<(KlarnaFraudStatus, bool)> for enums::AttemptStatus {
     }
 }
 
+impl ForeignFrom<(KlarnaCheckoutStatus, bool)> for enums::AttemptStatus {
+    fn foreign_from((klarna_status, is_auto_capture): (KlarnaCheckoutStatus, bool)) -> Self {
+        match klarna_status {
+            KlarnaCheckoutStatus::CheckoutIncomplete => {
+                if is_auto_capture {
+                    Self::AuthenticationPending
+                } else {
+                    Self::Authorized
+                }
+            }
+            KlarnaCheckoutStatus::CheckoutComplete => Self::Charged,
+        }
+    }
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum KlarnaPsyncResponse {
+    KlarnaSDKPsyncResponse(KlarnaSDKSyncResponse),
+    KlarnaCheckoutPSyncResponse(KlarnaCheckoutSyncResponse),
+}
+
 #[derive(Debug, Serialize, Deserialize)]
-pub struct KlarnaPsyncResponse {
+pub struct KlarnaSDKSyncResponse {
     pub order_id: String,
     pub status: KlarnaPaymentStatus,
     pub klarna_reference: Option<String>,
 }
 
+#[derive(Debug, Serialize, Deserialize)]
+pub struct KlarnaCheckoutSyncResponse {
+    pub order_id: String,
+    pub status: KlarnaCheckoutStatus,
+    pub options: CheckoutOptions,
+}
+
 #[derive(Debug, Clone, Serialize, Deserialize)]
 #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
 pub enum KlarnaPaymentStatus {
@@ -379,25 +560,45 @@ impl<F, T>
     fn try_from(
         item: types::ResponseRouterData<F, KlarnaPsyncResponse, T, types::PaymentsResponseData>,
     ) -> Result<Self, Self::Error> {
-        Ok(Self {
-            status: enums::AttemptStatus::from(item.response.status),
-            response: Ok(types::PaymentsResponseData::TransactionResponse {
-                resource_id: types::ResponseId::ConnectorTransactionId(
-                    item.response.order_id.clone(),
-                ),
-                redirection_data: Box::new(None),
-                mandate_reference: Box::new(None),
-                connector_metadata: None,
-                network_txn_id: None,
-                connector_response_reference_id: item
-                    .response
-                    .klarna_reference
-                    .or(Some(item.response.order_id)),
-                incremental_authorization_allowed: None,
-                charge_id: None,
+        match item.response {
+            KlarnaPsyncResponse::KlarnaSDKPsyncResponse(response) => Ok(Self {
+                status: enums::AttemptStatus::from(response.status),
+                response: Ok(types::PaymentsResponseData::TransactionResponse {
+                    resource_id: types::ResponseId::ConnectorTransactionId(
+                        response.order_id.clone(),
+                    ),
+                    redirection_data: Box::new(None),
+                    mandate_reference: Box::new(None),
+                    connector_metadata: None,
+                    network_txn_id: None,
+                    connector_response_reference_id: response
+                        .klarna_reference
+                        .or(Some(response.order_id.clone())),
+                    incremental_authorization_allowed: None,
+                    charge_id: None,
+                }),
+                ..item.data
             }),
-            ..item.data
-        })
+            KlarnaPsyncResponse::KlarnaCheckoutPSyncResponse(response) => Ok(Self {
+                status: enums::AttemptStatus::foreign_from((
+                    response.status.clone(),
+                    response.options.auto_capture,
+                )),
+                response: Ok(types::PaymentsResponseData::TransactionResponse {
+                    resource_id: types::ResponseId::ConnectorTransactionId(
+                        response.order_id.clone(),
+                    ),
+                    redirection_data: Box::new(None),
+                    mandate_reference: Box::new(None),
+                    connector_metadata: None,
+                    network_txn_id: None,
+                    connector_response_reference_id: Some(response.order_id.clone()),
+                    incremental_authorization_allowed: None,
+                    charge_id: None,
+                }),
+                ..item.data
+            }),
+        }
     }
 }
 
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index 121ec1d7b7c..a4195655ed3 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -977,6 +977,7 @@ where
                     get_pay_later_info(AlternativePaymentMethodType::AfterPay, item)
                 }
                 domain::PayLaterData::KlarnaSdk { .. }
+                | domain::PayLaterData::KlarnaCheckout {}
                 | domain::PayLaterData::AffirmRedirect {}
                 | domain::PayLaterData::PayBrightRedirect {}
                 | domain::PayLaterData::WalleyRedirect {}
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index 11e01b78e13..600b7ab0e22 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -1256,6 +1256,7 @@ impl TryFrom<&domain::PayLaterData> for PaypalPaymentsRequest {
         match value {
             domain::PayLaterData::KlarnaRedirect { .. }
             | domain::PayLaterData::KlarnaSdk { .. }
+            | domain::PayLaterData::KlarnaCheckout {}
             | domain::PayLaterData::AffirmRedirect {}
             | domain::PayLaterData::AfterpayClearpayRedirect { .. }
             | domain::PayLaterData::PayBrightRedirect {}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 2f0b0e0316f..262b0348b5a 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -992,6 +992,7 @@ impl TryFrom<&domain::payments::PayLaterData> for StripePaymentMethodType {
             }
 
             domain::PayLaterData::KlarnaSdk { .. }
+            | domain::PayLaterData::KlarnaCheckout {}
             | domain::PayLaterData::PayBrightRedirect {}
             | domain::PayLaterData::WalleyRedirect {}
             | domain::PayLaterData::AlmaRedirect {}
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 1ea7565f69f..171f19bc70a 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -2793,6 +2793,7 @@ pub enum PaymentMethodDataType {
     SwishQr,
     KlarnaRedirect,
     KlarnaSdk,
+    KlarnaCheckout,
     AffirmRedirect,
     AfterpayClearpayRedirect,
     PayBrightRedirect,
@@ -2916,6 +2917,7 @@ impl From<domain::payments::PaymentMethodData> for PaymentMethodDataType {
             domain::payments::PaymentMethodData::PayLater(pay_later_data) => match pay_later_data {
                 domain::payments::PayLaterData::KlarnaRedirect { .. } => Self::KlarnaRedirect,
                 domain::payments::PayLaterData::KlarnaSdk { .. } => Self::KlarnaSdk,
+                domain::payments::PayLaterData::KlarnaCheckout {} => Self::KlarnaCheckout,
                 domain::payments::PayLaterData::AffirmRedirect {} => Self::AffirmRedirect,
                 domain::payments::PayLaterData::AfterpayClearpayRedirect { .. } => {
                     Self::AfterpayClearpayRedirect
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 58217ef3f41..b6abe94f60f 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -1477,6 +1477,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
                                 surcharge_amount,
                                 tax_amount,
                             ),
+
                         connector_mandate_detail: payment_data
                             .payment_attempt
                             .connector_mandate_detail,
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 6a676af47b7..37e129ba707 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1427,6 +1427,15 @@ impl PaymentCreate {
 
         let skip_external_tax_calculation = request.skip_external_tax_calculation;
 
+        let tax_details = request
+            .order_tax_amount
+            .map(|tax_amount| diesel_models::TaxDetails {
+                default: Some(diesel_models::DefaultTax {
+                    order_tax_amount: tax_amount,
+                }),
+                payment_method_type: None,
+            });
+
         Ok(storage::PaymentIntent {
             payment_id: payment_id.to_owned(),
             merchant_id: merchant_account.get_id().to_owned(),
@@ -1481,7 +1490,7 @@ impl PaymentCreate {
             is_payment_processor_token_flow,
             organization_id: merchant_account.organization_id.clone(),
             shipping_cost: request.shipping_cost,
-            tax_details: None,
+            tax_details,
             skip_external_tax_calculation,
             psd2_sca_exemption_type: request.psd2_sca_exemption_type,
         })
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 92486320cde..f6bd3efc555 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -261,6 +261,7 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
             .net_amount
             .get_amount_as_i64(),
         minor_amount: payment_data.payment_attempt.amount_details.net_amount,
+        order_tax_amount: None,
         currency: payment_data.payment_intent.amount_details.currency,
         browser_info: None,
         email: None,
@@ -2431,25 +2432,6 @@ pub fn mobile_payment_next_steps_check(
     Ok(mobile_payment_next_step)
 }
 
-pub fn change_order_details_to_new_type(
-    order_amount: MinorUnit,
-    order_details: api_models::payments::OrderDetails,
-) -> Option<Vec<api_models::payments::OrderDetailsWithAmount>> {
-    Some(vec![api_models::payments::OrderDetailsWithAmount {
-        product_name: order_details.product_name,
-        quantity: order_details.quantity,
-        amount: order_amount,
-        product_img_link: order_details.product_img_link,
-        requires_shipping: order_details.requires_shipping,
-        product_id: order_details.product_id,
-        category: order_details.category,
-        sub_category: order_details.sub_category,
-        brand: order_details.brand,
-        product_type: order_details.product_type,
-        product_tax_code: order_details.product_tax_code,
-    }])
-}
-
 impl ForeignFrom<api_models::payments::QrCodeInformation> for api_models::payments::NextActionData {
     fn foreign_from(qr_info: api_models::payments::QrCodeInformation) -> Self {
         match qr_info {
@@ -2625,6 +2607,10 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
             statement_descriptor: payment_data.payment_intent.statement_descriptor_name,
             capture_method: payment_data.payment_attempt.capture_method,
             amount: amount.get_amount_as_i64(),
+            order_tax_amount: payment_data
+                .payment_attempt
+                .net_amount
+                .get_order_tax_amount(),
             minor_amount: amount,
             currency: payment_data.currency,
             browser_info,
@@ -2961,7 +2947,6 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SdkPaymentsSessi
 #[cfg(feature = "v1")]
 impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SdkPaymentsSessionUpdateData {
     type Error = error_stack::Report<errors::ApiErrorResponse>;
-
     fn try_from(additional_data: PaymentAdditionalData<'_, F>) -> Result<Self, Self::Error> {
         let payment_data = additional_data.payment_data;
         let order_tax_amount = payment_data
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 2ab43378516..de4c063c41a 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -873,6 +873,7 @@ impl ForeignFrom<&SetupMandateRouterData> for PaymentsAuthorizeData {
             email: data.request.email.clone(),
             customer_name: data.request.customer_name.clone(),
             amount: 0,
+            order_tax_amount: Some(MinorUnit::zero()),
             minor_amount: MinorUnit::new(0),
             statement_descriptor: None,
             capture_method: None,
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index 3bd31873131..bd55bd96b96 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -29,6 +29,7 @@ impl VerifyConnectorData {
             amount: 1000,
             minor_amount: common_utils::types::MinorUnit::new(1000),
             confirm: true,
+            order_tax_amount: None,
             currency: storage_enums::Currency::USD,
             metadata: None,
             mandate_id: None,
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 269eb831fc6..d10f1686507 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -1234,6 +1234,7 @@ impl ForeignFrom<storage::PaymentAttempt> for payments::PaymentAttemptResponse {
             attempt_id: payment_attempt.attempt_id,
             status: payment_attempt.status,
             amount: payment_attempt.net_amount.get_order_amount(),
+            order_tax_amount: payment_attempt.net_amount.get_order_tax_amount(),
             currency: payment_attempt.currency,
             connector: payment_attempt.connector,
             error_message: payment_attempt.error_reason,
diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs
index 1994acb6a65..15f980e242e 100644
--- a/crates/router/tests/connectors/payme.rs
+++ b/crates/router/tests/connectors/payme.rs
@@ -90,6 +90,8 @@ fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
             brand: None,
             product_type: None,
             product_tax_code: None,
+            tax_rate: None,
+            total_tax_amount: None,
         }]),
         router_return_url: Some("https://hyperswitch.io".to_string()),
         webhook_url: Some("https://hyperswitch.io".to_string()),
@@ -391,6 +393,8 @@ async fn should_fail_payment_for_incorrect_cvc() {
                     brand: None,
                     product_type: None,
                     product_tax_code: None,
+                    tax_rate: None,
+                    total_tax_amount: None,
                 }]),
                 router_return_url: Some("https://hyperswitch.io".to_string()),
                 webhook_url: Some("https://hyperswitch.io".to_string()),
@@ -431,6 +435,8 @@ async fn should_fail_payment_for_invalid_exp_month() {
                     brand: None,
                     product_type: None,
                     product_tax_code: None,
+                    tax_rate: None,
+                    total_tax_amount: None,
                 }]),
                 router_return_url: Some("https://hyperswitch.io".to_string()),
                 webhook_url: Some("https://hyperswitch.io".to_string()),
@@ -471,6 +477,8 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
                     brand: None,
                     product_type: None,
                     product_tax_code: None,
+                    tax_rate: None,
+                    total_tax_amount: None,
                 }]),
                 router_return_url: Some("https://hyperswitch.io".to_string()),
                 webhook_url: Some("https://hyperswitch.io".to_string()),
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index f195aeaf7c4..489b55a227b 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -939,6 +939,7 @@ impl Default for PaymentAuthorizeType {
             payment_method_data: types::domain::PaymentMethodData::Card(CCardType::default().0),
             amount: 100,
             minor_amount: MinorUnit::new(100),
+            order_tax_amount: Some(MinorUnit::zero()),
             currency: enums::Currency::USD,
             confirm: true,
             statement_descriptor_suffix: None,
diff --git a/crates/router/tests/connectors/zen.rs b/crates/router/tests/connectors/zen.rs
index de60c5e8d86..a13fe48d255 100644
--- a/crates/router/tests/connectors/zen.rs
+++ b/crates/router/tests/connectors/zen.rs
@@ -334,6 +334,8 @@ async fn should_fail_payment_for_incorrect_card_number() {
                     brand: None,
                     product_type: None,
                     product_tax_code: None,
+                    tax_rate: None,
+                    total_tax_amount: None,
                 }]),
                 email: Some(Email::from_str("test@gmail.com").unwrap()),
                 webhook_url: Some("https://1635-116-74-253-164.ngrok-free.app".to_string()),
@@ -377,6 +379,8 @@ async fn should_fail_payment_for_incorrect_cvc() {
                     brand: None,
                     product_type: None,
                     product_tax_code: None,
+                    tax_rate: None,
+                    total_tax_amount: None,
                 }]),
                 email: Some(Email::from_str("test@gmail.com").unwrap()),
                 webhook_url: Some("https://1635-116-74-253-164.ngrok-free.app".to_string()),
@@ -420,6 +424,8 @@ async fn should_fail_payment_for_invalid_exp_month() {
                     brand: None,
                     product_type: None,
                     product_tax_code: None,
+                    tax_rate: None,
+                    total_tax_amount: None,
                 }]),
                 email: Some(Email::from_str("test@gmail.com").unwrap()),
                 webhook_url: Some("https://1635-116-74-253-164.ngrok-free.app".to_string()),
@@ -463,6 +469,8 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
                     brand: None,
                     product_type: None,
                     product_tax_code: None,
+                    tax_rate: None,
+                    total_tax_amount: None,
                 }]),
                 email: Some(Email::from_str("test@gmail.com").unwrap()),
                 webhook_url: Some("https://1635-116-74-253-164.ngrok-free.app".to_string()),

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
Klarna Kustom Checkout (KCO) integration

Klarna provides two payment methods:
1. Klarna Payments (for US)
2. Klarna Kustom Checkout (for EU)

Any one of the methods can be used at a time and switching between Klarna Payments and Klarna Checkout is been done. Based on the PML got, there will be a switching between Klarna Payments and Klarna Checkout.
The redirect_to_url link from response is used to complete the payment.

Linking the original PR here https://github.com/juspay/hyperswitch/pull/6590


### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
4. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
This PR is related to issue: https://github.com/juspay/hyperswitch/issues/6521


## How did you test it?
I tested it using postman by hitting the required endpoints. Curl to the postman setup:

1. Configure Klarna Checkout for merchant account
```
curl --location 'http://localhost:8080/account/merchant_1734083062/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "klarna",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "kl******", 
        "key1":  "2fe*****"  
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "payment_experience": "redirect_to_url",
                    "payment_method_type": "klarna"
                }
            ]
        }
    ],
    "metadata": {
        "klarna_region": "Europe"
    },
    "business_country": "FR"
    
}

'
```

Response:
```
{
    "connector_type": "payment_processor",
    "connector_name": "klarna",
    "connector_label": "klarna_US_default",
    "merchant_connector_id": "mca_uscoeTxtbsDsj2b37wv8",
    "profile_id": "pro_PdHB9mW2uWUx2di0W9u3",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": "kl***********************************************************************************************************************************************************************z0",
        "key1": "2f********************************89"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "klarna",
                    "payment_experience": "redirect_to_url",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": {
        "klarna_region": "Europe"
    },
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": "FR",
    "business_label": null,
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null
}
```

2. Create a Klarna Checkout Payment request
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_nsmdfKGJM74PYSViFQ04zsoTMLFkF2VkcvuRdmerez2zBfHSjCrZIxpEln9vYBgl' \
--data-raw '{
    "amount": 50000,
    "order_tax_amount":0,
    "confirm": false,
    "currency": "EUR",
    "capture_method": "automatic",
    "customer_id": "klarna",
    "payment_experience":"redirect_to_url",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "payment_method": "pay_later",
    "payment_method_type": "klarna",
    "payment_method_data": { 
        "pay_later": {
            "klarna_checkout":{}
        }
    },
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "return_url": "https://google.com"
}'
```

Response: 
```
{
    "payment_id": "pay_b9SVvCHWeHFV7jiTCr1v",
    "merchant_id": "merchant_1734083062",
    "status": "requires_confirmation",
    "amount": 50000,
    "net_amount": 50000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_b9SVvCHWeHFV7jiTCr1v_secret_uTuJ4C4UZtzKWCkJqKyj",
    "created": "2024-12-16T12:15:12.009Z",
    "currency": "EUR",
    "customer_id": "klarna",
    "customer": {
        "id": "klarna",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "pay_later",
    "payment_method_data": {
        "pay_later": {
            "klarna_sdk": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": "redirect_to_url",
    "payment_method_type": "klarna",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "klarna",
        "created_at": 1734351311,
        "expires": 1734354911,
        "secret": "epk_5aaf5ecba75d4de68712573428fe89f2"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_PdHB9mW2uWUx2di0W9u3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-16T12:30:12.009Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-12-16T12:15:12.033Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": 0,
    "connector_mandate_id": null
}
```

3. Confirm payment

```
curl --location 'http://localhost:8080/payments/pay_b9SVvCHWeHFV7jiTCr1v/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_nsmdfKGJM74PYSViFQ04zsoTMLFkF2VkcvuRdmerez2zBfHSjCrZIxpEln9vYBgl' \
--data-raw '{
    "amount": 50000,
    "order_tax_amount":0,
    "currency": "EUR",
    "amount_to_capture": 50000,
    
    "retry_action": "manual_retry",
    "capture_method": "automatic",
    "payment_experience":"redirect_to_url",
    "profile_id": null,
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds", 
    "setup_future_usage":"on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "routing": { 
        "type": "single",
        "data": "stripe"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "pay_later",
    "payment_method_type": "klarna",
    "payment_method_data": { 
        "pay_later": {
            "klarna_checkout":{}
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "FR",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "FR",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Red T-Shirt",
            "quantity": 5,
            "amount": 10000,
            "account_name": "transaction_processing",
            "total_tax_amount": 0,
            "tax_rate": 0,
            "total_amount": 50000
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
     "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal", 
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord"
}
'
```

Response:

```
{
    "payment_id": "pay_FrDhjLjXbKxLYD3Pz2Gj",
    "merchant_id": "merchant_1734083062",
    "status": "requires_customer_action",
    "amount": 50000,
    "net_amount": 50000,
    "shipping_cost": null,
    "amount_capturable": 50000,
    "amount_received": null,
    "connector": "klarna",
    "client_secret": "pay_FrDhjLjXbKxLYD3Pz2Gj_secret_4xESj0dqk8aXuOpHWJTM",
    "created": "2024-12-16T12:12:58.052Z",
    "currency": "EUR",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "pay_later",
    "payment_method_data": {
        "pay_later": {
            "klarna_sdk": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "FR",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "FR",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": [
        {
            "brand": null,
            "amount": 10000,
            "category": null,
            "quantity": 5,
            "tax_rate": 0.0,
            "product_id": null,
            "product_name": "Red T-Shirt",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": 0,
            "requires_shipping": null
        }
    ],
    "email": "customer@gmail.com",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_FrDhjLjXbKxLYD3Pz2Gj/merchant_1734083062/pay_FrDhjLjXbKxLYD3Pz2Gj_2"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": "redirect_to_url",
    "payment_method_type": "klarna",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "abef2bbc-d284-423b-b3fa-6bad31df2c32",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "abef2bbc-d284-423b-b3fa-6bad31df2c32",
    "payment_link": null,
    "profile_id": "pro_PdHB9mW2uWUx2di0W9u3",
    "surcharge_details": null,
    "attempt_count": 2,
    "merchant_decision": null,
    "merchant_connector_id": "mca_uscoeTxtbsDsj2b37wv8",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-16T12:27:58.052Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-12-16T12:13:19.188Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": 0,
    "connector_mandate_id": null
}
```

After completing the payment on clicking the redirect_url, PSync response is as follows:


4. PSync:

```
curl --location 'http://localhost:8080/payments/pay_FrDhjLjXbKxLYD3Pz2Gj?force_sync=true&expand_captures=true&expand_attempts=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_nsmdfKGJM74PYSViFQ04zsoTMLFkF2VkcvuRdmerez2zBfHSjCrZIxpEln9vYBgl'
```


Response:
```
{
    "payment_id": "pay_FrDhjLjXbKxLYD3Pz2Gj",
    "merchant_id": "merchant_1734083062",
    "status": "succeeded",
    "amount": 50000,
    "net_amount": 50000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 50000,
    "connector": "klarna",
    "client_secret": "pay_FrDhjLjXbKxLYD3Pz2Gj_secret_4xESj0dqk8aXuOpHWJTM",
    "created": "2024-12-16T12:12:58.052Z",
    "currency": "EUR",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_FrDhjLjXbKxLYD3Pz2Gj_1",
            "status": "failure",
            "amount": 50000,
            "order_tax_amount": 0,
            "currency": "EUR",
            "connector": "klarna",
            "error_message": "Bad value: authorization_token",
            "payment_method": "pay_later",
            "connector_transaction_id": null,
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2024-12-16T12:12:58.052Z",
            "modified_at": "2024-12-16T12:13:11.833Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": "BAD_VALUE",
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": "invoke_sdk_client",
            "payment_method_type": "klarna",
            "reference_id": null,
            "unified_code": "UE_9000",
            "unified_message": "Something went wrong",
            "client_source": null,
            "client_version": null
        },
        {
            "attempt_id": "pay_FrDhjLjXbKxLYD3Pz2Gj_2",
            "status": "authentication_pending",
            "amount": 50000,
            "order_tax_amount": 0,
            "currency": "EUR",
            "connector": "klarna",
            "error_message": null,
            "payment_method": "pay_later",
            "connector_transaction_id": "abef2bbc-d284-423b-b3fa-6bad31df2c32",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2024-12-16T12:13:18.866Z",
            "modified_at": "2024-12-16T12:13:19.200Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": "redirect_to_url",
            "payment_method_type": "klarna",
            "reference_id": "abef2bbc-d284-423b-b3fa-6bad31df2c32",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "pay_later",
    "payment_method_data": {
        "pay_later": {
            "klarna_sdk": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "FR",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "FR",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": [
        {
            "brand": null,
            "amount": 10000,
            "category": null,
            "quantity": 5,
            "tax_rate": 0.0,
            "product_id": null,
            "product_name": "Red T-Shirt",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": 0,
            "requires_shipping": null
        }
    ],
    "email": "customer@gmail.com",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": "redirect_to_url",
    "payment_method_type": "klarna",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "abef2bbc-d284-423b-b3fa-6bad31df2c32",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "abef2bbc-d284-423b-b3fa-6bad31df2c32",
    "payment_link": null,
    "profile_id": "pro_PdHB9mW2uWUx2di0W9u3",
    "surcharge_details": null,
    "attempt_count": 2,
    "merchant_decision": null,
    "merchant_connector_id": "mca_uscoeTxtbsDsj2b37wv8",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-12-16T12:27:58.052Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_b5F9KF9igKlKRYpGnalg",
    "payment_method_status": "inactive",
    "updated": "2024-12-16T12:13:57.721Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": 0,
    "connector_mandate_id": null
}
```

Please test Klarna SDK also.


## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
