hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

fix(authentication): fix connector and profile CRUD authentication and authorization

Open tsdk02 opened this issue 2 months ago • 2 comments

Type of Change

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

Description

This PR fixes authentication and authorization issues in connector and profile CRUD operations by:

  • Removing unnecessary HeaderAuth wrapper from route authentication handlers
  • Fixing merchant_id parameter handling in the update_connector function (changed from reference to owned value)
  • Adding proper merchant_id parameter to retrieve_profile and update_profile functions for enhanced authorization
  • Using authenticated merchant_id from auth context (auth.merchant_account.get_id().clone()) instead of route parameters to ensure proper authorization

Additional Changes

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

Motivation and Context

This change is required to fix authentication and authorization vulnerabilities in connector and profile CRUD operations. The previous implementation had inconsistent authentication handling and was using route parameters for merchant identification instead of properly validated authenticated merchant IDs, which could lead to unauthorized access.

How did you test it?

  • Code review and analysis of authentication flow
  • Verified that all affected endpoints now use authenticated merchant IDs consistently
  • Ensured parameter handling is correct throughout the call chain

Profile APIs:

1. Business Profile - Create

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/business_profile' \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--header 'Accept: */*' \
--data '{
  "profile_name": "test_profile-1"
}'

Response

{
    "merchant_id": "merchant_1761407178",
    "profile_id": "pro_YXy3HGrb73qDRgGXrBkL",
    "profile_name": "test_profile-1",
    "return_url": null,
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "2COFm6lIl3pRVXo4WfmtrlSDhJ3Lao7ZG3mhEygZyYn06HRRey6dHAcFjO4kVFVx",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": null,
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_pre_network_tokenization_enabled": false,
    "acquirer_configs": null,
    "is_iframe_redirection_enabled": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "dispute_polling_interval": null,
    "is_manual_retry_enabled": null,
    "always_enable_overcapture": null,
    "is_external_vault_enabled": "skip",
    "external_vault_connector_details": null,
    "billing_processor_id": null,
    "is_l2_l3_enabled": false
}
2. Business Profile - Retrieve

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/business_profile/pro_YXy3HGrb73qDRgGXrBkL' \
--header 'api-key: <api-key>' \
--header 'Accept: */*'

Response

{
    "merchant_id": "merchant_1761407178",
    "profile_id": "pro_YXy3HGrb73qDRgGXrBkL",
    "profile_name": "test_profile-1",
    "return_url": null,
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "2COFm6lIl3pRVXo4WfmtrlSDhJ3Lao7ZG3mhEygZyYn06HRRey6dHAcFjO4kVFVx",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": null,
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_pre_network_tokenization_enabled": false,
    "acquirer_configs": null,
    "is_iframe_redirection_enabled": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "dispute_polling_interval": null,
    "is_manual_retry_enabled": null,
    "always_enable_overcapture": null,
    "is_external_vault_enabled": "skip",
    "external_vault_connector_details": null,
    "billing_processor_id": null,
    "is_l2_l3_enabled": false
}
3. Business Profile - Update

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/business_profile/pro_YXy3HGrb73qDRgGXrBkL' \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--header 'Accept: */*' \
--data '{
    "profile_name": "Updated profile"
}'

Response

{
    "merchant_id": "merchant_1761407178",
    "profile_id": "pro_YXy3HGrb73qDRgGXrBkL",
    "profile_name": "Updated profile",
    "return_url": null,
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "2COFm6lIl3pRVXo4WfmtrlSDhJ3Lao7ZG3mhEygZyYn06HRRey6dHAcFjO4kVFVx",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": null,
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "force_3ds_challenge": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_pre_network_tokenization_enabled": false,
    "acquirer_configs": null,
    "is_iframe_redirection_enabled": null,
    "merchant_category_code": null,
    "merchant_country_code": null,
    "dispute_polling_interval": null,
    "is_manual_retry_enabled": null,
    "always_enable_overcapture": null,
    "is_external_vault_enabled": "skip",
    "external_vault_connector_details": null,
    "billing_processor_id": null,
    "is_l2_l3_enabled": false
}
4. Business Profile - List

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/profile' \
--header 'api-key: <api-key>' \
--header 'Accept: */*'

Response

[
    {
        "merchant_id": "merchant_1761407178",
        "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
        "profile_name": "Update",
        "return_url": null,
        "enable_payment_response_hash": true,
        "payment_response_hash_key": "2COFm6lIl3pRVXo4WfmtrlSDhJ3Lao7ZG3mhEygZyYn06HRRey6dHAcFjO4kVFVx",
        "redirect_to_merchant_with_http_post": false,
        "webhook_details": null,
        "metadata": null,
        "routing_algorithm": null,
        "intent_fulfillment_time": 900,
        "frm_routing_algorithm": null,
        "payout_routing_algorithm": null,
        "applepay_verified_domains": null,
        "session_expiry": 900,
        "payment_link_config": null,
        "authentication_connector_details": null,
        "use_billing_as_payment_method_billing": true,
        "extended_card_info_config": null,
        "collect_shipping_details_from_wallet_connector": false,
        "collect_billing_details_from_wallet_connector": false,
        "always_collect_shipping_details_from_wallet_connector": false,
        "always_collect_billing_details_from_wallet_connector": false,
        "is_connector_agnostic_mit_enabled": false,
        "payout_link_config": null,
        "outgoing_webhook_custom_http_headers": null,
        "tax_connector_id": null,
        "is_tax_connector_enabled": false,
        "is_network_tokenization_enabled": false,
        "is_auto_retries_enabled": false,
        "max_auto_retries_enabled": null,
        "always_request_extended_authorization": null,
        "is_click_to_pay_enabled": false,
        "authentication_product_ids": null,
        "card_testing_guard_config": {
            "card_ip_blocking_status": "disabled",
            "card_ip_blocking_threshold": 3,
            "guest_user_card_blocking_status": "disabled",
            "guest_user_card_blocking_threshold": 10,
            "customer_id_blocking_status": "disabled",
            "customer_id_blocking_threshold": 5,
            "card_testing_guard_expiry": 3600
        },
        "is_clear_pan_retries_enabled": false,
        "force_3ds_challenge": false,
        "is_debit_routing_enabled": false,
        "merchant_business_country": null,
        "is_pre_network_tokenization_enabled": false,
        "acquirer_configs": null,
        "is_iframe_redirection_enabled": null,
        "merchant_category_code": null,
        "merchant_country_code": null,
        "dispute_polling_interval": null,
        "is_manual_retry_enabled": null,
        "always_enable_overcapture": null,
        "is_external_vault_enabled": "skip",
        "external_vault_connector_details": null,
        "billing_processor_id": null,
        "is_l2_l3_enabled": false
    },
    {
        "merchant_id": "merchant_1761407178",
        "profile_id": "pro_YXy3HGrb73qDRgGXrBkL",
        "profile_name": "Updated profile",
        "return_url": null,
        "enable_payment_response_hash": true,
        "payment_response_hash_key": "2COFm6lIl3pRVXo4WfmtrlSDhJ3Lao7ZG3mhEygZyYn06HRRey6dHAcFjO4kVFVx",
        "redirect_to_merchant_with_http_post": false,
        "webhook_details": null,
        "metadata": null,
        "routing_algorithm": null,
        "intent_fulfillment_time": 900,
        "frm_routing_algorithm": null,
        "payout_routing_algorithm": null,
        "applepay_verified_domains": null,
        "session_expiry": 900,
        "payment_link_config": null,
        "authentication_connector_details": null,
        "use_billing_as_payment_method_billing": true,
        "extended_card_info_config": null,
        "collect_shipping_details_from_wallet_connector": false,
        "collect_billing_details_from_wallet_connector": false,
        "always_collect_shipping_details_from_wallet_connector": false,
        "always_collect_billing_details_from_wallet_connector": false,
        "is_connector_agnostic_mit_enabled": false,
        "payout_link_config": null,
        "outgoing_webhook_custom_http_headers": null,
        "tax_connector_id": null,
        "is_tax_connector_enabled": false,
        "is_network_tokenization_enabled": false,
        "is_auto_retries_enabled": false,
        "max_auto_retries_enabled": null,
        "always_request_extended_authorization": null,
        "is_click_to_pay_enabled": false,
        "authentication_product_ids": null,
        "card_testing_guard_config": {
            "card_ip_blocking_status": "disabled",
            "card_ip_blocking_threshold": 3,
            "guest_user_card_blocking_status": "disabled",
            "guest_user_card_blocking_threshold": 10,
            "customer_id_blocking_status": "disabled",
            "customer_id_blocking_threshold": 5,
            "card_testing_guard_expiry": 3600
        },
        "is_clear_pan_retries_enabled": false,
        "force_3ds_challenge": false,
        "is_debit_routing_enabled": false,
        "merchant_business_country": null,
        "is_pre_network_tokenization_enabled": false,
        "acquirer_configs": null,
        "is_iframe_redirection_enabled": null,
        "merchant_category_code": null,
        "merchant_country_code": null,
        "dispute_polling_interval": null,
        "is_manual_retry_enabled": null,
        "always_enable_overcapture": null,
        "is_external_vault_enabled": "skip",
        "external_vault_connector_details": null,
        "billing_processor_id": null,
        "is_l2_l3_enabled": false
    },
    {
        "merchant_id": "merchant_1761407178",
        "profile_id": "pro_p0xfTz5c7ysxLLlQY61k",
        "profile_name": "test_profile",
        "return_url": null,
        "enable_payment_response_hash": true,
        "payment_response_hash_key": "2COFm6lIl3pRVXo4WfmtrlSDhJ3Lao7ZG3mhEygZyYn06HRRey6dHAcFjO4kVFVx",
        "redirect_to_merchant_with_http_post": false,
        "webhook_details": null,
        "metadata": null,
        "routing_algorithm": null,
        "intent_fulfillment_time": 900,
        "frm_routing_algorithm": null,
        "payout_routing_algorithm": null,
        "applepay_verified_domains": null,
        "session_expiry": 900,
        "payment_link_config": null,
        "authentication_connector_details": null,
        "use_billing_as_payment_method_billing": true,
        "extended_card_info_config": null,
        "collect_shipping_details_from_wallet_connector": false,
        "collect_billing_details_from_wallet_connector": false,
        "always_collect_shipping_details_from_wallet_connector": false,
        "always_collect_billing_details_from_wallet_connector": false,
        "is_connector_agnostic_mit_enabled": false,
        "payout_link_config": null,
        "outgoing_webhook_custom_http_headers": null,
        "tax_connector_id": null,
        "is_tax_connector_enabled": false,
        "is_network_tokenization_enabled": false,
        "is_auto_retries_enabled": false,
        "max_auto_retries_enabled": null,
        "always_request_extended_authorization": null,
        "is_click_to_pay_enabled": false,
        "authentication_product_ids": null,
        "card_testing_guard_config": {
            "card_ip_blocking_status": "disabled",
            "card_ip_blocking_threshold": 3,
            "guest_user_card_blocking_status": "disabled",
            "guest_user_card_blocking_threshold": 10,
            "customer_id_blocking_status": "disabled",
            "customer_id_blocking_threshold": 5,
            "card_testing_guard_expiry": 3600
        },
        "is_clear_pan_retries_enabled": false,
        "force_3ds_challenge": false,
        "is_debit_routing_enabled": false,
        "merchant_business_country": null,
        "is_pre_network_tokenization_enabled": false,
        "acquirer_configs": null,
        "is_iframe_redirection_enabled": null,
        "merchant_category_code": null,
        "merchant_country_code": null,
        "dispute_polling_interval": null,
        "is_manual_retry_enabled": null,
        "always_enable_overcapture": null,
        "is_external_vault_enabled": "skip",
        "external_vault_connector_details": null,
        "billing_processor_id": null,
        "is_l2_l3_enabled": false
    },
    {
        "merchant_id": "merchant_1761407178",
        "profile_id": "pro_f9KWGfWgjGLE9WKKd4a5",
        "profile_name": "test_profile2",
        "return_url": null,
        "enable_payment_response_hash": true,
        "payment_response_hash_key": "2COFm6lIl3pRVXo4WfmtrlSDhJ3Lao7ZG3mhEygZyYn06HRRey6dHAcFjO4kVFVx",
        "redirect_to_merchant_with_http_post": false,
        "webhook_details": null,
        "metadata": null,
        "routing_algorithm": null,
        "intent_fulfillment_time": 900,
        "frm_routing_algorithm": null,
        "payout_routing_algorithm": null,
        "applepay_verified_domains": null,
        "session_expiry": 900,
        "payment_link_config": null,
        "authentication_connector_details": null,
        "use_billing_as_payment_method_billing": true,
        "extended_card_info_config": null,
        "collect_shipping_details_from_wallet_connector": false,
        "collect_billing_details_from_wallet_connector": false,
        "always_collect_shipping_details_from_wallet_connector": false,
        "always_collect_billing_details_from_wallet_connector": false,
        "is_connector_agnostic_mit_enabled": false,
        "payout_link_config": null,
        "outgoing_webhook_custom_http_headers": null,
        "tax_connector_id": null,
        "is_tax_connector_enabled": false,
        "is_network_tokenization_enabled": false,
        "is_auto_retries_enabled": false,
        "max_auto_retries_enabled": null,
        "always_request_extended_authorization": null,
        "is_click_to_pay_enabled": false,
        "authentication_product_ids": null,
        "card_testing_guard_config": {
            "card_ip_blocking_status": "disabled",
            "card_ip_blocking_threshold": 3,
            "guest_user_card_blocking_status": "disabled",
            "guest_user_card_blocking_threshold": 10,
            "customer_id_blocking_status": "disabled",
            "customer_id_blocking_threshold": 5,
            "card_testing_guard_expiry": 3600
        },
        "is_clear_pan_retries_enabled": false,
        "force_3ds_challenge": false,
        "is_debit_routing_enabled": false,
        "merchant_business_country": null,
        "is_pre_network_tokenization_enabled": false,
        "acquirer_configs": null,
        "is_iframe_redirection_enabled": null,
        "merchant_category_code": null,
        "merchant_country_code": null,
        "dispute_polling_interval": null,
        "is_manual_retry_enabled": null,
        "always_enable_overcapture": null,
        "is_external_vault_enabled": "skip",
        "external_vault_connector_details": null,
        "billing_processor_id": null,
        "is_l2_l3_enabled": false
    }
]

Connector APIs:

1. Payment Connector - Create

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
    "disabled": false,
    "connector_label": "stripe_test4",
    "test_mode": true,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Mastercard"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    }
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Interac"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "AmericanExpress"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "JCB"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "DinersClub"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Discover"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "CartesBancaires"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "UnionPay"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Mastercard"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    }
                }
            ]
        },
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Interac"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "AmericanExpress"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "JCB"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "DinersClub"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Discover"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "CartesBancaires"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "UnionPay"
                    ],
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "metadata": {},
    "connector_account_details": {
        "api_key": "test_key",
        "auth_type": "HeaderKey"
    },
    "additional_merchant_data": null,
    "status": "active",
    "pm_auth_config": null,
    "connector_wallets_details": null
}'

Response

{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "connector_label": "stripe_test4",
    "merchant_connector_id": "mca_YseU3fl4YU2wLIlP0wRY",
    "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "te****ey"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Mastercard"
                    ],
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    },
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Interac"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "AmericanExpress"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "JCB"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "DinersClub"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Discover"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "CartesBancaires"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "UnionPay"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Mastercard"
                    ],
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    },
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Interac"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "AmericanExpress"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "JCB"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "DinersClub"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Discover"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "CartesBancaires"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "UnionPay"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": {},
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": null,
    "business_label": null,
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null
}
2. Payment Connector - Retrieve

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/connectors/mca_YseU3fl4YU2wLIlP0wRY' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \

Response

{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "connector_label": "stripe_test4",
    "merchant_connector_id": "mca_YseU3fl4YU2wLIlP0wRY",
    "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "te****ey"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Mastercard"
                    ],
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    },
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Interac"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "AmericanExpress"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "JCB"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "DinersClub"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Discover"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "CartesBancaires"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "UnionPay"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Mastercard"
                    ],
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    },
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Interac"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "AmericanExpress"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "JCB"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "DinersClub"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Discover"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "CartesBancaires"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "UnionPay"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": {},
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": null,
    "business_label": null,
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null
}
3. Payment Connector - Update

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/connectors/mca_YseU3fl4YU2wLIlP0wRY' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--data '{
    "connector_type": "payment_processor",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "12345"
    },
    "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": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    }
                },
                {
                    "payment_method_type": "debit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    }
                }
            ]
        },
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "klarna",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "affirm",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "afterpay_clearpay",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245"
    },
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret"
    }
}'

Response

{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "connector_label": "stripe_test4",
    "merchant_connector_id": "mca_YseU3fl4YU2wLIlP0wRY",
    "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": "12*45"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    },
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "USD",
                            "GBP",
                            "INR"
                        ]
                    },
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "klarna",
                    "payment_experience": "redirect_to_url",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "affirm",
                    "payment_experience": "redirect_to_url",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "afterpay_clearpay",
                    "payment_experience": "redirect_to_url",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "connector_webhook_details": {
        "merchant_secret": "MyWebhookSecret",
        "additional_secret": null
    },
    "metadata": {
        "city": "NY",
        "unit": "245"
    },
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": null,
    "business_label": null,
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null
}
4. Payment Connector - List by MID

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/connectors' \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--header 'Accept: */*'

Response

[
    {
        "connector_type": "payment_processor",
        "connector_name": "stripe",
        "connector_label": "stripe_test2",
        "merchant_connector_id": "mca_TNkhsD72bm17RDo44XZg",
        "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
        "payment_methods_enabled": [
            {
                "payment_method": "card",
                "payment_method_types": [
                    {
                        "payment_method_type": "credit",
                        "payment_experience": null,
                        "card_networks": [
                            "Visa",
                            "Mastercard"
                        ],
                        "accepted_currencies": {
                            "type": "enable_only",
                            "list": [
                                "USD",
                                "GBP",
                                "INR"
                            ]
                        },
                        "accepted_countries": {
                            "type": "disable_only",
                            "list": [
                                "HK"
                            ]
                        },
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "debit",
                        "payment_experience": null,
                        "card_networks": [
                            "Visa",
                            "Mastercard"
                        ],
                        "accepted_currencies": {
                            "type": "enable_only",
                            "list": [
                                "USD",
                                "GBP",
                                "INR"
                            ]
                        },
                        "accepted_countries": {
                            "type": "disable_only",
                            "list": [
                                "HK"
                            ]
                        },
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    }
                ]
            },
            {
                "payment_method": "pay_later",
                "payment_method_types": [
                    {
                        "payment_method_type": "klarna",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "affirm",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "afterpay_clearpay",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    }
                ]
            }
        ],
        "test_mode": true,
        "disabled": false,
        "frm_configs": null,
        "business_country": null,
        "business_label": null,
        "business_sub_label": null,
        "applepay_verified_domains": null,
        "pm_auth_config": null,
        "status": "active"
    },
    {
        "connector_type": "payment_processor",
        "connector_name": "stripe",
        "connector_label": "stripe_test4",
        "merchant_connector_id": "mca_YseU3fl4YU2wLIlP0wRY",
        "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
        "payment_methods_enabled": [
            {
                "payment_method": "card",
                "payment_method_types": [
                    {
                        "payment_method_type": "credit",
                        "payment_experience": null,
                        "card_networks": [
                            "Visa",
                            "Mastercard"
                        ],
                        "accepted_currencies": {
                            "type": "enable_only",
                            "list": [
                                "USD",
                                "GBP",
                                "INR"
                            ]
                        },
                        "accepted_countries": {
                            "type": "disable_only",
                            "list": [
                                "HK"
                            ]
                        },
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "debit",
                        "payment_experience": null,
                        "card_networks": [
                            "Visa",
                            "Mastercard"
                        ],
                        "accepted_currencies": {
                            "type": "enable_only",
                            "list": [
                                "USD",
                                "GBP",
                                "INR"
                            ]
                        },
                        "accepted_countries": {
                            "type": "disable_only",
                            "list": [
                                "HK"
                            ]
                        },
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    }
                ]
            },
            {
                "payment_method": "pay_later",
                "payment_method_types": [
                    {
                        "payment_method_type": "klarna",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "affirm",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "afterpay_clearpay",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    }
                ]
            }
        ],
        "test_mode": true,
        "disabled": false,
        "frm_configs": null,
        "business_country": null,
        "business_label": null,
        "business_sub_label": null,
        "applepay_verified_domains": null,
        "pm_auth_config": null,
        "status": "active"
    }
]
5. Payment Connector - List by MID at Profile level

Request

curl --location 'http://localhost:8080/account/merchant_1761407178/profile/connectors' \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--header 'Accept: */*'

Response

[
    {
        "connector_type": "payment_processor",
        "connector_name": "stripe",
        "connector_label": "stripe_test2",
        "merchant_connector_id": "mca_TNkhsD72bm17RDo44XZg",
        "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
        "payment_methods_enabled": [
            {
                "payment_method": "card",
                "payment_method_types": [
                    {
                        "payment_method_type": "credit",
                        "payment_experience": null,
                        "card_networks": [
                            "Visa",
                            "Mastercard"
                        ],
                        "accepted_currencies": {
                            "type": "enable_only",
                            "list": [
                                "USD",
                                "GBP",
                                "INR"
                            ]
                        },
                        "accepted_countries": {
                            "type": "disable_only",
                            "list": [
                                "HK"
                            ]
                        },
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "debit",
                        "payment_experience": null,
                        "card_networks": [
                            "Visa",
                            "Mastercard"
                        ],
                        "accepted_currencies": {
                            "type": "enable_only",
                            "list": [
                                "USD",
                                "GBP",
                                "INR"
                            ]
                        },
                        "accepted_countries": {
                            "type": "disable_only",
                            "list": [
                                "HK"
                            ]
                        },
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    }
                ]
            },
            {
                "payment_method": "pay_later",
                "payment_method_types": [
                    {
                        "payment_method_type": "klarna",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "affirm",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "afterpay_clearpay",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    }
                ]
            }
        ],
        "test_mode": true,
        "disabled": false,
        "frm_configs": null,
        "business_country": null,
        "business_label": null,
        "business_sub_label": null,
        "applepay_verified_domains": null,
        "pm_auth_config": null,
        "status": "active"
    },
    {
        "connector_type": "payment_processor",
        "connector_name": "stripe",
        "connector_label": "stripe_test4",
        "merchant_connector_id": "mca_YseU3fl4YU2wLIlP0wRY",
        "profile_id": "pro_5y9LEIqbVURmaTGmIAD9",
        "payment_methods_enabled": [
            {
                "payment_method": "card",
                "payment_method_types": [
                    {
                        "payment_method_type": "credit",
                        "payment_experience": null,
                        "card_networks": [
                            "Visa",
                            "Mastercard"
                        ],
                        "accepted_currencies": {
                            "type": "enable_only",
                            "list": [
                                "USD",
                                "GBP",
                                "INR"
                            ]
                        },
                        "accepted_countries": {
                            "type": "disable_only",
                            "list": [
                                "HK"
                            ]
                        },
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "debit",
                        "payment_experience": null,
                        "card_networks": [
                            "Visa",
                            "Mastercard"
                        ],
                        "accepted_currencies": {
                            "type": "enable_only",
                            "list": [
                                "USD",
                                "GBP",
                                "INR"
                            ]
                        },
                        "accepted_countries": {
                            "type": "disable_only",
                            "list": [
                                "HK"
                            ]
                        },
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    }
                ]
            },
            {
                "payment_method": "pay_later",
                "payment_method_types": [
                    {
                        "payment_method_type": "klarna",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "affirm",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    },
                    {
                        "payment_method_type": "afterpay_clearpay",
                        "payment_experience": "redirect_to_url",
                        "card_networks": null,
                        "accepted_currencies": null,
                        "accepted_countries": null,
                        "minimum_amount": 1,
                        "maximum_amount": 68607706,
                        "recurring_enabled": true,
                        "installment_payment_enabled": true
                    }
                ]
            }
        ],
        "test_mode": true,
        "disabled": false,
        "frm_configs": null,
        "business_country": null,
        "business_label": null,
        "business_sub_label": null,
        "applepay_verified_domains": null,
        "pm_auth_config": null,
        "status": "active"
    }
]

Test Setup

  1. Create two merchant accounts: merchant_A and merchant_B in same organization, or separate organizations.
  2. Generate API keys: One API key for each merchant account
  3. Create merchant connector accounts (MCAs): One MCA for each merchant account - mca_A belongs to merchant_A - mca_B belongs to merchant_B

Need to test all possible combinations of merchant_id, api-key, profile_id, mca_id based on the parameters used in each API (both happy and unauthorized cases)

Checklist

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

🤖 Generated with Claude Code

tsdk02 avatar Oct 25 '25 18:10 tsdk02

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/routes/profiles.rs  80% smaller
  crates/router/src/core/admin.rs  58% smaller
  crates/router/src/routes/admin.rs  42% smaller
  crates/router/src/core/connector_onboarding/paypal.rs  0% smaller

semanticdiff-com[bot] avatar Oct 25 '25 18:10 semanticdiff-com[bot]

Codecov Report

:x: Patch coverage is 97.05882% with 1 line in your changes missing coverage. Please review. :warning: Please upload report for BASE (main@781e392). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...tes/router/src/core/connector_onboarding/paypal.rs 0.00% 1 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10002   +/-   ##
=======================================
  Coverage        ?    6.50%           
=======================================
  Files           ?     1238           
  Lines           ?   309180           
  Branches        ?        0           
=======================================
  Hits            ?    20106           
  Misses          ?   289074           
  Partials        ?        0           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Oct 25 '25 19:10 codecov[bot]