Skip to content

feat(core): Support skipping PSP tokenization in payment and mandate flows#10074

Merged
likhinbopanna merged 8 commits intomainfrom
mit-flag-on-hs-store
Nov 18, 2025
Merged

feat(core): Support skipping PSP tokenization in payment and mandate flows#10074
likhinbopanna merged 8 commits intomainfrom
mit-flag-on-hs-store

Conversation

@awasthi21
Copy link
Contributor

@awasthi21 awasthi21 commented Oct 31, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Introduces a new enum tokenization allowing merchants to disable PSP-side token creation and rely solely on Hyperswitch-managed tokens.
Applies to both payment and mandate flows.


Database

Added column to payment_intent schema and models:

tokenization -> Nullable<varchar>

Connector Layer (Cybersource)

This is the functional part:

Adjusted CybersourceZeroMandateRequest and authorization logic:

  • If `tokenization == Some(SkipPsp) → don’t send tokenization fields.
  • Else → retain original token creation behavior.

Essentially:

if tokenization {
    // Skip tokenization completely
    (None, None, Some(CybersourceAuthorizationOptions { ... }))
} else {
    // Normal flow with TOKEN_CREATE and token types
}

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

CIT (Existing flow)

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_lnC8hfrC3uiRHolkLsACt0DT07OekrLHv5WUIX7inHpXLGDAx8QtdDFLhZe9o6br' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    
    "customer_id": "Bambora1Customer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4456530000001096",
            "card_exp_month": "01",
            "card_exp_year": "50",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    
    "setup_future_usage": "off_session",
    "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"
        }
    }
  
    
    
}'

Response

{
    "payment_id": "pay_9n9xXA6msFkshD6f1KEb",
    "merchant_id": "postman_merchant_GHAction_9107e8b2-3a7a-42f5-9480-0a6590b387a3",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "cybersource",
    "client_secret": "pay_9n9xXA6msFkshD6f1KEb_secret_TiQFPqwqGvG86o3Mwixc",
    "created": "2025-10-31T10:28:28.315Z",
    "currency": "USD",
    "customer_id": "Bambora1Customer",
    "customer": {
        "id": "Bambora1Customer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1096",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "445653",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "50",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_pm9ztBC73xkWPlo8SlRU",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": 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": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Bambora1Customer",
        "created_at": 1761906508,
        "expires": 1761910108,
        "secret": "epk_9a63bf2aaaab4604a760d694656c9320"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "7619065085666960903812",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_9n9xXA6msFkshD6f1KEb_1",
    "payment_link": null,
    "profile_id": "pro_WwnBiHi4vstc37HbGCmD",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_nU2i0sAZeJXkNQa3mAXX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-10-31T10:43:28.315Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": "pm_F7NzOD6gaotgZzLwLRPR",
    "network_transaction_id": "016150703802094",
    "payment_method_status": "active",
    "updated": "2025-10-31T10:28:29.378Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "4272C92E10D777EEE063AF598E0A16DB",
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null,
    "tokenization": null
}

CIT By passing "tokenization":"skip_psp", (We will not receive the ConnectorMandateDetails)

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_lnC8hfrC3uiRHolkLsACt0DT07OekrLHv5WUIX7inHpXLGDAx8QtdDFLhZe9o6br' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    
    "customer_id": "Bambora1Customer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "tokenization":"skip_psp",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4456530000001096",
            "card_exp_month": "01",
            "card_exp_year": "50",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    
    "setup_future_usage": "off_session",
    "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"
        }
    }

}'

Response

{
    "payment_id": "pay_ksCrBEwprK4wW34fBNyW",
    "merchant_id": "postman_merchant_GHAction_9107e8b2-3a7a-42f5-9480-0a6590b387a3",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "cybersource",
    "client_secret": "pay_ksCrBEwprK4wW34fBNyW_secret_z22KgVh5Gwh1fyXTKfUb",
    "created": "2025-10-31T10:29:50.267Z",
    "currency": "USD",
    "customer_id": "Bambora1Customer",
    "customer": {
        "id": "Bambora1Customer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1096",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "445653",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "50",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_CVECGYZry3kJyNHGk3CG",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": 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": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "Bambora1Customer",
        "created_at": 1761906590,
        "expires": 1761910190,
        "secret": "epk_d82bd5e63cb547279acbddebc1e2800d"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "7619065905286325003814",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_ksCrBEwprK4wW34fBNyW_1",
    "payment_link": null,
    "profile_id": "pro_WwnBiHi4vstc37HbGCmD",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_nU2i0sAZeJXkNQa3mAXX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-10-31T10:44:50.267Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": "pm_lMZE83gmXgyKXaC6Amdh",
    "network_transaction_id": "016150703802094",
    "payment_method_status": "active",
    "updated": "2025-10-31T10:29:51.188Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null,
    "tokenization":"skip_psp",
}

MIT via the Received NTID

curl --location 'http://localhost:8080/payments' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_lnC8hfrC3uiRHolkLsACt0DT07OekrLHv5WUIX7inHpXLGDAx8QtdDFLhZe9o6br' \
--data-raw '{
    "amount": 7445,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 7445,
    "customer_id": "cu_1757579182",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "payment_method": "card",
    "payment_method_type": "credit",
 
    "recurring_details": {
        "type": "network_transaction_id_and_card_details",
        "data": {
            "card_number": "4456530000001096",
            "card_exp_month": "01",
            "card_exp_year": "50",
            "card_network":"VISA",
            "network_transaction_id": "016150703802094"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    }
}'

Response

{
    "payment_id": "pay_4zQzMswv4UzzB9Dvx6wm",
    "merchant_id": "postman_merchant_GHAction_9107e8b2-3a7a-42f5-9480-0a6590b387a3",
    "status": "succeeded",
    "amount": 7445,
    "net_amount": 7445,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 7445,
    "connector": "cybersource",
    "client_secret": "pay_4zQzMswv4UzzB9Dvx6wm_secret_UBTvq345G7GMypuDHE3H",
    "created": "2025-10-31T10:50:06.028Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "Joseph Doe",
        "email": "something@gmail.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": "card",
    "payment_method_data": {
        "card": {
            "last4": "1096",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "445653",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "50",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": "cybersource_US_default_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1757579182",
        "created_at": 1761907806,
        "expires": 1761911406,
        "secret": "epk_338b7bf4beca4212a7e9921f6b1ddb8e"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "7619078062826266203812",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_4zQzMswv4UzzB9Dvx6wm_1",
    "payment_link": null,
    "profile_id": "pro_WwnBiHi4vstc37HbGCmD",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_nU2i0sAZeJXkNQa3mAXX",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-10-31T11:05:06.028Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "016150703802094",
    "payment_method_status": null,
    "updated": "2025-10-31T10:50:06.906Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": true,
    "mit_category": null,
    "tokenization": null
}

Checklist

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

@awasthi21 awasthi21 self-assigned this Oct 31, 2025
@awasthi21 awasthi21 requested review from a team as code owners October 31, 2025 06:19
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 31, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments/operations/payment_confirm.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs  62% smaller
  crates/openapi/src/openapi.rs  28% smaller
  crates/openapi/src/openapi_v2.rs  28% smaller
  api-reference/v1/openapi_spec_v1.json  0% smaller
  api-reference/v2/openapi_spec_v2.json  0% smaller
  crates/api_models/src/payments.rs  0% smaller
  crates/common_enums/src/enums.rs  0% smaller
  crates/diesel_models/src/payment_attempt.rs  0% smaller
  crates/diesel_models/src/payment_intent.rs  0% smaller
  crates/diesel_models/src/schema.rs  0% smaller
  crates/diesel_models/src/schema_v2.rs  0% smaller
  crates/diesel_models/src/user/sample_data.rs  0% smaller
  crates/hyperswitch_connectors/src/utils.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_attempt.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_intent.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_request_types.rs  0% smaller
  crates/router/src/core/payments/helpers.rs  0% smaller
  crates/router/src/core/payments/operations/payment_create.rs  0% smaller
  crates/router/src/core/payments/operations/payment_response.rs  0% smaller
  crates/router/src/core/payments/retry.rs  0% smaller
  crates/router/src/core/payments/transformers.rs  0% smaller
  crates/router/src/core/webhooks/incoming.rs  0% smaller
  crates/router/src/db/events.rs  0% smaller
  crates/router/src/types.rs  0% smaller
  crates/router/src/types/api/verify_connector.rs  0% smaller
  crates/router/src/types/storage/payment_attempt.rs  0% smaller
  crates/router/src/utils/user/sample_data.rs  0% smaller
  crates/router/tests/connectors/utils.rs  0% smaller
  crates/router/tests/payments.rs  0% smaller
  crates/router/tests/payments2.rs  0% smaller
  crates/storage_impl/src/mock_db/payment_attempt.rs  0% smaller
  crates/storage_impl/src/payments/payment_attempt.rs  0% smaller
  migrations/2025-11-12-043628_add_tokenization_payment_intent/down.sql Unsupported file format
  migrations/2025-11-12-043628_add_tokenization_payment_intent/up.sql Unsupported file format
  migrations/2025-11-12-075136_add_tokenization_field_in_payment_attempt/down.sql Unsupported file format
  migrations/2025-11-12-075136_add_tokenization_field_in_payment_attempt/up.sql Unsupported file format

@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Oct 31, 2025
@awasthi21 awasthi21 changed the title Initial commit feat(core): Support skipping PSP tokenization in payment and mandate flows Oct 31, 2025
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 5.30973% with 107 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@414a8d8). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...nectors/src/connectors/cybersource/transformers.rs 0.00% 100 Missing ⚠️
crates/router/src/core/payments/transformers.rs 0.00% 3 Missing ⚠️
crates/common_enums/src/enums.rs 0.00% 1 Missing ⚠️
crates/diesel_models/src/payment_intent.rs 0.00% 1 Missing ⚠️
crates/router/src/types.rs 0.00% 1 Missing ⚠️
crates/router/src/types/api/verify_connector.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10074   +/-   ##
=======================================
  Coverage        ?    6.49%           
=======================================
  Files           ?     1238           
  Lines           ?   309209           
  Branches        ?        0           
=======================================
  Hits            ?    20090           
  Misses          ?   289119           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch from f6a659e to ded0afc Compare October 31, 2025 06:39
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Oct 31, 2025
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch from 94000ec to 7c150a0 Compare October 31, 2025 07:00
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Oct 31, 2025
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch 2 times, most recently from ebcfe22 to d148ec0 Compare November 4, 2025 20:30
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch 2 times, most recently from d687046 to 771abf3 Compare November 10, 2025 08:40
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Nov 10, 2025
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch from 5c3d826 to 26715fe Compare November 10, 2025 09:33
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 10, 2025
Copy link
Contributor

@ShankarSinghC ShankarSinghC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to have a column in the payment attempt as well that can store the what type of tokenization was applied for the payment

For example,
tokenization: skip_psp is sent in the payment request, and this value is stored as is.
After running the application logic, it may turn out that the connector chosen for the payment does not support this feature.
In such a case, we need to override that feature to store_psp or do_default, and this updated value should be stored in the payment attempt.
This would also help in case of retries.

@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 10, 2025
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch from d7e608e to c65f263 Compare November 12, 2025 12:04
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Nov 12, 2025
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch from 0cb833c to 1e1edfe Compare November 13, 2025 07:37
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Nov 13, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 13, 2025
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch from 3172776 to 7f7078f Compare November 13, 2025 08:25
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Nov 13, 2025
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch from 11e531a to 9fd3ff8 Compare November 13, 2025 11:14
@awasthi21 awasthi21 force-pushed the mit-flag-on-hs-store branch from 9fd3ff8 to 037c3a4 Compare November 13, 2025 11:17
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 13, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Nov 13, 2025
ShankarSinghC
ShankarSinghC previously approved these changes Nov 18, 2025
Comment on lines +44 to +48
if self.connector_mandate_id.is_some() {
Some(common_enums::Tokenization::TokenizeAtPsp)
} else {
Some(common_enums::Tokenization::SkipPsp)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
if self.connector_mandate_id.is_some() {
Some(common_enums::Tokenization::TokenizeAtPsp)
} else {
Some(common_enums::Tokenization::SkipPsp)
}
self.connector_mandate_id
.map(|_| common_enums::Tokenization::TokenizeAtPsp)
.unwrap_or(common_enums::Tokenization::SkipPsp)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

@likhinbopanna likhinbopanna added this pull request to the merge queue Nov 18, 2025
Merged via the queue into main with commit 5910322 Nov 18, 2025
25 of 27 checks passed
@likhinbopanna likhinbopanna deleted the mit-flag-on-hs-store branch November 18, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-api-contract-changes Metadata: This PR involves API contract changes M-database-changes Metadata: This PR involves database schema changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants