fix(core): add request_extended_authorization in the payment attempt and populate it in the payment response#9492
Merged
likhinbopanna merged 10 commits intomainfrom Sep 26, 2025
Merged
fix(core): add request_extended_authorization in the payment attempt and populate it in the payment response#9492likhinbopanna merged 10 commits intomainfrom
likhinbopanna merged 10 commits intomainfrom
Conversation
…e it in the payment response
Changed Files
|
Comment on lines
+192
to
+205
|
|
||
| let is_extended_authorization_requested = intent_request_extended_authorization_optional | ||
| .map(|should_request_extended_authorization| *should_request_extended_authorization) | ||
| .or(always_request_extended_authorization_optional.map(|should_always_request_extended_authorization| *should_always_request_extended_authorization)); | ||
|
|
||
|
|
||
| is_extended_authorization_requested | ||
| .map(|requested| { | ||
| if requested { | ||
| is_extended_authorization_supported_by_connector() | ||
| } else { | ||
| false | ||
| } | ||
| }) |
Contributor
There was a problem hiding this comment.
Why this refactor done??
The logic is the same right?
Contributor
Author
There was a problem hiding this comment.
Previously, when always_request_extended_authorization or request_extended_authorization was set to false, the function returned None instead of false. This refactoring corrects that behavior.
deepanshu-iiitu
previously approved these changes
Sep 23, 2025
hrithikesh026
previously approved these changes
Sep 23, 2025
hrithikesh026
approved these changes
Sep 23, 2025
deepanshu-iiitu
approved these changes
Sep 23, 2025
pixincreate
added a commit
that referenced
this pull request
Sep 30, 2025
…pay-new-field * 'main' of github.com:juspay/hyperswitch: (21 commits) feat(payments): add tokenization action handling to payment flow for braintree (#9506) feat(connector): [Loonio] Add template code (#9586) fix(connector): [paysafe] make `eci_indicator` field optional (#9591) fix(core): add should_call_connector_customer function to connector specification (#9569) feat(ucs): Add profile ID to lineage tracking in Unified Connector Service (#9559) feat(core): Add support for partial auth in proxy payments [V2] (#9503) chore(version): 2025.09.30.0 fix(authorizedotnet): refund via ucs missing connector_metadata (#9581) feat(auth): add new authentication to communicate between microservices (#9547) Fix: Ideal Giropay Country Currency Config (#9552) feat(connector): [ACI] cypress added (#9502) feat(connector): Add Peachpayments Cypress (#9573) chore(version): 2025.09.29.0 feat(finix): template code (#9557) feat(cypress): add cypress test-cases for manual retry (#9505) feat(core): update additional payment method data in psync response (#9519) feat(connector): [Checkout] Add Google Pay Predecrypt Flow (#9130) feat(framework): Added smithy, smithy-core and smithy-generator crates (#9249) fix(core): add request_extended_authorization in the payment attempt and populate it in the payment response (#9492) chore(version): 2025.09.26.0 ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
With this PR, whether extended_authorization is requested or not is stored will be stored in the payment_attempt and this value will be populated to a request_extended_authorization field of payments response.
Additional Changes
How did you test it?
1. Business Profile Test
Update the profile with always_request_extended_authorization set to some value(true or false) and check in the db and in the payments response if request_extended_authorization has a value.always_request_extended_authorization set to true
Response
{ "merchant_id": "postman_merchant_GHAction_2eac3720-09af-4a30-a3d9-166fc8ad06b3", "profile_id": "pro_6HUkYrIOhYP6B3aILzcc", "profile_name": "US_default", "return_url": "https://duck.com/success", "enable_payment_response_hash": true, "payment_response_hash_key": "DIWfpvgJBqG54KzNtmlOBTJ4n43KcacnR3di29HpOueuNJMxgMskNDFuKWEBGyuP", "redirect_to_merchant_with_http_post": false, "webhook_details": { "webhook_version": "1.0.1", "webhook_username": "ekart_retail", "webhook_password": "password_ekart@123", "webhook_url": null, "payment_created_enabled": true, "payment_succeeded_enabled": true, "payment_failed_enabled": true, "payment_statuses_enabled": null, "refund_statuses_enabled": null, "payout_statuses_enabled": 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": true, "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 }Create a manual payment with Stripe
Response
{ "payment_id": "pay_ykLIxJs4onRC2s6zdfPw", "merchant_id": "postman_merchant_GHAction_2eac3720-09af-4a30-a3d9-166fc8ad06b3", "status": "failed", "amount": 100, "net_amount": 100, "shipping_cost": null, "amount_capturable": 100, "amount_received": null, "connector": "stripe", "client_secret": "pay_ykLIxJs4onRC2s6zdfPw_secret_q1lMFxgQ0E2pH87R93XG", "created": "2025-09-22T12:49:52.183Z", "currency": "USD", "customer_id": null, "customer": { "id": null, "name": null, "email": "hello@123.com", "phone": null, "phone_country_code": null }, "description": null, "refunds": null, "disputes": null, "mandate_id": null, "mandate_data": null, "setup_future_usage": null, "off_session": null, "capture_on": null, "capture_method": "manual", "payment_method": "card", "payment_method_data": { "card": { "last4": "1111", "card_type": null, "card_network": null, "card_issuer": null, "card_issuing_country": null, "card_isin": "411111", "card_extended_bin": null, "card_exp_month": "03", "card_exp_year": "30", "card_holder_name": null, "payment_checks": null, "authentication_data": null }, "billing": null }, "payment_token": null, "shipping": null, "billing": { "address": { "city": "Fasdf", "country": "US", "line1": "Fasdf", "line2": "Fasdf", "line3": null, "zip": "560095", "state": null, "first_name": "Sakil", "last_name": "Mostak", "origin_zip": null }, "phone": null, "email": null }, "order_details": null, "email": null, "name": null, "phone": null, "return_url": null, "authentication_type": "no_three_ds", "statement_descriptor_name": null, "statement_descriptor_suffix": null, "next_action": null, "cancellation_reason": null, "error_code": "payment_intent_invalid_parameter", "error_message": "This account is not eligible for the requested card features. See https://stripe.com/docs/payments/flexible-payments for more details.", "unified_code": "UE_9000", "unified_message": "Something went wrong", "payment_experience": null, "payment_method_type": "credit", "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": null, "manual_retry_allowed": null, "connector_transaction_id": "pi_3SA9BlAGHc77EJXX1OXP35Vl", "frm_message": null, "metadata": null, "connector_metadata": null, "feature_metadata": { "redirect_response": null, "search_tags": null, "apple_pay_recurring_details": null, "gateway_system": "direct" }, "reference_id": null, "payment_link": null, "profile_id": "pro_6HUkYrIOhYP6B3aILzcc", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_s4PnNNpe7LwkjRyfEvmp", "incremental_authorization_allowed": false, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2025-09-22T13:04:52.183Z", "fingerprint": null, "browser_info": { "language": "nl-NL", "time_zone": 0, "ip_address": "13.232.74.226", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", "color_depth": 24, "java_enabled": true, "screen_width": 1536, "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", "screen_height": 723, "java_script_enabled": true }, "payment_channel": null, "payment_method_id": null, "network_transaction_id": null, "payment_method_status": null, "updated": "2025-09-22T12:49:53.878Z", "split_payments": null, "frm_metadata": null, "extended_authorization_applied": null, "request_extended_authorization": true, "capture_before": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null, "card_discovery": "manual", "force_3ds_challenge": false, "force_3ds_challenge_trigger": false, "issuer_error_code": null, "issuer_error_message": null, "is_iframe_redirection_enabled": null, "whole_connector_response": null, "enable_partial_authorization": null, "enable_overcapture": null, "is_overcapture_enabled": null, "network_details": { "network_advice_code": null } }Check in db request_extended_authorization it should be mapped to true.

always_request_extended_authorization set false
Respone
{ "merchant_id": "postman_merchant_GHAction_241e3056-dd0d-4392-abfa-32bc2ba4c3b7", "profile_id": "pro_pDzlzlZVZzVMIvRpcTOv", "profile_name": "US_default", "return_url": "https://duck.com/success", "enable_payment_response_hash": true, "payment_response_hash_key": "lxOo9T83QvJdU1PWsspK1O3x5qJUEu22TI72vJzkm3UEP6sqNREyDvDyuX2D84Xk", "redirect_to_merchant_with_http_post": false, "webhook_details": { "webhook_version": "1.0.1", "webhook_username": "ekart_retail", "webhook_password": "password_ekart@123", "webhook_url": null, "payment_created_enabled": true, "payment_succeeded_enabled": true, "payment_failed_enabled": true, "payment_statuses_enabled": null, "refund_statuses_enabled": null, "payout_statuses_enabled": 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": false, "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 }Create a payment
Response
Check the DB and Response for request_extended_authorization value
2. Flag via payments request
Send request_extended_authorization as true in the payment request ``` curl --location 'http://localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: dev_SoBkjnCCR6vQuUzhfDETQ1hGDWx1MQIokijq3SZ2fIxVQHWGhDrZs2O0IdtOXe60' \ --data-raw '{ "amount": 100, "currency": "USD", "confirm": true, "capture_method": "manual", "email": "hello@123.com", "request_extended_authorization": true, "payment_method": "card", "payment_method_type": "credit", "payment_method_data": { "card": { "card_number": "4111111111111111", "card_exp_month": "03", "card_exp_year": "30",}'
Checklist
cargo +nightly fmt --allcargo clippy