Skip to content

feat(connector): enhance ACI connector with comprehensive 3DS support - DRAFT#8986

Merged
likhinbopanna merged 6 commits intojuspay:mainfrom
peach-payments:ORCH-2/aci-update/rel.116
Sep 10, 2025
Merged

feat(connector): enhance ACI connector with comprehensive 3DS support - DRAFT#8986
likhinbopanna merged 6 commits intojuspay:mainfrom
peach-payments:ORCH-2/aci-update/rel.116

Conversation

@BenJanecke
Copy link
Contributor

@BenJanecke BenJanecke commented Aug 19, 2025

Type of Change

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

Summary

This PR enhances the ACI connector with comprehensive 3D Secure (3DS) authentication support and modernizes the test suite, porting behavioral improvements from the ORCH-2/aci-fixes branch to be compatible with
the current upstream codebase structure.

Key Changes

  • Standalone 3DS Implementation: Added complete 3DS authentication flow using proper /v1/threeDSecure endpoints (PreAuthentication and Authentication)
  • Framework Integration: Implemented AciThreeDSFlow redirect form variant with dual iframe support for precondition and authentication steps
  • Enhanced Request Structures: Updated request models to include all required fields matching the reference script at @hyperswitch/tmp/poc-exipay-cnp/scripts/aci/3ds
  • Payment Processing Improvements: Added network token support, payment brand mapping, and proper mandate setup functionality
  • Security Enhancement: Updated webhook verification from NoAlgorithm to HMAC-SHA256
  • Modernized Test Suite: Refactored tests to use ConnectorActions pattern with comprehensive coverage including positive, negative, and 3DS scenarios

Technical Details

Files Modified

  • crates/hyperswitch_connectors/src/connectors/aci.rs - Main connector implementation
  • crates/hyperswitch_connectors/src/connectors/aci/transformers.rs - Request/response transformers
  • crates/hyperswitch_domain_models/src/router_response_types.rs - RedirectForm enum extension
  • crates/diesel_models/src/payment_attempt.rs - Database model updates
  • crates/router/src/services/api.rs - Framework-level redirect handling
  • crates/router/tests/connectors/aci.rs - Complete test suite modernization

Key Implementations

  • 3DS Request Structure: Complete AciStandalone3DSRequest with all required fields including challenge indicators, enrollment flags, and proper card data handling
  • Dual Iframe Support: Framework-level HTML generation for both precondition and authentication iframes
  • Payment Brand Mapping: Support for Visa, Mastercard, American Express, JCB, and other major card networks
  • Authentication: Fixed authentication to use Bearer format
  • Modern Test Architecture: Implemented ConnectorActions trait pattern following project standards

Test Coverage Enhancements

Positive Test Scenarios

  • Manual capture flow: authorize, capture, partial capture, sync, void, refund
  • Automatic capture flow: payment, sync, refund, partial refund, multiple refunds
  • 3DS authentication flows with proper status validation

Negative Test Scenarios

  • Invalid card details (CVC, expiry month, expiry year)
  • Invalid payment operations (void auto-captured, invalid payment ID)
  • Refund validation (amount exceeding payment amount)

3DS-Specific Tests

  • 3DS payment creation with authentication data
  • 3DS authorization with redirect data validation
  • 3DS payment synchronization
  • Authentication flow status verification

Validation

  • ✅ All modified files pass cargo +nightly fmt formatting checks
  • ✅ Code follows project conventions and patterns
  • ✅ Implementation matches reference script behavior
  • ✅ Comprehensive test coverage (18+ test scenarios)
  • ✅ Modern ConnectorActions pattern implementation
  • ✅ Backward compatibility maintained for existing functionality

Test Plan

  • Manual capture flow tests (authorize, capture, void, refund, sync)
  • Automatic capture flow tests (payment, refund, sync)
  • Negative scenario tests (invalid inputs, edge cases)
  • 3DS authentication flow tests with redirect validation
  • Framework-level redirect form handling validation
  • Error handling and status code validation

Additional Changes

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

How did you test it?

1. Cards payment
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Tz5ePEgSZ0NRdEOsdx3cloAjMSV3KkPbsWubLbAlSsv0ndwsblQKTkZZMu3332yC' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "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"
        },
        "email": "guest@example.com"
    },
    "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"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal"
}'

Response


  1. Redirection
Screenshot 2025-09-03 at 10 17 24 AM
3. CIT
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "off_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "routing": { 
        "type": "single",
        "data": "stripe"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": { 
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    
    "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"
        },
        "email": "guest@example.com"
    },
    "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"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal", 
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900, 
    "mandate_data": {
        "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"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00Z",
                "end_date": "2023-05-21T00:00:00Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    }    
}'

Response:

{"payment_id":"pay_nJrHQrInwO77Uvsjrp1h","merchant_id":"merchant_1756939264","status":"requires_customer_action","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":6540,"amount_received":null,"connector":"aci","client_secret":"pay_nJrHQrInwO77Uvsjrp1h_secret_klCqSLL4Va5yqCqoS7iU","created":"2025-09-03T22:48:45.789Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":"man_JblRgVnFHqYNKvQIONrg","mandate_data":{"update_mandate_id":null,"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"}},"mandate_type":{"multi_use":{"amount":1000,"currency":"USD","start_date":"2023-04-21T00:00:00.000Z","end_date":"2023-05-21T00:00:00.000Z","metadata":{"frequency":"13"}}}},"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"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":"guest@example.com"},"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":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":"https://google.com/","authentication_type":"no_three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_nJrHQrInwO77Uvsjrp1h/merchant_1756939264/pay_nJrHQrInwO77Uvsjrp1h_1"},"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":"customer123","created_at":1756939725,"expires":1756943325,"secret":"epk_a1f0c3c09a644947b2fbad66699edd4d"},"manual_retry_allowed":null,"connector_transaction_id":"8ac7a4a19911957d019911c4b0db7792","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":"8ac7a4a19911957d019911c4b0db7792","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T23:03:45.788Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_Nm9GUukfMLZhXdHJSEy0","network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T22:48:47.635Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":"test_ord","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}
4. Corresponding MIT
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data '{
    "amount": 1000,
    "currency": "EUR",
    
    "customer_id": "customer123",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_Nm9GUukfMLZhXdHJSEy0"
    }
}
'

Response

{"payment_id":"pay_tzYpHGeuRYHdPGK5M89d","merchant_id":"merchant_1756939264","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":1000,"connector":"aci","client_secret":"pay_tzYpHGeuRYHdPGK5M89d_secret_AErv7wAoaKE3LP4CWUR1","created":"2025-09-03T22:49:39.145Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Subsequent Mandate Test Payment (MIT from New CIT Demo)","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":"Mastercard","card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":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":"customer123","created_at":1756939779,"expires":1756943379,"secret":"epk_63a75cd297424ac8b2af9abbd2e7396b"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a49f99119578019911c57d647953","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a49f99119578019911c57d647953","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T23:04:39.145Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_Nm9GUukfMLZhXdHJSEy0","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T22:49:40.001Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a299119a87019911c4af57529a","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}
5. setup mandate
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_dVV9Je3mjaAV1ryc2n6xxIBOOiA5O7RoCqSRMpVpb9Gj9AV6dS5g3hEbMQp3K5rG' \
--data-raw '
{
    "amount": 0,
    "currency": "USD",
    "confirm": true,
    "customer_id": "tester123C",
    "email": "johndoe@gmail.com",
    "setup_future_usage": "off_session",
    "payment_type": "setup_mandate",
    "off_session": true,
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5454545454545454",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "mandate_data": {
        "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"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00Z",
                "end_date": "2023-05-21T00:00:00Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "email":"johndoe@gmail.com"
    }
}'

Response

{"payment_id":"pay_4fB1VOfBvH94w8ubEwIR","merchant_id":"merchant_1756917466","status":"succeeded","amount":0,"net_amount":0,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"aci","client_secret":"pay_4fB1VOfBvH94w8ubEwIR_secret_CGiYMO43dEvBza21wCNY","created":"2025-09-03T21:43:07.598Z","currency":"USD","customer_id":"tester123C","customer":{"id":"tester123C","name":null,"email":"johndoe@gmail.com","phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":"man_D0PDZ3sITaf5hRKWOv9w","mandate_data":{"update_mandate_id":null,"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"}},"mandate_type":{"multi_use":{"amount":1000,"currency":"USD","start_date":"2023-04-21T00:00:00.000Z","end_date":"2023-05-21T00:00:00.000Z","metadata":{"frequency":"13"}}}},"setup_future_usage":"off_session","off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"John","last_name":"Doe","origin_zip":null},"phone":null,"email":"johndoe@gmail.com"},"billing":null,"order_details":null,"email":"johndoe@gmail.com","name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":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":"tester123C","created_at":1756935787,"expires":1756939387,"secret":"epk_297846ba6efb4bc1a00da345f2d56273"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a1990ec863019911889b7c095d","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a1990ec863019911889b7c095d","payment_link":null,"profile_id":"pro_xtK5YkotshPxwjOySVEi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_gnftzAdh1YZJvZj3U2nU","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T21:58:07.597Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_lM41ZHCkvobdOiYZwhPr","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T21:43:10.100Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a1990ec863019911889b7c095d","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}
6. MIT corresponding to setup mandate
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_T42KWe2OWnUIg0vvhyYcFu7R1lLBKCRrpLWyPb4hWHNFyyC34aN9NQjpUdLsd9t9' \
--data '{
    "amount": 1000,
    "currency": "USD",
    
    "customer_id": "tester123C",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_lM41ZHCkvobdOiYZwhPr"
    }
}
'

Response

{"payment_id":"pay_TzRnmR2Nthv3WQbjCToR","merchant_id":"merchant_1756917466","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":1000,"connector":"aci","client_secret":"pay_TzRnmR2Nthv3WQbjCToR_secret_dOfVMRSVNv25sfAoN6nO","created":"2025-09-03T21:44:32.257Z","currency":"USD","customer_id":"tester123C","customer":{"id":"tester123C","name":null,"email":"johndoe@gmail.com","phone":null,"phone_country_code":null},"description":"Subsequent Mandate Test Payment (MIT from New CIT Demo)","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":{"card":{"last4":"5454","card_type":null,"card_network":"Mastercard","card_issuer":null,"card_issuing_country":null,"card_isin":"545454","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"johndoe@gmail.com","name":null,"phone":null,"return_url":null,"authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":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":"tester123C","created_at":1756935872,"expires":1756939472,"secret":"epk_a4ec4eaa5b374dc682e3fac2ad45b421"},"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a0990ed03f01991189e2d474be","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a0990ed03f01991189e2d474be","payment_link":null,"profile_id":"pro_xtK5YkotshPxwjOySVEi","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_gnftzAdh1YZJvZj3U2nU","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T21:59:32.256Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_lM41ZHCkvobdOiYZwhPr","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-03T21:44:33.883Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"8ac7a4a1990ec863019911889b7c095d","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}
7. Network Token flow

I. Create ACI connector

curl --location 'http://localhost:8080/account/merchant_1756935953/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "aci",
    "connector_account_details": {
        "auth_type": "BodyKey",
        "api_key": API_KEY,
        "key1": ENTITY_ID
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries":null,
                    "accepted_currencies": null
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": null,
                    "accepted_currencies": null
                }
            ]
        },
    ],
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret"
    },
    "business_label": "default"
}'

II. Enable UAS for profile

curl --location 'http://localhost:8080/configs/merchants_eligible_for_authentication_service' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data '{
    "key": "merchants_eligible_for_authentication_service",
    "value": VALUE_HERE
}'

III. create ctp_mastercard

curl --location 'http://localhost:8080/account/merchant_1756935953/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "connector_type": "authentication_processor",
    "connector_name": "ctp_mastercard",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": API_KEY
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "business_country": "US",
    "business_label": "default",
    "metadata": {
        "dpa_id": "DPA ID",
        "dpa_name": "TestMerchant",
        "locale": "en_AU",
        "card_brands": [
            "mastercard",
            "visa"
        ],
        "acquirer_bin": "ACQUIRER BIN",
        "acquirer_merchant_id": "ACQUIRER MERCHANT ID",
        "merchant_category_code": "0001",
        "merchant_country_code": "US"
    }
}'

IV. CTP profile update

curl --location 'http://localhost:8080/account/merchant_1756935953/business_profile/pro_kkwmU6LfcSIte3TlcHMh' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data '{
    "is_click_to_pay_enabled": true,
    "authentication_product_ids": {"click_to_pay": "mca_foGzOn6nPM6TFvwh6fhj"}
}'

V. create payment

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_HlwN4Co1MokPmoPglbMtwu0HJ25IBH6oRMWOUJuubIG71NvbeULTgz9TNjjGzlsz' \
--data-raw '
{
    "amount": 1130,
    "currency": "EUR",
    "confirm": false,
    "return_url": "https://hyperswitch.io",
    "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"
        },
        "email": "guest@example.com"
    }
}'

Response

{"payment_id":"pay_CHQQv8xweeAmih5MdFXd","merchant_id":"merchant_1756935953","status":"requires_payment_method","amount":1130,"net_amount":1130,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":null,"client_secret":"pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn","created":"2025-09-03T21:48:11.651Z","currency":"EUR","customer_id":null,"customer":null,"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":null,"payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":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":"guest@example.com"},"order_details":null,"email":null,"name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":null,"statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_kkwmU6LfcSIte3TlcHMh","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":null,"incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T22:03:11.651Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T21:48:11.673Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":null,"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}

VI. confirm payment

curl --location 'http://localhost:8080/payments/pay_CHQQv8xweeAmih5MdFXd/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_4c7f1ffc1dfc4e889e867ac60505d178' \
--data '{
    "payment_method": "card",
    "payment_method_type": "debit",
    "client_secret": "pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn",
    "all_keys_required":true,
    "ctp_service_details": {
        "merchant_transaction_id": VALUE_HERE,
        "correlation_id": VALUE_HERE,
        "x_src_flow_id": VALUE_HERE
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "color_depth": 24,
        "java_enabled": true,
        "java_script_enabled": true,
        "language": "en-GB",
        "screen_height": 1440,
        "screen_width": 2560,
        "time_zone": -330,
        "user_agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36"
    }
}'

Response

{"payment_id":"pay_CHQQv8xweeAmih5MdFXd","merchant_id":"merchant_1756935953","status":"requires_customer_action","amount":1130,"net_amount":1130,"shipping_cost":null,"amount_capturable":1130,"amount_received":null,"connector":"aci","client_secret":"pay_CHQQv8xweeAmih5MdFXd_secret_zoplDPH6fk9Qm6Recdqn","created":"2025-09-03T21:48:11.651Z","currency":"EUR","customer_id":null,"customer":null,"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":null,"payment_method":"card","payment_method_data":null,"payment_token":null,"shipping":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":"guest@example.com"},"order_details":null,"email":null,"name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_CHQQv8xweeAmih5MdFXd/merchant_1756935953/pay_CHQQv8xweeAmih5MdFXd_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"debit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":null,"connector_transaction_id":"8ac7a4a1990ec8630199118d5b0d11ed","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":"8ac7a4a1990ec8630199118d5b0d11ed","payment_link":null,"profile_id":"pro_kkwmU6LfcSIte3TlcHMh","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_bQFt1dkbAjSp6Gv6pbJR","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":{"authentication_flow":null,"electronic_commerce_indicator":"06","status":"success","ds_transaction_id":null,"version":null,"error_code":null,"error_message":null},"external_3ds_authentication_attempted":false,"expires_on":"2025-09-03T22:03:11.651Z","fingerprint":null,"browser_info":{"os_type":null,"language":"en-GB","time_zone":-330,"ip_address":"::1","os_version":null,"user_agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Mobile Safari/537.36","color_depth":24,"device_model":null,"java_enabled":true,"screen_width":2560,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1440,"accept_language":"en","java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-03T21:48:20.951Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null,"card_discovery":"click_to_pay","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":"{\"id\":\"8ac7a4a1990ec8630199118d5b0d11ed\",\"paymentType\":\"DB\",\"paymentBrand\":\"VISA\",\"amount\":\"11.30\",\"currency\":\"EUR\",\"descriptor\":\"3484.7818.5182 NetworkTokenChannel \",\"result\":{\"code\":\"000.200.000\",\"description\":\"transaction pending\"},\"tokenAccount\":{\"number\":\"2222030199301958\",\"type\":\"NETWORK\",\"expiryMonth\":\"10\",\"expiryYear\":\"2027\"},\"redirect\":{\"url\":\"https://eu-test.oppwa.com/connectors/demo/cybersourcerest/simulator/payment.ftl?ndcid=8a8294175d602369015d73bf009f1808_efdb58167aad468a928b44dde03c2115\",\"parameters\":[{\"name\":\"TransactionId\",\"value\":\"0000000070575071\"},{\"name\":\"uuid\",\"value\":\"8ac7a4a1990ec8630199118d5b0d11ed\"}]},\"buildNumber\":\"e05bc10dcc6acc6bd4abda346f4af077dcd905d7@2025-09-02 06:02:21 +0000\",\"timestamp\":\"2025-09-03 21:48:20+0000\",\"ndc\":\"8a8294175d602369015d73bf009f1808_efdb58167aad468a928b44dde03c2115\",\"source\":\"OPP\",\"paymentMethod\":\"NT\",\"shortId\":\"3484.7818.5182\"}","enable_partial_authorization":null}
7. Manual capture
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "amount_to_capture": 6540,
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5386024192625914",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737",
            "card_network": "Mastercard"
        }
    },
    "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"
        },
        "email": "guest@example.com"
    },
    "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"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal"
}
'

Response:

{"payment_id":"pay_dTlUOqtFsHTk2pYjcNDt","merchant_id":"merchant_1756939264","status":"requires_customer_action","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":6540,"amount_received":null,"connector":"aci","client_secret":"pay_dTlUOqtFsHTk2pYjcNDt_secret_quBPvBLmgEoMeGq30q8W","created":"2025-09-04T12:25:30.223Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"manual","payment_method":"card","payment_method_data":{"card":{"last4":"5914","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"538602","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"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":"guest@example.com"},"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":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_dTlUOqtFsHTk2pYjcNDt/merchant_1756939264/pay_dTlUOqtFsHTk2pYjcNDt_1"},"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":"customer123","created_at":1756988730,"expires":1756992330,"secret":"epk_fbfca29dcba44555b3c4abb3e7ce9b67"},"manual_retry_allowed":null,"connector_transaction_id":"8ac7a49f9912a69e019914b074cd08f8","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":"8ac7a49f9912a69e019914b074cd08f8","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-04T12:40:30.223Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":null,"network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-04T12:25:33.311Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":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}

capture after redirection:

curl --location 'http://localhost:8080/payments/pay_dTlUOqtFsHTk2pYjcNDt/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jBGr5aVyHqi26wIUT0l6VoyH0lGLSC5AcUoyoSv4MOaZDVulNKHuceiO87kr1UDn' \
--data '{
  "amount_to_capture": 6540,
  "statement_descriptor_name": "Joseph",
  "statement_descriptor_prefix" :"joseph",
  "statement_descriptor_suffix": "JS"
}'

Response

{"payment_id":"pay_dTlUOqtFsHTk2pYjcNDt","merchant_id":"merchant_1756939264","status":"succeeded","amount":6540,"net_amount":6540,"shipping_cost":null,"amount_capturable":0,"amount_received":6540,"connector":"aci","client_secret":"pay_dTlUOqtFsHTk2pYjcNDt_secret_quBPvBLmgEoMeGq30q8W","created":"2025-09-04T12:25:30.223Z","currency":"EUR","customer_id":"customer123","customer":{"id":"customer123","name":"John Doe","email":"customer@gmail.com","phone":"9999999999","phone_country_code":"+1"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"manual","payment_method":"card","payment_method_data":{"card":{"last4":"5914","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"538602","card_extended_bin":null,"card_exp_month":"10","card_exp_year":"25","card_holder_name":"joseph Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"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":"guest@example.com"},"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":"guest@example.com"},"order_details":[{"sku":null,"upc":null,"brand":null,"amount":6540,"category":null,"quantity":1,"tax_rate":null,"product_id":null,"description":null,"product_name":"Apple iphone 15","product_type":null,"sub_category":null,"total_amount":null,"commodity_code":null,"unit_of_measure":null,"product_img_link":null,"product_tax_code":null,"total_tax_amount":null,"requires_shipping":null,"unit_discount_amount":null}],"email":"customer@gmail.com","name":"John Doe","phone":"9999999999","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,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"8ac7a4a29912ae61019914b0fd8866f5","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":"8ac7a49f9912a69e019914b074cd08f8","payment_link":null,"profile_id":"pro_HoadX959YnH9wsndpUrq","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_PZ6v2D98umb2BxIN28tM","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-04T12:40:30.223Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"128.0.0.1","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36","color_depth":24,"java_enabled":true,"screen_width":1536,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":723,"java_script_enabled":true},"payment_channel":null,"payment_method_id":"pm_dgRVnCJRHsU6c2LmY34G","network_transaction_id":null,"payment_method_status":null,"updated":"2025-09-04T12:26:08.107Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":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}

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

@BenJanecke BenJanecke requested review from a team as code owners August 19, 2025 07:22
@semanticdiff-com
Copy link

semanticdiff-com bot commented Aug 19, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/aci/transformers.rs  8% smaller
  crates/hyperswitch_connectors/src/connectors/aci.rs  5% smaller
  crates/router/tests/connectors/aci.rs  2% smaller
  config/config.example.toml Unsupported file format
  config/deployments/integration_test.toml Unsupported file format
  config/deployments/production.toml Unsupported file format
  config/deployments/sandbox.toml Unsupported file format
  config/development.toml Unsupported file format
  config/docker_compose.toml Unsupported file format
  loadtest/config/development.toml Unsupported file format

@BenJanecke BenJanecke force-pushed the ORCH-2/aci-update/rel.116 branch 2 times, most recently from 56e983c to 52ae874 Compare August 19, 2025 08:36
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);

let response_data = if response.redirect.is_some() {
Copy link
Contributor

@ImSagnik007 ImSagnik007 Aug 19, 2025

Choose a reason for hiding this comment

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

We generally keep type transformations in transformers.rs. Could we move this there and implement it using TryFrom for consistency? You can follow the handle_response function of trustpay.rs for any flow for reference.

event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);

let authn_flow_type = if response.redirect.is_some() {
Copy link
Contributor

@ImSagnik007 ImSagnik007 Aug 19, 2025

Choose a reason for hiding this comment

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

we can also move the logic written here in transformers.rs.
Ref: https://github.com/juspay/hyperswitch/pull/8986/files#r2285283012

),
connector: "ACI",
})?,
None => Ok(PaymentBrand::Visa),
Copy link
Contributor

@ImSagnik007 ImSagnik007 Aug 19, 2025

Choose a reason for hiding this comment

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

Just to clarify - if card_network isn’t present, this defaults to Visa. Do we have any reason for choosing Visa as the fallback?

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed the default Visa for the rest flow, but retained it for NetworkToken.
This is because brand is a required field for NetworkToken, and since UAS doesn’t provide this field currently, its value will always be None.

fn try_from(
(network_token_data, card_holder_name): (NetworkTokenData, Option<Secret<String>>),
) -> Result<Self, Self::Error> {
let payment_brand = PaymentBrand::Visa;
Copy link
Contributor

@ImSagnik007 ImSagnik007 Aug 19, 2025

Choose a reason for hiding this comment

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

Do we have any reason to hardcode the card brand Visa here? What would happen for Mastercard cards?

})?,
card_expiry_month: network_token_data.get_network_token_expiry_month(),
card_expiry_year: network_token_data.get_expiry_year_4_digit(),
card_cvv: network_token_data.get_cryptogram().ok_or(
Copy link
Contributor

@ImSagnik007 ImSagnik007 Aug 19, 2025

Choose a reason for hiding this comment

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

I am not sure why the cryptogram is passed in cvv. Could you please clarify? Is it because here it is dynamicCVV - which is essentially a cryptogram ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair, fixed the value population for cvv.

PaymentBrand::Visa => "VISA",
PaymentBrand::Mastercard => "MASTER",
PaymentBrand::AmericanExpress => "AMEX",
_ => "VISA",
Copy link
Contributor

Choose a reason for hiding this comment

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

I see if the get_aci_payment_brand function returns JCB, Diners Club, Discover etc. they currently fall into the _ case and VISA will be returned. Do we want this behaviour here?

PaymentBrand::Visa => "VISA",
PaymentBrand::Mastercard => "MASTER",
PaymentBrand::AmericanExpress => "AMEX",
_ => "VISA",
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't pass visa as default value

@swetasharma03 swetasharma03 force-pushed the ORCH-2/aci-update/rel.116 branch 4 times, most recently from bfc3c2f to f7d12d6 Compare September 4, 2025 13:36
deepanshu-iiitu
deepanshu-iiitu previously approved these changes Sep 8, 2025
@dgeee13 dgeee13 requested a review from ImSagnik007 September 8, 2025 11:43
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ChallengeIndicator {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this since it's not in use?

dgeee13
dgeee13 previously approved these changes Sep 8, 2025
ImSagnik007
ImSagnik007 previously approved these changes Sep 10, 2025
BenJanecke and others added 6 commits September 10, 2025 15:30
- Add standalone 3DS authentication flow with proper /v1/threeDSecure endpoints
- Implement AciThreeDSFlow redirect form variant with dual iframe support
- Enhance request structures to match reference script specifications
- Add network token support and payment brand mapping
- Update webhook verification to use HMAC-SHA256
- Implement proper mandate setup functionality
- Modernize test suite with ConnectorActions pattern and comprehensive coverage
- Add 3DS-specific test scenarios with authentication flow validation
@likhinbopanna likhinbopanna added this pull request to the merge queue Sep 10, 2025
Merged via the queue into juspay:main with commit b014b13 Sep 10, 2025
17 of 21 checks passed
pixincreate added a commit that referenced this pull request Sep 11, 2025
…ee-ds

* 'main' of github.com:juspay/hyperswitch:
  feat(webhooks): Provide outgoing webhook support for revenue recovery (#9294)
  feat(connector): Add Peachpayments Template Code (#9363)
  feat(connector): [Paysafe] Implement card 3ds flow (#9305)
  feat(router): Add Connector changes for 3ds (v2) (#9117)
  feat(connector): [ADYEN] Add support to ideal Mandate Webhook (#9347)
  refactor(core): accept manual retry from profile  (#9302)
  fix(nuvei): nuvei 3ds fix + psync fix (#9279)
  fix(connector): [checkout] Add US Support for Apple Pay and Google Pay + Enhanced Checkout Response Data (#9356)
  fix(router): adding connector_customer_id for external vault proxy (#9263)
  feat(core): Add first_name and last_name as Secret<String> Types.  (#9326)
  feat(injector): injector request formation changes (#9306)
  fix(revenue-recovery): Update Redis TTL for customer locks after token selection (#9282)
  chore(version): 2025.09.11.0
  refactor(connector): [Paysafe] fix wasm (#9349)
  refactor(connector): rename RevenueRecoveryRecordBack as InvoiceRecordBack (#9321)
  feat(connector): [checkout] add support for MOTO payments (#9327)
  feat(connector): enhance ACI connector with comprehensive 3DS support - DRAFT (#8986)
  feat(core): [Retry] MIT Retries (#8628)
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.

[FEATURE] [ACI] Setup mandate and network token flow added and existing flows fixed

7 participants