Skip to content

Conversation

Aishwariyaa-Anand
Copy link
Contributor

@Aishwariyaa-Anand Aishwariyaa-Anand commented Jun 4, 2025

Type of Change

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

Description

Add merchant Id auth for payments_create_and_confirm_intent. This is enabled on merchant_id_auth_enabled.

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?

  1. Create Organization
  2. Create Merchant Account
  3. Create Business Profile
  4. Create Connector
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: cloth_seller_Qqn3GHHEQfTgBR7Q3lbD' \
--header 'x-profile-id: pro_81tGoykWAXxzOH523DeF' \
--header 'Authorization: admin-api-key=test_admin' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "_"
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "metadata": {
        "status_url": "https://2753-2401-4900-1cb8-2ff9-24dd-1ccf-ed12-b464.in.ngrok.io/webhooks/merchant_1678699058/globalpay",
        "account_name": "transaction_processing",
        "pricing_type": "fixed_price",
        "acquirer_bin": "438309",
        "acquirer_merchant_id": "00002000000"
    },
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "profile_id": "pro_81tGoykWAXxzOH523DeF"
}'
  1. Create and Confirm Payment
curl --location 'http://localhost:8080/v2/payments' \
--header 'Content-Type: application/json' \
--header 'x-profile-id: pro_81tGoykWAXxzOH523DeF' \
--header 'X-Merchant-Id: cloth_seller_Qqn3GHHEQfTgBR7Q3lbD' \
--data '{
    "amount_details": {
      "currency": "USD",
      "order_amount": 6540
    },
    "payment_method_data": {
      "card": {
        "card_cvc": "123",
        "card_exp_month": "10",
        "card_exp_year": "25",
        "card_holder_name": "joseph Doe",
        "card_number": "4242424242424242"
      }
    },
    "payment_method_subtype": "credit",
    "payment_method_type": "card"
}'

Response

{
    "id": "12345_pay_01973adbc6ab74d1b8cbc732740bc1df",
    "status": "succeeded",
    "amount": {
        "order_amount": 6540,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 6540,
        "amount_to_capture": null,
        "amount_capturable": 0,
        "amount_captured": 6540
    },
    "customer_id": null,
    "connector": "stripe",
    "created": "2025-06-04T12:12:51.248Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "connector_transaction_id": "pi_3RWGBcD5R7gDAGff06zS46Cm",
    "connector_reference_id": null,
    "merchant_connector_id": "mca_tiY9bcQ3EAmiErBtJji1",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": {
        "token": "pm_1RWGBcD5R7gDAGffBfMOSg3E",
        "connector_token_request_reference_id": "wEe92Yo4f9FIIVQnmO"
    },
    "payment_method_id": null,
    "next_action": null,
    "return_url": "https://google.com/success",
    "authentication_type": null,
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": 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

@Aishwariyaa-Anand Aishwariyaa-Anand requested review from a team as code owners June 4, 2025 12:38
Copy link

semanticdiff-com bot commented Jun 4, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/routes/payments.rs  24% smaller
  config/config.example.toml Unsupported file format
  config/deployments/env_specific.toml Unsupported file format
  config/development.toml Unsupported file format
  config/docker_compose.toml Unsupported file format
  crates/router/src/configs/secrets_transformers.rs  0% smaller
  crates/router/src/configs/settings.rs  0% smaller
  crates/router/src/services/authentication.rs  0% smaller

@Aishwariyaa-Anand Aishwariyaa-Anand self-assigned this Jun 4, 2025
@Aishwariyaa-Anand Aishwariyaa-Anand changed the title feature(router): add merchantId authentication for Payments v2 feat(router): add merchantId authentication for Payments v2 Jun 4, 2025
@Aishwariyaa-Anand Aishwariyaa-Anand added the M-configuration-changes Metadata: This PR involves configuration changes label Jun 6, 2025
@Gnanasundari24 Gnanasundari24 enabled auto-merge June 6, 2025 08:24
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 6, 2025
Merged via the queue into main with commit 45d4ebf Jun 6, 2025
15 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the merchant-auth-v2 branch June 6, 2025 08:57
pixincreate added a commit that referenced this pull request Jun 9, 2025
…tch into cypress/fix

* 'cypress/fix' of github.com:juspay/hyperswitch:
  chore(cypress): run formatter and address lints

* 'main' of github.com:juspay/hyperswitch:
  feat(router): add merchantId authentication for Payments v2 (#8239)
  chore(version): 2025.06.06.0
  Documentation edits made through Mintlify web editor
  Documentation edits made through Mintlify web editor
  feat(router): Return payment_experience in PML for payment (v2) (#8255)
  refactor: add infra-values in intent kafka events (#8264)
  fix(wasm): [Worldpayvantiv] add support for metadata.report_group (#8260)
  chore(version): 2025.06.05.0
  revert(routing): Add connectors from current active routing algorithm before adding fallback connectors (#8207)
  feat(connectors): [Worldpayvantiv] add card support (#8219)
  feat(connectors): [Template] add Worldpayvantiv  (#8226)
  refactor(dynamic_routing): add logic for creating merchant account in decision engine (#8191)
  feat(events): adding infra level components to api-events (#8214)
  chore(version): 2025.06.04.0
  feat(core): add support for consuming eci for AuthNResponse in Authentication flow (#8225)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-configuration-changes Metadata: This PR involves configuration changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants