Skip to content

feat(connector): [BRAINTREE] Add support for external 3DS pass-through authentication#10591

Merged
likhinbopanna merged 3 commits intomainfrom
feat-add-external-3ds-braintree
Dec 15, 2025
Merged

feat(connector): [BRAINTREE] Add support for external 3DS pass-through authentication#10591
likhinbopanna merged 3 commits intomainfrom
feat-add-external-3ds-braintree

Conversation

@awasthi21
Copy link
Contributor

@awasthi21 awasthi21 commented Dec 10, 2025

Type of Change

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

Description

Added support for external 3ds braintree

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?

Request:

curl --location 'https://ee65ed7a541d.ngrok-free.app/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_3H799xNzqNWAGpxRoN1DTVH0wfTww2GlAyUbvVlAoUYaLrb2h8LWcoGAltRag6RJ' \
--data-raw '{
    "amount": 11010,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-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": "13.232.74.226"
    },
    "customer_id": "customer123uuhuhuhuhuhuhuhuhuhuhuhuh",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://google.com",
    "request_external_three_ds_authentication":true,
    
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "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"
    }
}
'

Response

{
    "payment_id": "pay_IMYcHJw4BVmMKo0O8Azr",
    "merchant_id": "postman_merchant_GHAction_6c826d74-b103-4837-a066-64486bf29581",
    "status": "requires_customer_action",
    "amount": 11010,
    "net_amount": 11010,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "braintree",
    "client_secret": "pay_IMYcHJw4BVmMKo0O8Azr_secret_mWDBb7shrVGqt5QCf2iQ",
    "created": "2025-12-10T06:12:58.577Z",
    "modified_at": "2025-12-10T06:12:59.296Z",
    "currency": "USD",
    "customer_id": "customer123uuhuhuhuhuhuhuhuhuhuhuh",
    "customer": {
        "id": "customer123uuhuhuhuhuhuhuhuhuhuhuh",
        "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": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "50",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_ggaeTF0uprTmRKzPXonb",
    "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": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "three_ds_invoke",
        "three_ds_data": {
            "three_ds_authentication_url": "http://localhost:8080/payments/pay_IMYcHJw4BVmMKo0O8Azr/3ds/authentication",
            "three_ds_authorize_url": "http://localhost:8080/payments/pay_IMYcHJw4BVmMKo0O8Azr/postman_merchant_GHAction_6c826d74-b103-4837-a066-64486bf29581/authorize/braintree",
            "three_ds_method_details": {
                "three_ds_method_data_submission": false,
                "three_ds_method_data": null,
                "three_ds_method_url": null,
                "three_ds_method_key": null,
                "consume_post_message_for_three_ds_method_completion": false
            },
            "poll_config": {
                "poll_id": "external_authentication_pay_IMYcHJw4BVmMKo0O8Azr",
                "delay_in_secs": 2,
                "frequency": 5
            },
            "message_version": "2.2.0",
            "directory_server_id": null,
            "card_network": null,
            "three_ds_connector": "juspaythreedsserver"
        }
    },
    "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,
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_D4PIBnDi36WtbJ5x0xTd",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_NHrCuN1fdt4slAtHjmqB",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": {
        "authentication_flow": null,
        "electronic_commerce_indicator": null,
        "status": "pending",
        "ds_transaction_id": "ce2f7b0c-ed08-432a-a6c8-c7196be7d0bf",
        "version": "2.2.0",
        "error_code": null,
        "error_message": null
    },
    "external_3ds_authentication_attempted": true,
    "expires_on": "2025-12-10T06:27:58.577Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "13.232.74.226",
        "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_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-12-10T06:12:59.296Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": 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,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": null
}

Request

curl --location 'https://ee65ed7a541d.ngrok-free.app/payments/pay_IMYcHJw4BVmMKo0O8Azr/3ds/authentication' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_53b609c7613f48c3a23c0e2b90952fe7' \
--data '{
    "client_secret": "pay_IMYcHJw4BVmMKo0O8Azr_secret_mWDBb7shrVGqt5QCf2iQ",
    "device_channel": "BRW",
    "threeds_method_comp_ind": "N"
}'

Response

{
    "trans_status": "C",
    "acs_url": "https://mock-three-ds-server-small-lake-1937.fly.dev/processor/mock/acs/trigger-otp?redirectUrl=http%3A%2F%2Flocalhost%3A8080%2Fpayments%2Fpay_IMYcHJw4BVmMKo0O8Azr%2Fpostman_merchant_GHAction_6c826d74-b103-4837-a066-64486bf29581%2Fauthorize%2Fbraintree",
    "challenge_request": "eyJtZXNzYWdlVHlwZSI6IkNSZXEiLCJ0aHJlZURTU2VydmVyVHJhbnNJRCI6ImNlMmY3YjBjLWVkMDgtNDMyYS1hNmM4LWM3MTk2YmU3ZDBiZiIsImFjc1RyYW5zSUQiOiIwM2NlYjhhOS1mOTczLTQ5NjMtYmE0Zi05MGYxM2YyYjIzOTEiLCJjaGFsbGVuZ2VXaW5kb3dTaXplIjoiMDEiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMi4wIn0=",
    "challenge_request_key": "creq",
    "acs_reference_number": "03ceb8a9-f973-4963-ba4f-90f13f2b2391",
    "acs_trans_id": "03ceb8a9-f973-4963-ba4f-90f13f2b2391",
    "three_dsserver_trans_id": "ce2f7b0c-ed08-432a-a6c8-c7196be7d0bf",
    "acs_signed_content": null,
    "three_ds_requestor_url": "https://google.com",
    "three_ds_requestor_app_url": null
}
Screenshot 2025-12-10 at 11 59 48 AM

Sync Response

{
    "payment_id": "pay_IMYcHJw4BVmMKo0O8Azr",
    "merchant_id": "postman_merchant_GHAction_6c826d74-b103-4837-a066-64486bf29581",
    "status": "succeeded",
    "amount": 11010,
    "net_amount": 11010,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 11010,
    "connector": "braintree",
    "client_secret": "pay_IMYcHJw4BVmMKo0O8Azr_secret_mWDBb7shrVGqt5QCf2iQ",
    "created": "2025-12-10T06:12:58.577Z",
    "modified_at": "2025-12-10T06:17:25.528Z",
    "currency": "USD",
    "customer_id": "customer123uuhuhuhuhuhuhuhuhuhuhuh",
    "customer": {
        "id": "customer123uuhuhuhuhuhuhuhuhuhuhuh",
        "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": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "50",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_ggaeTF0uprTmRKzPXonb",
    "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": "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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "dHJhbnNhY3Rpb25fOG00MHM4cDg",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": {
            "param": "transStatus=Y&threeDSServerTransID=ce2f7b0c-ed08-432a-a6c8-c7196be7d0bf",
            "json_payload": {}
        },
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_D4PIBnDi36WtbJ5x0xTd",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_NHrCuN1fdt4slAtHjmqB",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": {
        "authentication_flow": "challenge",
        "electronic_commerce_indicator": "02",
        "status": "success",
        "ds_transaction_id": "ce2f7b0c-ed08-432a-a6c8-c7196be7d0bf",
        "version": "2.2.0",
        "error_code": null,
        "error_message": null
    },
    "external_3ds_authentication_attempted": true,
    "expires_on": "2025-12-10T06:27:58.577Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "13.232.74.226",
        "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_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-12-10T06:17:25.528Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": 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,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": 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 requested a review from a team as a code owner December 10, 2025 06:26
@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 10, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/common_enums/src/connector_enums.rs  82% smaller
  crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs  4% smaller

@awasthi21 awasthi21 changed the title Feat add external 3ds braintree feat(connector): Add support for external 3DS pass-through authentication Dec 10, 2025
@awasthi21 awasthi21 self-assigned this Dec 10, 2025
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 0% with 44 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@c9dff2c). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...onnectors/src/connectors/braintree/transformers.rs 0.00% 43 Missing ⚠️
crates/common_enums/src/connector_enums.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10591   +/-   ##
=======================================
  Coverage        ?    6.44%           
=======================================
  Files           ?     1254           
  Lines           ?   313370           
  Branches        ?        0           
=======================================
  Hits            ?    20208           
  Misses          ?   293162           
  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.

@deepanshu-iiitu deepanshu-iiitu changed the title feat(connector): Add support for external 3DS pass-through authentication feat(connector): [BRAINTREE] Add support for external 3DS pass-through authentication Dec 10, 2025
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub directory_server_response: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: this field could have been a enum

@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 15, 2025
Merged via the queue into main with commit c844cbf Dec 15, 2025
38 of 39 checks passed
@likhinbopanna likhinbopanna deleted the feat-add-external-3ds-braintree branch December 15, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants