Skip to content

feat(core): added force_3ds_challenge for decoupled txns#7484

Merged
likhinbopanna merged 15 commits intomainfrom
8765-feat-add-force_3ds_challenge-flag-in-payments-request
Apr 7, 2025
Merged

feat(core): added force_3ds_challenge for decoupled txns#7484
likhinbopanna merged 15 commits intomainfrom
8765-feat-add-force_3ds_challenge-flag-in-payments-request

Conversation

@sahkal
Copy link
Contributor

@sahkal sahkal commented Mar 11, 2025

Type of Change

  • New feature

Description

Added force_3ds_challenge flag in payments request for decoupled txns.

Previously force_3ds_challenge flag was a business_profile property, but now we will priortise flag send in payments request over business_profile.

add two new fields in payment_create response force_3ds_challenge, force_3ds_challenge_trigger

How did you test it?

Try doing a netcetera txns by updating business profile force_3ds_challenge as true

For validation you can check connector request logs

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_skofCKwuzyPyyjl4YCBQJS0fVb0YwOtqBisHGo3PCtFmrCTURvcAaOVzGA7Oom6a' \
--data-raw '
{
    "amount": 100,
    "currency": "PLN",
    "confirm": true,
    "email": "sahouhdq@gmail.com",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "5512459816707531",
            "card_exp_month": "04",
            "card_exp_year": "2029",
            "card_holder_name": "John Smith",
            "card_cvc": "238",
            "card_network": "Visa"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
         "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "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": "125.0.0.1"
    },
    "request_external_three_ds_authentication": true,
    "authentication_type": "three_ds",
} 
'

force_3ds_challenge: true
Screenshot 2025-03-13 at 12 55 44 PM

now try overriding the value set in business profile force_3ds_challenge as false in payment create

curl --location 'localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_Ghv3WFaXE8YXowo77WnQpMoIXsVtC0DcMfnowobAIkIkStzxVMXdTF6Li7SJoyWM' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": false,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        },
        "phone": {
            "number": "123456789",
            "country_code": "12"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        },
        "phone": {
            "number": "123456789",
            "country_code": "12"
        }
    },
    "request_external_three_ds_authentication": true,
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "force_3ds_challenge": false
}'

force_3ds_challenge: false
Screenshot 2025-03-13 at 12 56 49 PM

Payment Create Response

{
    "payment_id": "pay_N5VoouQEnkDL6bx8yxeu",
    "merchant_id": "sahkal",
    "status": "requires_payment_method",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_N5VoouQEnkDL6bx8yxeu_secret_8bFLGPv5ymU16mal9Qew",
    "created": "2025-03-23T20:17:16.893Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.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": null,
    "payment_method_data": 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": "PiX",
            "last_name": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "12"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": {
            "number": "123456789",
            "country_code": "12"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.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": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1742761036,
        "expires": 1742764636,
        "secret": "epk_c714e3ec07cf4c27844cd37561dfe854"
    },
    "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_sc0RRAwEw4IuLCnHqvZ9",
    "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-03-23T20:32:16.893Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-03-23T20:17:16.952Z",
    "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
}

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

@sahkal sahkal added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Mar 11, 2025
@sahkal sahkal added this to the February 2025 Release milestone Mar 11, 2025
@sahkal sahkal self-assigned this Mar 11, 2025
@sahkal sahkal requested review from a team as code owners March 11, 2025 18:30
@semanticdiff-com
Copy link

semanticdiff-com bot commented Mar 11, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/openapi/src/openapi.rs  17% smaller
  crates/openapi/src/openapi_v2.rs  17% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/api_models/src/admin.rs  0% smaller
  crates/api_models/src/payments.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/hyperswitch_domain_models/src/payments.rs  0% smaller
  crates/hyperswitch_domain_models/src/payments/payment_intent.rs  0% smaller
  crates/hyperswitch_domain_models/src/revenue_recovery.rs  0% smaller
  crates/router/src/core/payment_methods.rs  0% smaller
  crates/router/src/core/payments.rs  0% smaller
  crates/router/src/core/payments/helpers.rs  0% smaller
  crates/router/src/core/payments/operations/payment_confirm.rs  0% smaller
  crates/router/src/core/payments/operations/payment_create.rs  0% smaller
  crates/router/src/core/payments/operations/payment_update.rs  0% smaller
  crates/router/src/core/payments/operations/payment_update_intent.rs  0% smaller
  crates/router/src/core/payments/transformers.rs  0% smaller
  crates/router/src/utils/user/sample_data.rs  0% smaller
  crates/router/tests/payments.rs  0% smaller
  crates/router/tests/payments2.rs  0% smaller
  migrations/2025-03-11-171330_add-force-3ds-challenge-in-payment-intent/down.sql Unsupported file format
  migrations/2025-03-11-171330_add-force-3ds-challenge-in-payment-intent/up.sql Unsupported file format
  migrations/2025-03-20-085151_force-3ds-challenge-triggered/down.sql Unsupported file format
  migrations/2025-03-20-085151_force-3ds-challenge-triggered/up.sql Unsupported file format

@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Mar 11, 2025
@sahkal sahkal added the M-api-contract-changes Metadata: This PR involves API contract changes label Mar 11, 2025
@sahkal sahkal requested a review from a team as a code owner March 11, 2025 19:28
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Mar 11, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Mar 13, 2025
jarnura
jarnura previously approved these changes Mar 26, 2025
ThisIsMani
ThisIsMani previously approved these changes Mar 27, 2025
@sahkal sahkal dismissed stale reviews from ThisIsMani and jarnura via b1cc4e0 March 31, 2025 18:25
Copy link
Contributor

@Aprabhat19 Aprabhat19 left a comment

Choose a reason for hiding this comment

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

Payment Method Changes LGTM

@likhinbopanna likhinbopanna added this pull request to the merge queue Apr 7, 2025
Merged via the queue into main with commit c245ece Apr 7, 2025
22 of 39 checks passed
@likhinbopanna likhinbopanna deleted the 8765-feat-add-force_3ds_challenge-flag-in-payments-request branch April 7, 2025 09:25
pixincreate added a commit that referenced this pull request Apr 10, 2025
…acilitapay-pix-pmt

* 'main' of github.com:juspay/hyperswitch: (21 commits)
  chore(version): 2025.04.10.0
  refactor(connector): [STRIPE] Remove sofort bank redirect from stripe (#7733)
  feat(connector): Add invoice number and email in AuthorizeDotNet connector (#7726)
  fix(router): fix retry_count and add validation for process_tracker (#7614)
  feat(payment_link): expose configurations for payment links (#7742)
  chore(version): 2025.04.09.0
  chore(postman): update Postman collection files
  feat(connector): [AIRWALLEX, ELAVON, NOVALNET, XENDIT] add in feature API (#7163)
  refactor: move merchant_key_store table to accounts schema (#7746)
  chore(postman): update `Stripe` response `status`, `error_code`, and `error_message` for deprecated `Sofort` (#7730)
  feat(connector): Add recovery support for recurly [v2] (#7497)
  refactor(cypress): update BOA configs for manual payments' refunds and connector agnostic (#7690)
  feat(router): Support `card` in `payment_method_subtype` [V2] (#7662)
  feat: Add open API reference for Intelligent router (#7727)
  ci(cypress-ci): remove wise payout from running in github ci (#7756)
  feat(authentication): create authentications to fallback to ApiKeyAuth if AdminApiAuth fails (#7744)
  chore(version): 2025.04.08.0
  feat(core): added force_3ds_challenge for decoupled txns (#7484)
  chore(version): 2025.04.07.0
  chore(postman): update Postman collection files
  ...
@hyperswitch-bot hyperswitch-bot bot removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-core Area: Core flows 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.

7 participants