Skip to content

feat(core): add support for upi_intent and upi_qr#9716

Merged
bernard-eugine merged 9 commits intomainfrom
upi-intent-support
Oct 13, 2025
Merged

feat(core): add support for upi_intent and upi_qr#9716
bernard-eugine merged 9 commits intomainfrom
upi-intent-support

Conversation

@kanikac199
Copy link
Contributor

@kanikac199 kanikac199 commented Oct 7, 2025

Type of Change

Add support for UPI Intent uri information in payment responses by introducing a new next action type that properly handles UPI intent URIs from the Unified Connector Service (UCS).
Add UpiQr payment method type with exhaustive pattern matching across all connectors.

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

Description

  • Add SdkUpiIntentInformation struct and NextActionData variant for URI responses
  • Add UpiQr payment method type with exhaustive pattern matching across all connectors

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?

Enable UCS Config

Request

curl --location 'http://localhost:8080/v2/configs/' \
--header 'Authorization: admin-api-key=-' \
--header 'Content-Type: application/json' \
--header 'api-key: -' \
--data '{
    "key": "ucs_enabled",
    "value": "true"
}'
Enable UCS Config - Authorize

Request

curl --location 'http://localhost:8080/v2/configs/' \
--header 'Content-Type: application/json' \
--header 'Authorization: admin-api-key=-' \
--header 'api-key: -' \
--data '{
    "key": "ucs_rollout_config_cloth_seller1759845350_tC1lH69Qgy3zCcC7ODE2_razorpay_upi_Authorize",
    "value": "1.0"
}'
Payments - create+confirm

Request

{
    "amount_details": {
        "order_amount": 100,
        "currency": "INR"
    },
    "merchant_connector_details": {
        "connector_name": "razorpay",
        "merchant_connector_creds": {
            "auth_type": "-",
            "api_key": "-",
            "key1": "-"
        }
    },
    "capture_method": "automatic",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method_data": {
        "upi": {
            "upi_intent": {
                //"vpa_id": "success@razorpay"
            }
        },
        "billing": {
            "address": {
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "city": "San Fransico",
                "state": "California",
                "zip": "94122",
                "country": "IN",
                "first_name": "Swangi",
                "last_name": "Kumari"
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "merchant_reference_id": "{{$timestamp}}",
    "payment_method_subtype": "upi_intent",
    "payment_method_type": "upi",
    "return_raw_connector_response": true
}
Payment Response

Response

{
    "id": "12345_pay_0199bf084f0679e3adfe80128df0e8a1",
    "status": "requires_customer_action",
    "amount": {
        "order_amount": 100,
        "currency": "INR",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 100,
        "amount_captured": 100
    },
    "customer_id": null,
    "connector": "razorpay",
    "created": "2025-10-07T14:16:56.841Z",
    "modified_at": "2025-10-07T14:17:00.767Z",
    "payment_method_data": {
        "billing": {
            "address": {
                "city": "San Fransico",
                "country": "IN",
                "line1": "1467",
                "line2": "Harrison Street",
                "line3": "Harrison Street",
                "zip": "94122",
                "state": "California",
                "first_name": "Swangi",
                "last_name": "Kumari",
                "origin_zip": null
            },
            "phone": {
                "number": "8056594427",
                "country_code": "+91"
            },
            "email": "swangi.kumari@juspay.in"
        }
    },
    "payment_method_type": "upi",
    "payment_method_subtype": "upi_intent",
    "connector_transaction_id": "pay_RQc3oRG2vz1RlV",
    "connector_reference_id": "order_RQc3oHOo2AieDT",
    "merchant_connector_id": null,
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": null,
    "payment_method_id": null,
    "next_action": {
        "type": "sdk_upi_intent_information",
        "sdk_uri": "upi://pay?pa=upi@razopay&pn=MWSolutions&tr=bLsnV4bsu3xDjOS&tn=razorpay&am=1&cu=INR&mc=5411"
    },
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "authentication_type_applied": "no_three_ds",
    "is_iframe_redirection_enabled": null,
    "merchant_reference_id": "1759846617",
    "raw_connector_response": "{\"razorpay_payment_id\":\"pay_RQc3oRG2vz1RlV\",\"link\":\"upi://pay?pa=upi@razopay&pn=MWSolutions&tr=bLsnV4bsu3xDjOS&tn=razorpay&am=1&cu=INR&mc=5411\"}",
    "feature_metadata": null,
    "metadata": 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

@kanikac199 kanikac199 requested a review from a team as a code owner October 7, 2025 13:05
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 7, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs  87% smaller
  crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs  82% smaller
  crates/payment_methods/src/helpers.rs  75% smaller
  crates/hyperswitch_connectors/src/connectors/adyen.rs  43% smaller
  crates/hyperswitch_connectors/src/connectors/klarna.rs  41% smaller
  crates/router/src/types/transformers.rs  40% smaller
  crates/openapi/src/openapi.rs  23% smaller
  crates/openapi/src/openapi_v2.rs  23% smaller
  crates/router/src/core/unified_connector_service/transformers.rs  19% smaller
  crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs  5% smaller
  crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs  4% smaller
  api-reference/v1/openapi_spec_v1.json  0% smaller
  api-reference/v2/openapi_spec_v2.json  0% smaller
  crates/api_models/src/payments.rs  0% smaller
  crates/api_models/src/payments/additional_info.rs  0% smaller
  crates/common_enums/src/enums.rs  0% smaller
  crates/common_enums/src/transformers.rs  0% smaller
  crates/euclid/src/frontend/dir/enums.rs  0% smaller
  crates/euclid/src/frontend/dir/lowering.rs  0% smaller
  crates/euclid/src/frontend/dir/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs  0% smaller
  crates/hyperswitch_domain_models/src/payment_method_data.rs  0% smaller
  crates/kgraph_utils/src/mca.rs  0% smaller
  crates/kgraph_utils/src/transformers.rs  0% smaller
  crates/router/src/compatibility/stripe/payment_intents/types.rs  0% smaller
  crates/router/src/compatibility/stripe/setup_intents/types.rs  0% smaller
  crates/router/src/core/payments.rs  0% smaller
  crates/router/src/core/payments/transformers.rs  0% smaller
  crates/router/src/core/unified_connector_service.rs  0% smaller

@kanikac199 kanikac199 requested a review from a team as a code owner October 7, 2025 14:36
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Oct 7, 2025
@kanikac199 kanikac199 requested a review from a team as a code owner October 8, 2025 09:50
@kanikac199 kanikac199 changed the title pass uri from ucs feat(core): add support for upi_intent and upi_qr Oct 8, 2025
@kanikac199 kanikac199 self-assigned this Oct 8, 2025
@kanikac199 kanikac199 added the A-core Area: Core flows label Oct 8, 2025
@kanikac199 kanikac199 requested review from a team as code owners October 8, 2025 12:23
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Oct 8, 2025
@kanikac199 kanikac199 linked an issue Oct 8, 2025 that may be closed by this pull request
}
hyperswitch_domain_models::payment_method_data::UpiData::UpiQr(_) => {
let upi_details = payments_grpc::UpiIntent { app_name: None };
PaymentMethod::UpiIntent(upi_details)
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be mapped to UpiQr right? UpiQr type is already there in PaymentMethod
File - target/debug/build/grpc-api-types-b30de937a51ad817/out/ucs.v2.rs

Suggested change
PaymentMethod::UpiIntent(upi_details)
PaymentMethod::UpiQr(upi_details)

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@kanikac199 kanikac199 requested a review from a team as a code owner October 8, 2025 14:40
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Oct 8, 2025
swangi-kumari
swangi-kumari previously approved these changes Oct 9, 2025
@bernard-eugine bernard-eugine added this pull request to the merge queue Oct 13, 2025
Merged via the queue into main with commit 5c7a607 Oct 13, 2025
23 of 25 checks passed
@bernard-eugine bernard-eugine deleted the upi-intent-support branch October 13, 2025 13:09
chaitak-gorai pushed a commit that referenced this pull request Oct 16, 2025
Co-authored-by: Kanika Chaudhary <kanika.c@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
drdholu pushed a commit to drdholu/hyperswitch that referenced this pull request Oct 30, 2025
Co-authored-by: Kanika Chaudhary <kanika.c@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
aadityaguptaa pushed a commit that referenced this pull request Nov 10, 2025
Co-authored-by: Kanika Chaudhary <kanika.c@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
@kanikac199 kanikac199 restored the upi-intent-support branch November 20, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add SDK UPI_Intent and UPI_QR Support

7 participants