Skip to content

feat(router): add sdk_next_action in payment method list response#9922

Merged
likhinbopanna merged 3 commits intomainfrom
add-next-action-in-pml
Oct 29, 2025
Merged

feat(router): add sdk_next_action in payment method list response#9922
likhinbopanna merged 3 commits intomainfrom
add-next-action-in-pml

Conversation

@sai-harsha-vardhan
Copy link
Contributor

@sai-harsha-vardhan sai-harsha-vardhan commented Oct 18, 2025

Type of Change

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

Description

This PR adds sdk_next_action to the Payment Method List response.

Currently, we check whether the eligibility check is enabled for a merchant based on a runtime configuration. If it is enabled, we return EligibilityCheck as the next action; otherwise, it defaults to Confirm.

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?

Tested Manually

  1. Enable the merchant config for Eligibility Checks

CURL

curl --location '{{BASE_URL}}/configs/' \
--header 'Content-Type: application/json' \
--header 'api-key: {{ADMIN_API_KEY}}' \
--data '{
    "key": "should_perform_eligibility_{{MERCHANT_ID}}",
    "value": "true"
}'

Response

{
    "key": "should_perform_eligibility_merchant_1760017865",
    "value": "true"
}
  1. Check Payment Method List response to find sdk_next_action as eligibility_check

CURL

curl --location --request GET '{{BASE_URL}}/account/payment_methods?client_secret={{CLIENT_SECRET}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{PUBLISHABLE_KEY}}' \
--data '{
    "client_secret": "{{CLIENT_SECRET}}"
}'

Response

{
    "redirect_url": "https://example.com/success",
    "currency": "USD",
    "payment_methods": [
        {
            "payment_method": "card_redirect",
            "payment_method_types": [
                {
                    "payment_method_type": "card_redirect",
                    "payment_experience": [
                        {
                            "payment_experience_type": "redirect_to_url",
                            "eligible_connectors": [
                                "adyen"
                            ]
                        }
                    ],
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": null,
                    "surcharge_details": null,
                    "pm_auth_connector": null
                }
            ]
        }
    ],
    "mandate_payment": null,
    "merchant_name": "NewAge Retailer",
    "show_surcharge_breakup_screen": false,
    "payment_type": "new_mandate",
    "request_external_three_ds_authentication": true,
    "collect_shipping_details_from_wallets": false,
    "collect_billing_details_from_wallets": false,
    "is_tax_calculation_enabled": false,
    "sdk_next_action": {
        "next_action": "eligibility_check"
    }
}

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

@sai-harsha-vardhan sai-harsha-vardhan added this to the July 2025 Release milestone Oct 18, 2025
@sai-harsha-vardhan sai-harsha-vardhan self-assigned this Oct 18, 2025
@sai-harsha-vardhan sai-harsha-vardhan added the A-core Area: Core flows label Oct 18, 2025
@sai-harsha-vardhan sai-harsha-vardhan requested review from a team as code owners October 18, 2025 07:06
@sai-harsha-vardhan sai-harsha-vardhan added the A-payment-methods Area: Payment Methods label Oct 18, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 18, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payment_methods/cards.rs  43% smaller
  api-reference/v1/openapi_spec_v1.json  16% smaller
  crates/router/src/core/payment_methods/utils.rs  1% smaller
  api-reference/v2/openapi_spec_v2.json  0% smaller
  crates/api_models/src/payment_methods.rs  0% smaller
  crates/api_models/src/payments.rs  0% smaller
  crates/common_utils/src/id_type/merchant.rs  0% smaller

@sai-harsha-vardhan sai-harsha-vardhan added the M-api-contract-changes Metadata: This PR involves API contract changes label Oct 18, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 29, 2025
Merged via the queue into main with commit 0d43f48 Oct 29, 2025
27 of 29 checks passed
@likhinbopanna likhinbopanna deleted the add-next-action-in-pml branch October 29, 2025 08:26
aadityaguptaa pushed a commit that referenced this pull request Nov 10, 2025
…9922)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-core Area: Core flows A-payment-methods Area: Payment Methods M-api-contract-changes Metadata: This PR involves API contract changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants