Skip to content

Conversation

Anurag-05-prog
Copy link
Contributor

Type of Change

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

closes this issue

Description

Added all_keys_required in confirm and psync payload. If all_keys_required is passed as true, we will send the whole connector response.

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?

Postman Test

Confirm call (with all_keys_required passed as true)

Request (taking AuthorizeDotNet as connector)

curl --location 'http://localhost:8080/payments/pay_MsmPKoZNKAk0zpoBuA5Z/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'all_keys_required: true' \
--header 'api-key: ••••••' \
--data '
{
    "connector": ["authorizedotnet"],
    "all_keys_required": true,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "370000000000002",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    }
}
'

Response:

{
    "payment_id": "pay_UHNVQh54xvuv97CixQVF",
    "merchant_id": "merchant_1746796056",
    "status": "succeeded",
    "amount": 35308,
    "net_amount": 35308,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 35308,
    "connector": "authorizedotnet",
    "client_secret": "pay_UHNVQh54xvuv97CixQVF_secret_aUvQnXDaU6Op4uFuWHC1",
    "created": "2025-05-09T13:08:19.469Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0000",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "491761",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_xZJ3bAv0dVvWBWpuYRga",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "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": false,
    "connector_transaction_id": "80040892370",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "80040892370",
    "payment_link": null,
    "profile_id": "pro_NLQkgFo4oL87ujOInwp1",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_Bjt7NDYXrZmazh9Tdavu",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-05-09T13:23:19.469Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": null,
        "time_zone": null,
        "ip_address": "::1",
        "os_version": null,
        "user_agent": null,
        "color_depth": null,
        "device_model": null,
        "java_enabled": null,
        "screen_width": null,
        "accept_header": null,
        "screen_height": null,
        "accept_language": "en",
        "java_script_enabled": null
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-05-09T13:18:33.486Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "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,
    "whole_connector_response": "{\"transactionResponse\":{\"responseCode\":\"1\",\"authCode\":\"140GJ4\",\"avsResultCode\":\"Y\",\"cvvResultCode\":\"P\",\"cavvResultCode\":\"2\",\"transId\":\"80040892370\",\"refTransID\":\"\",\"transHash\":\"\",\"testRequest\":\"0\",\"accountNumber\":\"XXXX0000\",\"accountType\":\"Visa\",\"messages\":[{\"code\":\"1\",\"description\":\"This transaction has been approved.\"}],\"transHashSha2\":\"EDD14C10BDDBD427B768E42099F1AF0D089221FA13F9CA55D8B6323C8449585476AFEE55B4A054EE7FD26F73D4B85EF147B0552F0DB4EE17F4F60F8FB16CA2B9\",\"SupplementalDataQualificationIndicator\":0,\"networkTransId\":\"Z9TSL0XISGMU542D7Z5TF0A\"},\"refId\":\"\",\"messages\":{\"resultCode\":\"Ok\",\"message\":[{\"code\":\"I00001\",\"text\":\"Successful.\"}]}}"
}

Psync:

URL:

{{baseUrl}}/payments/:id?expand_captures=true&expand_attempts=true&all_keys_required=true

Response:

{
    "payment_id": "pay_UHNVQh54xvuv97CixQVF",
    "merchant_id": "merchant_1746796056",
    "status": "succeeded",
    "amount": 35308,
    "net_amount": 35308,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 35308,
    "connector": "authorizedotnet",
    "client_secret": "pay_UHNVQh54xvuv97CixQVF_secret_aUvQnXDaU6Op4uFuWHC1",
    "created": "2025-05-09T13:08:19.469Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_UHNVQh54xvuv97CixQVF_1",
            "status": "charged",
            "amount": 35308,
            "order_tax_amount": null,
            "currency": "USD",
            "connector": "authorizedotnet",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": "80040892370",
            "capture_method": "automatic",
            "authentication_type": "three_ds",
            "created_at": "2025-05-09T13:08:19.470Z",
            "modified_at": "2025-05-09T13:18:33.485Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": "token_xZJ3bAv0dVvWBWpuYRga",
            "connector_metadata": {
                "creditCard": {
                    "cardNumber": "XXXX0000",
                    "expirationDate": "XXXX"
                }
            },
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": "80040892370",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0000",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "491761",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_xZJ3bAv0dVvWBWpuYRga",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "authentication_type": "three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "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": false,
    "connector_transaction_id": "80040892370",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "80040892370",
    "payment_link": null,
    "profile_id": "pro_NLQkgFo4oL87ujOInwp1",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_Bjt7NDYXrZmazh9Tdavu",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-05-09T13:23:19.469Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "language": null,
        "time_zone": null,
        "ip_address": "::1",
        "os_version": null,
        "user_agent": null,
        "color_depth": null,
        "device_model": null,
        "java_enabled": null,
        "screen_width": null,
        "accept_header": null,
        "screen_height": null,
        "accept_language": "en",
        "java_script_enabled": null
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-05-09T13:19:32.525Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "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,
    "whole_connector_response": "{\"transaction\":{\"transId\":\"80040892370\",\"submitTimeUTC\":\"2025-05-09T13:18:33.043Z\",\"submitTimeLocal\":\"2025-05-09T06:18:33.043\",\"transactionType\":\"authCaptureTransaction\",\"transactionStatus\":\"capturedPendingSettlement\",\"responseCode\":1,\"responseReasonCode\":1,\"responseReasonDescription\":\"Approval\",\"authCode\":\"140GJ4\",\"AVSResponse\":\"Y\",\"cardCodeResponse\":\"P\",\"order\":{\"description\":\"pay_UHNVQh54xvuv97CixQVF_1\",\"discountAmount\":0.0,\"taxIsAfterDiscount\":false},\"authAmount\":353.08,\"settleAmount\":353.08,\"taxExempt\":false,\"payment\":{\"creditCard\":{\"cardNumber\":\"XXXX0000\",\"expirationDate\":\"XXXX\",\"cardType\":\"Visa\"}},\"billTo\":{\"firstName\":\"joseph\",\"lastName\":\"Doe\",\"address\":\"1467\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"},\"recurringBilling\":false,\"customerIP\":\"110.227.219.118\",\"product\":\"Card Not Present\",\"marketType\":\"eCommerce\",\"networkTransId\":\"Z9TSL0XISGMU542D7Z5TF0A\",\"authorizationIndicator\":\"final\"},\"messages\":{\"resultCode\":\"Ok\",\"message\":[{\"code\":\"I00001\",\"text\":\"Successful.\"}]}}"
}

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

@Anurag-05-prog Anurag-05-prog requested review from a team as code owners May 9, 2025 13:20
Copy link

semanticdiff-com bot commented May 9, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments.rs  20% smaller
  crates/router/src/services/api.rs  12% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/api_models/src/payments.rs  0% smaller
  crates/hyperswitch_connectors/src/utils.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_data.rs  0% smaller
  crates/hyperswitch_interfaces/src/conversion_impls.rs  0% smaller
  crates/router/src/compatibility/stripe/payment_intents.rs  0% smaller
  crates/router/src/compatibility/stripe/setup_intents.rs  0% smaller
  crates/router/src/core/authentication/transformers.rs  0% smaller
  crates/router/src/core/authentication/utils.rs Unsupported file format
  crates/router/src/core/disputes.rs  0% smaller
  crates/router/src/core/files/helpers.rs  0% smaller
  crates/router/src/core/fraud_check.rs  0% smaller
  crates/router/src/core/fraud_check/flows/checkout_flow.rs  0% smaller
  crates/router/src/core/fraud_check/flows/fulfillment_flow.rs  0% smaller
  crates/router/src/core/fraud_check/flows/record_return.rs  0% smaller
  crates/router/src/core/fraud_check/flows/sale_flow.rs  0% smaller
  crates/router/src/core/fraud_check/flows/transaction_flow.rs  0% smaller
  crates/router/src/core/mandate.rs  0% smaller
  crates/router/src/core/mandate/utils.rs  0% smaller
  crates/router/src/core/payment_methods.rs  0% smaller
  crates/router/src/core/payments/access_token.rs  0% smaller
  crates/router/src/core/payments/customers.rs  0% smaller
  crates/router/src/core/payments/flows.rs  0% smaller
  crates/router/src/core/payments/flows/approve_flow.rs  0% smaller
  crates/router/src/core/payments/flows/authorize_flow.rs  0% smaller
  crates/router/src/core/payments/flows/cancel_flow.rs  0% smaller
  crates/router/src/core/payments/flows/capture_flow.rs  0% smaller
  crates/router/src/core/payments/flows/complete_authorize_flow.rs  0% smaller
  crates/router/src/core/payments/flows/incremental_authorization_flow.rs  0% smaller
  crates/router/src/core/payments/flows/post_session_tokens_flow.rs  0% smaller
  crates/router/src/core/payments/flows/psync_flow.rs  0% smaller
  crates/router/src/core/payments/flows/reject_flow.rs  0% smaller
  crates/router/src/core/payments/flows/session_flow.rs  0% smaller
  crates/router/src/core/payments/flows/session_update_flow.rs  0% smaller
  crates/router/src/core/payments/flows/setup_mandate_flow.rs  0% smaller
  crates/router/src/core/payments/flows/update_metadata_flow.rs  0% smaller
  crates/router/src/core/payments/helpers.rs  0% smaller
  crates/router/src/core/payments/operations/payment_approve.rs  0% smaller
  crates/router/src/core/payments/operations/payment_cancel.rs  0% smaller
  crates/router/src/core/payments/operations/payment_capture.rs  0% smaller
  crates/router/src/core/payments/operations/payment_complete_authorize.rs  0% smaller
  crates/router/src/core/payments/operations/payment_confirm.rs  0% smaller
  crates/router/src/core/payments/operations/payment_create.rs  0% smaller
  crates/router/src/core/payments/operations/payment_post_session_tokens.rs  0% smaller
  crates/router/src/core/payments/operations/payment_reject.rs  0% smaller
  crates/router/src/core/payments/operations/payment_response.rs  0% smaller
  crates/router/src/core/payments/operations/payment_session.rs  0% smaller
  crates/router/src/core/payments/operations/payment_start.rs  0% smaller
  crates/router/src/core/payments/operations/payment_status.rs  0% smaller
  crates/router/src/core/payments/operations/payment_update.rs  0% smaller
  crates/router/src/core/payments/operations/payment_update_metadata.rs  0% smaller
  crates/router/src/core/payments/operations/payments_incremental_authorization.rs  0% smaller
  crates/router/src/core/payments/operations/tax_calculation.rs  0% smaller
  crates/router/src/core/payments/retry.rs  0% smaller
  crates/router/src/core/payments/session_operation.rs  0% smaller
  crates/router/src/core/payments/tokenization.rs  0% smaller
  crates/router/src/core/payments/transformers.rs  0% smaller
  crates/router/src/core/payouts.rs  0% smaller
  crates/router/src/core/payouts/access_token.rs  0% smaller
  crates/router/src/core/refunds.rs  0% smaller
  crates/router/src/core/refunds_v2.rs Unsupported file format
  crates/router/src/core/relay.rs  0% smaller
  crates/router/src/core/relay/utils.rs  0% smaller
  crates/router/src/core/revenue_recovery/api.rs  0% smaller
  crates/router/src/core/revenue_recovery/types.rs  0% smaller
  crates/router/src/core/unified_authentication_service/utils.rs Unsupported file format
  crates/router/src/core/utils.rs  0% smaller
  crates/router/src/core/webhooks/incoming.rs  0% smaller
  crates/router/src/core/webhooks/incoming_v2.rs  0% smaller
  crates/router/src/core/webhooks/recovery_incoming.rs  0% smaller
  crates/router/src/core/webhooks/utils.rs  0% smaller
  crates/router/src/routes/payments.rs  0% smaller
  crates/router/src/types.rs  0% smaller
  crates/router/src/types/api/verify_connector.rs  0% smaller
  crates/router/tests/connectors/aci.rs  0% smaller
  crates/router/tests/connectors/utils.rs  0% smaller
  crates/router/tests/payments.rs  0% smaller
  crates/router/tests/payments2.rs  0% smaller

@Anurag-05-prog Anurag-05-prog linked an issue May 9, 2025 that may be closed by this pull request
2 tasks
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label May 10, 2025
@Anurag-05-prog Anurag-05-prog self-assigned this May 12, 2025
jarnura
jarnura previously approved these changes May 13, 2025
ThisIsMani
ThisIsMani previously approved these changes May 13, 2025
Sakilmostak
Sakilmostak previously approved these changes May 15, 2025
@Gnanasundari24 Gnanasundari24 enabled auto-merge May 15, 2025 10:09
@Anurag-05-prog Anurag-05-prog dismissed stale reviews from Sakilmostak, ThisIsMani, and jarnura via 36a70ae May 19, 2025 09:04
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 19, 2025
Merged via the queue into main with commit 071b073 May 19, 2025
14 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the whole-connector-response branch May 19, 2025 14:00
pixincreate added a commit that referenced this pull request May 20, 2025
…ss-typos

* 'main' of github.com:juspay/hyperswitch:
  chore(version): 2025.05.20.0
  feat(core): add all_keys_required in confirm and psync payload (#7998)
  fix(connector): [CASHTOCODE] Added supported countries and currencies (#8060)
  feat(connector): [CYBERSOURCE] add SEK currency for cybersource (#8048)
  build(deps): migrate usages of `once_cell` crate to standard library equivalents (#8030)
  feat(core): [Network Tokenization] pre network tokenization (#6873)
  feat(router): add open router integration for debit routing (#7907)
  chore(cypress): Update creds for stripe (#8069)
  chore(version): 2025.05.19.0
iemyashasvi pushed a commit that referenced this pull request May 22, 2025
Co-authored-by: Anurag Singh <[email protected]>
Co-authored-by: Anurag Singh <[email protected]>
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
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]: Send whole connector response in confirm and psync call
5 participants