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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(payments): add fingerprint_type and generate fingerprints for wallet payment methods (#13849)
Ayush Anand02d4df118353
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex b070c9329f..fefdc06852 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -23196,6 +23196,13 @@}}},+ "FingerprintType": {+ "type": "string",+ "enum": [+ "dpan",+ "fpan"+ ]+ },"FinixAdditionalDetails": {"type": "object","properties": {@@ -23389,6 +23396,14 @@"eci_indicator"],"properties": {+ "auth_method": {+ "allOf": [+ {+ "$ref": "#/components/schemas/GooglePayAuthMethod"+ }+ ],+ "nullable": true+ },"card_exp_month": {"type": "string","description": "The card's expiry month"@@ -23682,6 +23697,13 @@}}},+ "GooglePayAuthMethod": {+ "type": "string",+ "enum": [+ "PAN_ONLY",+ "CRYPTOGRAM_3DS"+ ]+ },"GooglePayCardFundingSource": {"type": "string","enum": [@@ -34154,6 +34176,14 @@"description": "Payment Fingerprint, to identify a particular card.\nIt is a 20 character long alphanumeric code.","nullable": true},+ "fingerprint_type": {+ "allOf": [+ {+ "$ref": "#/components/schemas/FingerprintType"+ }+ ],+ "nullable": true+ },"browser_info": {"allOf": [{@@ -35975,6 +36005,14 @@"description": "Payment Fingerprint, to identify a particular card.\nIt is a 20 character long alphanumeric code.","nullable": true},+ "fingerprint_type": {+ "allOf": [+ {+ "$ref": "#/components/schemas/FingerprintType"+ }+ ],+ "nullable": true+ },"browser_info": {"allOf": [{diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 4a43a2b06d..3b136d305c 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -15962,6 +15962,14 @@"eci_indicator"],"properties": {+ "auth_method": {+ "allOf": [+ {+ "$ref": "#/components/schemas/GooglePayAuthMethod"+ }+ ],+ "nullable": true+ },"card_exp_month": {"type": "string","description": "The card's expiry month"@@ -16245,6 +16253,13 @@}}},+ "GooglePayAuthMethod": {+ "type": "string",+ "enum": [+ "PAN_ONLY",+ "CRYPTOGRAM_3DS"+ ]+ },"GooglePayCardFundingSource": {"type": "string","enum": [diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 77e24106ac..d832fc9e19 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -9,6 +9,8 @@ pub mod trait_impls;use cards::{CardNumber, NetworkToken};#[cfg(feature = "v2")]use common_enums::enums::PaymentConnectorTransmission;+#[cfg(feature = "v1")]+pub use common_enums::FingerprintType;use common_enums::{self, GooglePayCardFundingSource, ProductType};#[cfg(feature = "v1")]use common_types::primitive_wrappers::{@@ -7698,6 +7700,11 @@ pub struct PaymentsResponse {#[smithy(value_type = "Option<String>")]pub fingerprint: Option<String>,+ /// Identifies whether the payment fingerprint was generated from a funding PAN (FPAN)+ /// or a wallet device PAN (DPAN).+ #[smithy(value_type = "Option<FingerprintType>")]+ pub fingerprint_type: Option<FingerprintType>,+#[schema(value_type = Option<BrowserInformation>)]/// The browser information used for this payment#[smithy(value_type = "Option<BrowserInformation>")]@@ -13445,6 +13452,19 @@ mod payments_response_api_contract {let stringified_payments_response = payments_response.encode_to_string_of_json();assert_eq!(stringified_payments_response.unwrap(), expected_response);}++ #[cfg(feature = "v1")]+ #[test]+ fn test_fingerprint_type_serialization() {+ assert_eq!(+ serde_json::to_value(FingerprintType::Dpan).unwrap(),+ serde_json::json!("dpan")+ );+ assert_eq!(+ serde_json::to_value(FingerprintType::Fpan).unwrap(),+ serde_json::json!("fpan")+ );+ }}/// Set of tests to extract billing details from payment method datadiff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 2a7186b4e1..8fefb55674 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -11057,6 +11057,30 @@ pub enum GooglePayAuthMethod {Cryptogram,}+#[derive(+ Clone,+ Copy,+ Debug,+ Eq,+ PartialEq,+ serde::Deserialize,+ serde::Serialize,+ SmithyModel,+ strum::Display,+ strum::EnumString,+ ToSchema,+)]+#[router_derive::diesel_enum(storage_type = "text")]+#[serde(rename_all = "snake_case")]+#[strum(serialize_all = "snake_case")]+#[smithy(namespace = "com.hyperswitch.smithy.types")]+pub enum FingerprintType {+ /// Device PAN used by tokenized wallets such as Apple Pay and Google Pay.+ Dpan,+ /// Funding PAN used by a directly supplied card.+ Fpan,+}+#[derive(Clone,Debug,diff --git a/crates/common_types/src/payments.rs b/crates/common_types/src/payments.rsindex ddae2e6adb..6998732382 100644--- a/crates/common_types/src/payments.rs+++ b/crates/common_types/src/payments.rs@@ -664,6 +664,11 @@ pub struct GpayEcryptedTokenizationData {#[smithy(namespace = "com.hyperswitch.smithy.types")]/// This struct represents the decrypted Google Pay payment datapub struct GPayPredecryptData {+ /// Indicates whether Google Pay supplied a funding PAN or a tokenized device PAN.+ #[schema(value_type = Option<GooglePayAuthMethod>)]+ #[smithy(value_type = "Option<GooglePayAuthMethod>")]+ pub auth_method: Option<common_enums::GooglePayAuthMethod>,+/// The card's expiry month#[schema(value_type = String)]#[smithy(value_type = "String")]diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rsindex 8004e6fe5d..9254301bb1 100644--- a/crates/diesel_models/src/payment_attempt.rs+++ b/crates/diesel_models/src/payment_attempt.rs@@ -173,6 +173,7 @@ pub struct PaymentAttempt {pub sender_payment_instrument_id: Option<String>,pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,pub applied_offer_details: Option<common_types::payments::AppliedOfferDetails>,+ pub fingerprint_type: Option<common_enums::FingerprintType>,#[diesel(deserialize_as = RequiredFromNullable<storage_enums::PaymentMethod>)]pub payment_method_type_v2: storage_enums::PaymentMethod,pub connector_payment_id: Option<ConnectorTransactionId>,@@ -312,6 +313,7 @@ pub struct PaymentAttempt {pub sender_payment_instrument_id: Option<String>,pub external_threeds_authentication_type: Option<common_enums::DecoupledAuthenticationType>,pub applied_offer_details: Option<common_types::payments::AppliedOfferDetails>,+ pub fingerprint_type: Option<common_enums::FingerprintType>,}#[cfg(feature = "v1")]@@ -531,6 +533,7 @@ pub struct PaymentAttemptNew {pub authentication_id: Option<id_type::AuthenticationId>,pub mandate_data: Option<storage_enums::MandateDetails>,pub fingerprint_id: Option<String>,+ pub fingerprint_type: Option<common_enums::FingerprintType>,pub payment_method_billing_address_id: Option<String>,pub client_source: Option<String>,pub client_version: Option<String>,@@ -589,6 +592,7 @@ pub enum PaymentAttemptUpdate {surcharge_amount: Option<MinorUnit>,tax_amount: Option<MinorUnit>,fingerprint_id: Option<String>,+ fingerprint_type: Option<common_enums::FingerprintType>,payment_method_billing_address_id: Option<String>,network_transaction_id: Option<String>,network_transaction_link_id: Option<String>,@@ -632,6 +636,7 @@ pub enum PaymentAttemptUpdate {surcharge_amount: Option<MinorUnit>,tax_amount: Option<MinorUnit>,fingerprint_id: Option<String>,+ fingerprint_type: Option<common_enums::FingerprintType>,updated_by: String,merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,payment_method_id: Option<String>,@@ -1113,6 +1118,7 @@ pub struct PaymentAttemptUpdateInternal {pub authentication_connector: Option<String>,pub authentication_id: Option<id_type::AuthenticationId>,pub fingerprint_id: Option<String>,+ pub fingerprint_type: Option<common_enums::FingerprintType>,pub payment_method_billing_address_id: Option<String>,pub client_source: Option<String>,pub client_version: Option<String>,@@ -2487,6 +2493,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {surcharge_amount,tax_amount,fingerprint_id,+ fingerprint_type,updated_by,payment_method_billing_address_id,network_transaction_id,@@ -2511,6 +2518,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {surcharge_amount,tax_amount,fingerprint_id,+ fingerprint_type,payment_method_billing_address_id,updated_by,sender_payment_instrument_id: None,@@ -2617,6 +2625,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -2678,6 +2687,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_id,payment_method_billing_address_id,fingerprint_id,+ fingerprint_type,payment_method_id,client_source,client_version,@@ -2724,6 +2734,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_id,payment_method_billing_address_id,fingerprint_id,+ fingerprint_type,payment_method_id,capture_method,client_source,@@ -2820,6 +2831,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -2902,6 +2914,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -2984,6 +2997,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3066,6 +3080,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3145,6 +3160,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3267,6 +3283,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_id: None,tokenization,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3370,6 +3387,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3445,6 +3463,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3534,6 +3553,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3629,6 +3649,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3721,6 +3742,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3802,6 +3824,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3883,6 +3906,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -3975,6 +3999,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -4054,6 +4079,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -4138,6 +4164,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {unified_code: None,unified_message: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -4232,6 +4259,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -4312,6 +4340,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -4398,6 +4427,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,@@ -4475,6 +4505,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {authentication_connector: None,authentication_id: None,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id: None,client_source: None,client_version: None,diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 78c1c375b3..aeefa59ac1 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -1257,6 +1257,8 @@ diesel::table! {#[max_length = 64]external_threeds_authentication_type -> Nullable<Varchar>,applied_offer_details -> Nullable<Jsonb>,+ #[max_length = 10]+ fingerprint_type -> Nullable<Varchar>,}}diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsindex df4da46b57..5bed5246a6 100644--- a/crates/diesel_models/src/schema_v2.rs+++ b/crates/diesel_models/src/schema_v2.rs@@ -1176,6 +1176,8 @@ diesel::table! {#[max_length = 64]external_threeds_authentication_type -> Nullable<Varchar>,applied_offer_details -> Nullable<Jsonb>,+ #[max_length = 10]+ fingerprint_type -> Nullable<Varchar>,payment_method_type_v2 -> Nullable<Varchar>,#[max_length = 128]connector_payment_id -> Nullable<Varchar>,diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rsindex e6303f2014..b121e6537c 100644--- a/crates/diesel_models/src/user/sample_data.rs+++ b/crates/diesel_models/src/user/sample_data.rs@@ -200,6 +200,7 @@ pub struct PaymentAttemptBatchNew {pub mandate_data: Option<MandateDetails>,pub payment_method_billing_address_id: Option<String>,pub fingerprint_id: Option<String>,+ pub fingerprint_type: Option<common_enums::FingerprintType>,pub charge_id: Option<String>,pub client_source: Option<String>,pub client_version: Option<String>,@@ -298,6 +299,7 @@ impl PaymentAttemptBatchNew {mandate_data: self.mandate_data,payment_method_billing_address_id: self.payment_method_billing_address_id,fingerprint_id: self.fingerprint_id,+ fingerprint_type: self.fingerprint_type,client_source: self.client_source,client_version: self.client_version,customer_acceptance: self.customer_acceptance,diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rsindex e03ae72570..d1add23448 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs@@ -1401,6 +1401,7 @@ pub struct PaymentAttempt {pub mandate_data: Option<MandateDetails>,pub payment_method_billing_address_id: Option<String>,pub fingerprint_id: Option<String>,+ pub fingerprint_type: Option<common_enums::FingerprintType>,pub charge_id: Option<String>,pub client_source: Option<String>,pub client_version: Option<String>,@@ -1997,6 +1998,7 @@ pub enum PaymentAttemptUpdate {amount_to_capture: Option<MinorUnit>,capture_method: Option<storage_enums::CaptureMethod>,fingerprint_id: Option<String>,+ fingerprint_type: Option<common_enums::FingerprintType>,payment_method_billing_address_id: Option<String>,updated_by: String,network_transaction_id: Option<String>,@@ -2045,6 +2047,7 @@ pub enum PaymentAttemptUpdate {authentication_id: Option<id_type::AuthenticationId>,payment_method_billing_address_id: Option<String>,fingerprint_id: Option<String>,+ fingerprint_type: Option<common_enums::FingerprintType>,payment_method_id: Option<String>,client_source: Option<String>,client_version: Option<String>,@@ -2260,6 +2263,7 @@ impl PaymentAttemptUpdate {amount_to_capture,capture_method,fingerprint_id,+ fingerprint_type,network_transaction_id,network_transaction_link_id,payment_method_billing_address_id,@@ -2282,6 +2286,7 @@ impl PaymentAttemptUpdate {surcharge_amount: net_amount.get_surcharge_amount(),tax_amount: net_amount.get_tax_on_surcharge(),fingerprint_id,+ fingerprint_type,payment_method_billing_address_id,network_transaction_id,network_transaction_link_id,@@ -2371,6 +2376,7 @@ impl PaymentAttemptUpdate {error_code,error_message,fingerprint_id,+ fingerprint_type,updated_by,merchant_connector_id: connector_id,payment_method_id,@@ -2414,6 +2420,7 @@ impl PaymentAttemptUpdate {surcharge_amount: net_amount.get_surcharge_amount(),tax_amount: net_amount.get_tax_on_surcharge(),fingerprint_id,+ fingerprint_type,updated_by,merchant_connector_id: connector_id,payment_method_id,@@ -3032,6 +3039,7 @@ impl behaviour::Conversion for PaymentAttempt {authentication_id: self.authentication_id,mandate_data: self.mandate_data.map(Into::into),fingerprint_id: self.fingerprint_id,+ fingerprint_type: self.fingerprint_type,payment_method_billing_address_id: self.payment_method_billing_address_id,charge_id: self.charge_id,client_source: self.client_source,@@ -3176,6 +3184,7 @@ impl behaviour::Conversion for PaymentAttempt {mandate_data: storage_model.mandate_data.map(Into::into),payment_method_billing_address_id: storage_model.payment_method_billing_address_id,fingerprint_id: storage_model.fingerprint_id,+ fingerprint_type: storage_model.fingerprint_type,charge_id: storage_model.charge_id,client_source: storage_model.client_source,client_version: storage_model.client_version,@@ -3288,6 +3297,7 @@ impl behaviour::Conversion for PaymentAttempt {authentication_id: self.authentication_id,mandate_data: self.mandate_data.map(Into::into),fingerprint_id: self.fingerprint_id,+ fingerprint_type: self.fingerprint_type,payment_method_billing_address_id: self.payment_method_billing_address_id,client_source: self.client_source,client_version: self.client_version,diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rsindex a8b9cae264..0786fa6e1c 100644--- a/crates/hyperswitch_domain_models/src/router_data.rs+++ b/crates/hyperswitch_domain_models/src/router_data.rs@@ -574,6 +574,7 @@ impl TryFrom<ApplePayPredecryptDataInternal> for common_payment_types::ApplePayPimpl From<GooglePayPredecryptDataInternal> for common_payment_types::GPayPredecryptData {fn from(data: GooglePayPredecryptDataInternal) -> Self {Self {+ auth_method: Some(data.payment_method_details.auth_method),card_exp_month: Secret::new(data.payment_method_details.expiration_month.two_digits()),card_exp_year: Secret::new(data.payment_method_details.expiration_year.four_digits()),application_primary_account_number: data.payment_method_details.pan.clone(),diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex 68ca1fab7d..1feb78830c 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -301,6 +301,7 @@ Never share your secret api keys. Keep them guarded and secure.common_types::connector_webhook_configuration::WebhookConfigType,common_types::payments::GpayTokenizationData,common_types::payments::GPayPredecryptData,+ api_models::enums::GooglePayAuthMethod,common_types::payments::GpayEcryptedTokenizationData,common_types::payments::ApplePayPaymentData,common_types::payments::ApplePayPredecryptData,@@ -654,6 +655,7 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payments::PaymentsUpdateRequest,api_models::payments::PaymentsConfirmRequest,api_models::payments::PaymentsResponse,+ api_models::payments::FingerprintType,api_models::payments::PaymentsCreateResponseOpenApi,api_models::payments::EligibilityCard,api_models::payments::EligibilityPaymentMethodData,diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rsindex 2303653240..957b8a8318 100644--- a/crates/openapi/src/openapi_v2.rs+++ b/crates/openapi/src/openapi_v2.rs@@ -221,6 +221,7 @@ Never share your secret api keys. Keep them guarded and secure.common_types::payments::SplitPaymentsRequest,common_types::payments::GpayTokenizationData,common_types::payments::GPayPredecryptData,+ api_models::enums::GooglePayAuthMethod,common_types::payments::GpayEcryptedTokenizationData,common_types::payments::ApplePayPaymentData,common_types::payments::ApplePayPredecryptData,diff --git a/crates/router/src/core/blocklist/utils.rs b/crates/router/src/core/blocklist/utils.rsindex 028b398d67..058b3bb7d9 100644--- a/crates/router/src/core/blocklist/utils.rs+++ b/crates/router/src/core/blocklist/utils.rs@@ -590,12 +590,14 @@ where}.into())} else {- payment_data.payment_attempt.fingerprint_id = generate_payment_fingerprint(+ let (fingerprint_id, fingerprint_type) = generate_payment_fingerprint(state,processor.get_account(),payment_data.payment_method_data.clone(),).await?;+ payment_data.payment_attempt.fingerprint_id = fingerprint_id;+ payment_data.payment_attempt.fingerprint_type = fingerprint_type;Ok(false)}}@@ -772,32 +774,68 @@ pub async fn generate_payment_fingerprint(state: &SessionState,merchant_account: &domain::MerchantAccount,payment_method_data: Option<domain::PaymentMethodData>,-) -> CustomResult<Option<String>, errors::ApiErrorResponse> {+) -> CustomResult<(Option<String>, Option<common_enums::FingerprintType>), errors::ApiErrorResponse>+{let merchant_fingerprint_secret =get_merchant_fingerprint_secret(state, merchant_account).await?;- Ok(- if let Some(domain::PaymentMethodData::Card(card)) = payment_method_data.as_ref() {- generate_fingerprint_and_get_id(+ let fingerprint_source = payment_method_data+ .as_ref()+ .and_then(|payment_method_data| match payment_method_data {+ domain::PaymentMethodData::Card(card) => {+ Some((&card.card_number, common_enums::FingerprintType::Fpan))+ }+ domain::PaymentMethodData::Wallet(domain::WalletData::ApplePay(apple_pay)) => apple_pay+ .payment_data+ .get_decrypted_apple_pay_payment_data_optional()+ .map(|decrypted_data| {+ (+ &decrypted_data.application_primary_account_number,+ common_enums::FingerprintType::Dpan,+ )+ }),+ domain::PaymentMethodData::Wallet(domain::WalletData::GooglePay(google_pay)) => {+ google_pay+ .tokenization_data+ .get_decrypted_google_pay_payment_data_optional()+ .and_then(|decrypted_data| match decrypted_data.auth_method {+ Some(common_enums::GooglePayAuthMethod::PanOnly) => Some((+ &decrypted_data.application_primary_account_number,+ common_enums::FingerprintType::Fpan,+ )),+ Some(common_enums::GooglePayAuthMethod::Cryptogram) => Some((+ &decrypted_data.application_primary_account_number,+ common_enums::FingerprintType::Dpan,+ )),+ None => None,+ })+ }+ _ => None,+ });++ let (fingerprint_id, fingerprint_type) = match fingerprint_source {+ Some((pan, fingerprint_type)) => {+ let fingerprint_id = generate_fingerprint_and_get_id(state,- StrongSecret::new(card.card_number.get_card_no()),+ StrongSecret::new(pan.get_card_no()),StrongSecret::new(merchant_fingerprint_secret),).await.attach_printable("error in pm fingerprint creation")- .map_or_else(- |error| {- logger::error!(?error);- None- },- Some,- )- .map(|payload| payload.fingerprint_id)- } else {- logger::error!("failed to retrieve card fingerprint");- None- },- )+ .inspect_err(|error| logger::error!(?error))+ .ok()+ .map(|payload| payload.fingerprint_id);++ let fingerprint_type = fingerprint_id.is_some().then_some(fingerprint_type);+ (fingerprint_id, fingerprint_type)+ }+ None => {+ logger::debug!("payment method does not contain a PAN that can be fingerprinted");+ (None, None)+ }+ };++ Ok((fingerprint_id, fingerprint_type))}#[cfg(test)]diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex c53507e35a..74bcb70651 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -5695,6 +5695,7 @@ impl AttemptType {// New payment method billing address can be passed for a retrypayment_method_billing_address_id: None,fingerprint_id: None,+ fingerprint_type: None,client_source: old_payment_attempt.client_source,client_version: old_payment_attempt.client_version,customer_acceptance: old_payment_attempt.customer_acceptance,diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex e2af67a9c0..af12e72b7b 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -2778,6 +2778,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> forlet m_error_code = error_code.clone();let m_error_message = error_message.clone();let m_fingerprint_id = payment_data.payment_attempt.fingerprint_id.clone();+ let m_fingerprint_type = payment_data.payment_attempt.fingerprint_type;let m_db = state.clone().store;let surcharge_amount = payment_data.payment_attempt@@ -2852,6 +2853,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> forauthentication_id,payment_method_billing_address_id,fingerprint_id: m_fingerprint_id,+ fingerprint_type: m_fingerprint_type,payment_method_id: m_payment_method_id,client_source,client_version,diff --git a/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs b/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rsindex b4f2ec5d3b..9ca0ede3b6 100644--- a/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs+++ b/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs@@ -580,6 +580,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsRequest>.payment_method_billing_address_id.clone(),fingerprint_id: payment_data.payment_attempt.fingerprint_id.clone(),+ fingerprint_type: payment_data.payment_attempt.fingerprint_type,payment_method_id: payment_data.payment_attempt.payment_method_id.clone(),client_source: None,client_version: None,diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex ca798db656..8725a069a5 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -1707,6 +1707,7 @@ impl PaymentCreate {unified_code: None,unified_message: None,fingerprint_id: None,+ fingerprint_type: None,authentication_connector: None,authentication_id: None,client_source: None,diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rsindex a0543a62f6..7ad683c906 100644--- a/crates/router/src/core/payments/operations/payment_update.rs+++ b/crates/router/src/core/payments/operations/payment_update.rs@@ -1166,6 +1166,7 @@ impl PaymentUpdate {amount_to_capture,capture_method,fingerprint_id: None,+ fingerprint_type: None,payment_method_billing_address_id,updated_by: storage_scheme.to_string(),network_transaction_id,diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rsindex 50336473b4..ed4a3d155e 100644--- a/crates/router/src/core/payments/retry.rs+++ b/crates/router/src/core/payments/retry.rs@@ -846,6 +846,7 @@ pub fn make_new_auto_retry_payment_attempt(mandate_data: Default::default(),payment_method_billing_address_id: Default::default(),fingerprint_id: Default::default(),+ fingerprint_type: Default::default(),customer_acceptance: Default::default(),connector_mandate_detail: Default::default(),request_extended_authorization: Default::default(),diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 67914b09a8..76c9bb44f5 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -4377,6 +4377,7 @@ where.external_three_ds_authentication_attempted,expires_on: payment_intent.session_expiry,fingerprint: payment_intent.fingerprint_id,+ fingerprint_type: payment_attempt.fingerprint_type,browser_info: payment_attempt.browser_info,payment_method_id: payment_attempt.payment_method_id,network_transaction_id: payment_attempt.network_transaction_id,@@ -4790,7 +4791,8 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Payexternal_authentication_details: None,external_3ds_authentication_attempted: None,expires_on: None,- fingerprint: None,+ fingerprint: pa.fingerprint_id,+ fingerprint_type:pa.fingerprint_type,browser_info: None,payment_method_id: None,payment_method_status: None,diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rsindex c95e8d3878..00d94188a8 100644--- a/crates/router/src/db/events.rs+++ b/crates/router/src/db/events.rs@@ -2179,6 +2179,7 @@ mod tests {external_3ds_authentication_attempted: None,expires_on: None,fingerprint: None,+ fingerprint_type: None,browser_info: None,payment_method_id: None,payment_method_status: None,diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rsindex 9f19dd94d3..d5a9895641 100644--- a/crates/router/src/types/storage/payment_attempt.rs+++ b/crates/router/src/types/storage/payment_attempt.rs@@ -215,6 +215,7 @@ mod tests {mandate_data: Default::default(),payment_method_billing_address_id: Default::default(),fingerprint_id: Default::default(),+ fingerprint_type: Default::default(),client_source: Default::default(),client_version: Default::default(),customer_acceptance: Default::default(),@@ -340,6 +341,7 @@ mod tests {mandate_data: Default::default(),payment_method_billing_address_id: Default::default(),fingerprint_id: Default::default(),+ fingerprint_type: Default::default(),client_source: Default::default(),client_version: Default::default(),customer_acceptance: Default::default(),@@ -479,6 +481,7 @@ mod tests {mandate_data: Default::default(),payment_method_billing_address_id: Default::default(),fingerprint_id: Default::default(),+ fingerprint_type: Default::default(),client_source: Default::default(),client_version: Default::default(),customer_acceptance: Default::default(),diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rsindex ebff601c02..4e85492447 100644--- a/crates/router/src/utils/user/sample_data.rs+++ b/crates/router/src/utils/user/sample_data.rs@@ -378,6 +378,7 @@ pub async fn generate_sample_data(mandate_data: None,payment_method_billing_address_id: None,fingerprint_id: None,+ fingerprint_type: None,charge_id: None,client_source: None,client_version: None,diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rsindex 046963ba51..682dfb0dd1 100644--- a/crates/router/tests/payments.rs+++ b/crates/router/tests/payments.rs@@ -448,6 +448,7 @@ async fn payments_create_core() {external_3ds_authentication_attempted: None,expires_on: None,fingerprint: None,+ fingerprint_type: None,mit_category: None,tokenization: None,browser_info: None,@@ -756,6 +757,7 @@ async fn payments_create_core_adyen_no_redirect() {external_3ds_authentication_attempted: None,expires_on: None,fingerprint: None,+ fingerprint_type: None,browser_info: None,mit_category: None,tokenization: None,diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rsindex a651c6b371..0544005694 100644--- a/crates/router/tests/payments2.rs+++ b/crates/router/tests/payments2.rs@@ -208,6 +208,7 @@ async fn payments_create_core() {external_3ds_authentication_attempted: None,expires_on: None,fingerprint: None,+ fingerprint_type: None,browser_info: None,payment_method_id: None,payment_method_status: None,@@ -525,6 +526,7 @@ async fn payments_create_core_adyen_no_redirect() {external_3ds_authentication_attempted: None,expires_on: None,fingerprint: None,+ fingerprint_type: None,browser_info: None,payment_method_id: None,payment_method_status: None,diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rsindex 0b93dfcc71..84f9769394 100644--- a/crates/storage_impl/src/mock_db/payment_attempt.rs+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs@@ -221,6 +221,7 @@ impl PaymentAttemptInterface for MockDb {mandate_data: payment_attempt.mandate_data,payment_method_billing_address_id: payment_attempt.payment_method_billing_address_id,fingerprint_id: payment_attempt.fingerprint_id,+ fingerprint_type: payment_attempt.fingerprint_type,client_source: payment_attempt.client_source,client_version: payment_attempt.client_version,customer_acceptance: payment_attempt.customer_acceptance,diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rsindex d67009d403..9cd5db9dfa 100644--- a/crates/storage_impl/src/payments/payment_attempt.rs+++ b/crates/storage_impl/src/payments/payment_attempt.rs@@ -778,6 +778,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {.payment_method_billing_address_id.clone(),fingerprint_id: payment_attempt.fingerprint_id.clone(),+ fingerprint_type: payment_attempt.fingerprint_type,client_source: payment_attempt.client_source.clone(),client_version: payment_attempt.client_version.clone(),customer_acceptance: payment_attempt.customer_acceptance.clone(),@@ -2283,6 +2284,7 @@ impl Conversion for PaymentAttempt {installment_data: None,external_surcharge_details: None,applied_offer_details,+ fingerprint_type: None,sender_payment_instrument_id: None,})}diff --git a/migrations/2026-08-25-000001_add_fingerprint_type_to_payment_attempt/down.sql b/migrations/2026-08-25-000001_add_fingerprint_type_to_payment_attempt/down.sqlnew file mode 100644index 0000000000..48962803fc--- /dev/null+++ b/migrations/2026-08-25-000001_add_fingerprint_type_to_payment_attempt/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+ALTER TABLE payment_attempt DROP COLUMN IF EXISTS fingerprint_type;diff --git a/migrations/2026-08-25-000001_add_fingerprint_type_to_payment_attempt/up.sql b/migrations/2026-08-25-000001_add_fingerprint_type_to_payment_attempt/up.sqlnew file mode 100644index 0000000000..48037c8a52--- /dev/null+++ b/migrations/2026-08-25-000001_add_fingerprint_type_to_payment_attempt/up.sql@@ -0,0 +1,2 @@+-- Your SQL goes here+ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS fingerprint_type VARCHAR(10);