Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(router): add `is_guest_customer` in payment method list response (#10598)

Sai Harsha Vardhanebd928f07fff
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index ab6b1de185..0d6806fdd0 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -25847,7 +25847,8 @@
"show_surcharge_breakup_screen",
"request_external_three_ds_authentication",
"is_tax_calculation_enabled",
- "sdk_next_action"
+ "sdk_next_action",
+ "is_guest_customer"
],
"properties": {
"redirect_url": {
@@ -25906,6 +25907,10 @@
},
"sdk_next_action": {
"$ref": "#/components/schemas/SdkNextAction"
+ },
+ "is_guest_customer": {
+ "type": "boolean",
+ "description": "indicates whether this is a guest customer flow"
}
}
},
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 822c823499..8d674f6837 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -2152,6 +2152,9 @@ pub struct PaymentMethodListResponse {
/// indicates the next action to be performed by the SDK
#[schema(value_type = SdkNextAction)]
pub sdk_next_action: payments::SdkNextAction,
+
+ /// indicates whether this is a guest customer flow
+ pub is_guest_customer: bool,
}
#[cfg(feature = "v1")]
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 260b71bb4e..63774faa11 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -3544,6 +3544,10 @@ pub async fn list_payment_methods(
platform.get_processor().get_account().get_id(),
)
.await;
+ let is_guest_customer = payment_intent
+ .as_ref()
+ .map(|payment_intent| payment_intent.customer_id.is_none())
+ .unwrap_or(true);
let merchant_surcharge_configs = if let Some((payment_attempt, payment_intent)) =
payment_attempt.as_ref().zip(payment_intent)
{
@@ -3625,6 +3629,7 @@ pub async fn list_payment_methods(
collect_billing_details_from_wallets,
is_tax_calculation_enabled: is_tax_connector_enabled && !skip_external_tax_calculation,
sdk_next_action,
+ is_guest_customer,
},
))
}