Skip to content

fix(router): correct payment_method_data parsing in list-payments response#13135

Open
ayush22667 wants to merge 2 commits into
mainfrom
fix/session-token-transformers
Open

fix(router): correct payment_method_data parsing in list-payments response#13135
ayush22667 wants to merge 2 commits into
mainfrom
fix/session-token-transformers

Conversation

@ayush22667

@ayush22667 ayush22667 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Type of Change

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

Description

The ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> conversion for
api::PaymentsResponse (used to build the list-payments response) parsed payment_method_data
directly from the raw stored column as PaymentMethodDataResponseWithBilling. This is
inconsistent with how the field is derived elsewhere in this file, where the stored value is read
via the encryption-strategy-aware accessor and parsed as AdditionalPaymentData before being
converted to PaymentMethodDataResponse. Depending on the merchant's payment method data
encryption strategy, the raw-column parse could silently fail or return incorrect data, so
payment_method_data came back None/incorrect for affected payments in list responses.

This PR rebuilds payment_method_data using
check_and_get_payment_method_data_based_on_encryption_strategy() +
AdditionalPaymentDataPaymentMethodDataResponse::from, matching the pattern already used by
the other response conversions in this file.

Additional Changes

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

Motivation and Context

payment_method_data in the list-payments response was being parsed inconsistently with the rest
of the codebase, leading to it being dropped/incorrect for some payments depending on encryption
strategy.

How did you test it?

1. Create + Confirm Google Pay

Request

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: [REDACTED]
--header 'Accept: */*' \
--data '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "email": "guest@example.com",
    "description": "Wallet card_network test - Google Pay (real token)",
    "profile_id": "pro_gtySM1HUCsyhg2fP9KBb",
    "connector":["cybersource"],
    "payment_method": "wallet",
    "payment_method_type": "google_pay",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "type": "CARD",
                "description": "Test Card: Visa •••• 1111",
                "info": {
                    "assurance_details": {
                        "account_verified": true,
                        "card_holder_authenticated": false
                    },
                    "card_details": "1111",
                    "card_network": "VISA"
                },
                "tokenization_data": {
                    "token": "[REDACTED]"signature\":\"MEUCIQDNxtwjFHqfzmfzWXWFzUzDTNL/iWRJ5M8zblj/yZGk7QIgMnNBg57MpFKN+cvjS2K6aQ/0N6wfMJ0FoHHMzo8sPRg=\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHuR67Ic/1L0ra4n1lWivISHUTVQCT/snnuDRHAkfXLxkFczMV1V80LmjvdgCYoJ26fUNB515Iy42AGfi30Y8GA\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1783665186494\\\"}\",\"signatures\":[\"MEQCIDHFvFkHQyZVC6VTJJ0yhTJaKjw64grNmSrv+pIA7GiqAiBWqrzXXhuw3YxsMerYZY8CNwOZUQm4iifa57CaTUPRbQ==\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"7ZOBGiD1y/YLMRx6aPly7XZwt3qYUjv+ex0Uxdzj0ULJhVuSLn2oZQaJfxb2/OJlfdn6rNNVbxKuOv6FWpJVASxuX4FouRtU6WMcAQe/7jTQDoZidBv1IPNgTB5c6C/x6VM2DIlOU0dmOMMWdSmtBl/CO+sh/bfnGjEKihvOmKlfzGKnEFdZvLe4+R8yO+yJsWpbSkVjLatstzP7Wr+613jDaEe8goeb3Ky2oFJpxX3PysAiO7JNtJkr/hGfqHcXOFgGsTu6fAY1ljHUsdYPvMTP+KBqaPrL7GuKazyOeAcSEsc4SSA58HfWryhUqm98uJvXuiqfTvPttEZIbDJJB5LviaqtcXVftamzmjelexLiRG0Uu1WkSGoGQnql55trJNfNewRT4K0K/JHPynIuYI2tiubRFvQ7CMEVdV+E6xtjtT1x2ugRXyF2IH27uSKb+8VObGkx7fyv7dJEsug8QG811I7EqZP6twdcfqleXnj7m1kP6wlWRKvjdY4KqdQGILqHBsKlYM9n7AwFKIID5tQ5Fc+9UNus0LKzSYgb21abVIrfsKS/hpC/sxyic1zp2TRkG3kOF3u9+AWJcrLQlUg5z4mxkPAZ\\\",\\\"ephemeralPublicKey\\\":\\\"BI28aI3GXCbz2Lzhd2kwPCX/0D84Va5clfBB/MIKUiVp4kbTF5TgGGHjGycT8EbHQeTgltbZftYsNedaCLieXbo\\\\u003d\\\",\\\"tag\\\":\\\"lSNCquT/vVdW9u8bYAA7ye3qw2gx0ynvJCPwqJjArZo\\\\u003d\\\"}\"}",
                    "type": "PAYMENT_GATEWAY"
                }
            }
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    }
}'

Response

{
    "payment_id": "pay_5Vv9UddeDEh28R4Pg2uG",
    "merchant_id": "merchant_test_1782976430",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "processor_merchant_id": "merchant_test_1782976430",
    "initiator": null,
    "sdk_authorization": "[REDACTED]",
    "connector": "cybersource",
    "state_metadata": null,
    "client_secret": "[REDACTED]",
    "created": "2026-07-02T08:25:37.279Z",
    "modified_at": "2026-07-02T08:25:38.766Z",
    "connector_customer_id": null,
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null,
        "customer_document_details": null
    },
    "description": "Wallet card_network test - Google Pay (real token)",
    "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": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "1111",
                "card_network": "VISA",
                "type": "CARD",
                "card_exp_month": null,
                "card_exp_year": null,
                "auth_code": null,
                "email": null
            }
        },
        "billing": null
    },
    "payment_token": "[REDACTED]",
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": null,
    "phone": null,
    "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,
    "error_details": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "7829807375216745603812",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "connector_response_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "pix_additional_details": null,
        "boleto_additional_details": null,
        "pix_automatico_additional_details": null,
        "finix_additional_details": null
    },
    "reference_id": "pay_5Vv9UddeDEh28R4Pg2uG_1",
    "payment_link": null,
    "profile_id": "pro_gtySM1HUCsyhg2fP9KBb",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_qft8oYSYXS8lAyIILiYm",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2026-07-02T08:40:37.279Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "016153570198200",
    "network_transaction_link_id": null,
    "payment_method_status": null,
    "updated": "2026-07-02T08:25:38.766Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": null,
    "request_extended_authorization": "[REDACTED]",
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "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": "[REDACTED]",
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": null,
    "installment_options": null,
    "installment_data": null,
    "sender_payment_instrument_id": null
}
2. Payments List - Wallet card_network

Request

curl --location 'http://localhost:8080/payments/list?limit=100' \
--header 'Accept: application/json' \
--header 'api-key: [REDACTED]

Response

{
    "size": 4,
    "data": [
        {
            "payment_id": "pay_5Vv9UddeDEh28R4Pg2uG",
            "merchant_id": "merchant_test_1782976430",
            "status": "succeeded",
            "amount": 6540,
            "net_amount": 6540,
            "shipping_cost": null,
            "amount_capturable": 0,
            "amount_received": null,
            "processor_merchant_id": "merchant_test_1782976430",
            "initiator": null,
            "sdk_authorization": "[REDACTED]",
            "connector": "cybersource",
            "state_metadata": null,
            "client_secret": "[REDACTED]",
            "created": "2026-07-02T08:25:37.279Z",
            "modified_at": "2026-07-02T08:25:38.766Z",
            "connector_customer_id": null,
            "currency": "USD",
            "customer_id": null,
            "customer": {
                "id": null,
                "name": null,
                "email": "guest@example.com",
                "phone": null,
                "phone_country_code": null,
                "customer_document_details": null
            },
            "description": "Wallet card_network test - Google Pay (real token)",
            "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": "wallet",
            "payment_method_data": {
                "wallet": {
                    "google_pay": {
                        "last4": "1111",
                        "card_network": "VISA",
                        "type": "CARD",
                        "card_exp_month": null,
                        "card_exp_year": null,
                        "auth_code": null,
                        "email": null
                    }
                },
                "billing": null
            },
            "payment_token": "[REDACTED]",
            "shipping": null,
            "billing": {
                "address": {
                    "city": "San Fransico",
                    "country": "US",
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": null,
                    "zip": "94122",
                    "state": "California",
                    "first_name": "joseph",
                    "last_name": "Doe",
                    "origin_zip": null
                },
                "phone": {
                    "number": "8056594427",
                    "country_code": "+91"
                },
                "email": null
            },
            "order_details": null,
            "email": null,
            "name": null,
            "phone": null,
            "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,
            "error_details": null,
            "payment_experience": null,
            "payment_method_type": "google_pay",
            "connector_label": null,
            "business_country": null,
            "business_label": "default",
            "business_sub_label": null,
            "allowed_payment_method_types": null,
            "manual_retry_allowed": null,
            "connector_transaction_id": "7829807375216745603812",
            "frm_message": null,
            "metadata": null,
            "connector_metadata": null,
            "connector_response_metadata": null,
            "feature_metadata": null,
            "reference_id": null,
            "payment_link": null,
            "profile_id": "pro_gtySM1HUCsyhg2fP9KBb",
            "surcharge_details": null,
            "attempt_count": 1,
            "merchant_decision": null,
            "merchant_connector_id": "mca_qft8oYSYXS8lAyIILiYm",
            "incremental_authorization_allowed": null,
            "authorization_count": null,
            "incremental_authorizations": null,
            "external_authentication_details": null,
            "external_3ds_authentication_attempted": null,
            "expires_on": null,
            "fingerprint": null,
            "browser_info": null,
            "payment_channel": null,
            "payment_method_id": null,
            "network_transaction_id": null,
            "network_transaction_link_id": null,
            "payment_method_status": null,
            "updated": "2026-07-02T08:25:38.766Z",
            "split_payments": null,
            "frm_metadata": null,
            "extended_authorization_applied": null,
            "extended_authorization_last_applied_at": null,
            "request_extended_authorization": "[REDACTED]",
            "capture_before": null,
            "merchant_order_reference_id": null,
            "order_tax_amount": null,
            "connector_mandate_id": null,
            "card_discovery": null,
            "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": "[REDACTED]",
            "enable_overcapture": null,
            "is_overcapture_enabled": null,
            "network_details": null,
            "is_stored_credential": null,
            "mit_category": null,
            "billing_descriptor": null,
            "tokenization": null,
            "partner_merchant_identifier_details": null,
            "payment_method_tokenization_details": null,
            "installment_options": null,
            "installment_data": null,
            "sender_payment_instrument_id": null
        },
        {
            "payment_id": "pay_mZ7zCVnH6ehSnuu62irJ",
            "merchant_id": "merchant_test_1782976430",
            "status": "succeeded",
            "amount": 6540,
            "net_amount": 6540,
            "shipping_cost": null,
            "amount_capturable": 0,
            "amount_received": null,
            "processor_merchant_id": "merchant_test_1782976430",
            "initiator": null,
            "sdk_authorization": "[REDACTED]",
            "connector": "cybersource",
            "state_metadata": null,
            "client_secret": "[REDACTED]",
            "created": "2026-07-02T08:24:50.205Z",
            "modified_at": "2026-07-02T08:24:53.118Z",
            "connector_customer_id": null,
            "currency": "USD",
            "customer_id": null,
            "customer": {
                "id": null,
                "name": null,
                "email": "guest@example.com",
                "phone": null,
                "phone_country_code": null,
                "customer_document_details": null
            },
            "description": "Wallet card_network test - Google Pay (real token)",
            "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": "wallet",
            "payment_method_data": {
                "wallet": {
                    "google_pay": {
                        "last4": "1111",
                        "card_network": "VISA",
                        "type": "CARD",
                        "card_exp_month": null,
                        "card_exp_year": null,
                        "auth_code": null,
                        "email": null
                    }
                },
                "billing": null
            },
            "payment_token": "[REDACTED]",
            "shipping": null,
            "billing": {
                "address": {
                    "city": "San Fransico",
                    "country": "US",
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": null,
                    "zip": "94122",
                    "state": "California",
                    "first_name": "joseph",
                    "last_name": "Doe",
                    "origin_zip": null
                },
                "phone": {
                    "number": "8056594427",
                    "country_code": "+91"
                },
                "email": null
            },
            "order_details": null,
            "email": null,
            "name": null,
            "phone": null,
            "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,
            "error_details": null,
            "payment_experience": null,
            "payment_method_type": "google_pay",
            "connector_label": null,
            "business_country": null,
            "business_label": "default",
            "business_sub_label": null,
            "allowed_payment_method_types": null,
            "manual_retry_allowed": null,
            "connector_transaction_id": "7829806917496724703812",
            "frm_message": null,
            "metadata": null,
            "connector_metadata": null,
            "connector_response_metadata": null,
            "feature_metadata": null,
            "reference_id": null,
            "payment_link": null,
            "profile_id": "pro_gtySM1HUCsyhg2fP9KBb",
            "surcharge_details": null,
            "attempt_count": 1,
            "merchant_decision": null,
            "merchant_connector_id": "mca_qft8oYSYXS8lAyIILiYm",
            "incremental_authorization_allowed": null,
            "authorization_count": null,
            "incremental_authorizations": null,
            "external_authentication_details": null,
            "external_3ds_authentication_attempted": null,
            "expires_on": null,
            "fingerprint": null,
            "browser_info": null,
            "payment_channel": null,
            "payment_method_id": null,
            "network_transaction_id": null,
            "network_transaction_link_id": null,
            "payment_method_status": null,
            "updated": "2026-07-02T08:24:53.118Z",
            "split_payments": null,
            "frm_metadata": null,
            "extended_authorization_applied": null,
            "extended_authorization_last_applied_at": null,
            "request_extended_authorization": "[REDACTED]",
            "capture_before": null,
            "merchant_order_reference_id": null,
            "order_tax_amount": null,
            "connector_mandate_id": null,
            "card_discovery": null,
            "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": "[REDACTED]",
            "enable_overcapture": null,
            "is_overcapture_enabled": null,
            "network_details": null,
            "is_stored_credential": null,
            "mit_category": null,
            "billing_descriptor": null,
            "tokenization": null,
            "partner_merchant_identifier_details": null,
            "payment_method_tokenization_details": null,
            "installment_options": null,
            "installment_data": null,
            "sender_payment_instrument_id": null
        },
        {
            "payment_id": "pay_NzMgQoCOHq8hAe4dmS8m",
            "merchant_id": "merchant_test_1782976430",
            "status": "requires_payment_method",
            "amount": 6540,
            "net_amount": 6540,
            "shipping_cost": null,
            "amount_capturable": 0,
            "amount_received": null,
            "processor_merchant_id": "merchant_test_1782976430",
            "initiator": null,
            "sdk_authorization": "[REDACTED]",
            "connector": null,
            "state_metadata": null,
            "client_secret": "[REDACTED]",
            "created": "2026-07-02T07:33:37.824Z",
            "modified_at": "2026-07-02T07:33:37.824Z",
            "connector_customer_id": null,
            "currency": "USD",
            "customer_id": null,
            "customer": {
                "id": null,
                "name": null,
                "email": "guest@example.com",
                "phone": null,
                "phone_country_code": null,
                "customer_document_details": null
            },
            "description": "Wallet card_network test - Google Pay (real token)",
            "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": "wallet",
            "payment_method_data": {
                "wallet": {
                    "google_pay": {
                        "last4": "1111",
                        "card_network": "VISA",
                        "type": "CARD",
                        "card_exp_month": null,
                        "card_exp_year": null,
                        "auth_code": null,
                        "email": null
                    }
                },
                "billing": null
            },
            "payment_token": "[REDACTED]",
            "shipping": null,
            "billing": {
                "address": {
                    "city": "San Fransico",
                    "country": "US",
                    "line1": "1467",
                    "line2": "Harrison Street",
                    "line3": null,
                    "zip": "94122",
                    "state": "California",
                    "first_name": "joseph",
                    "last_name": "Doe",
                    "origin_zip": null
                },
                "phone": {
                    "number": "8056594427",
                    "country_code": "+91"
                },
                "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": null,
            "error_message": null,
            "unified_code": null,
            "unified_message": null,
            "error_details": null,
            "payment_experience": null,
            "payment_method_type": "google_pay",
            "connector_label": null,
            "business_country": null,
            "business_label": "default",
            "business_sub_label": null,
            "allowed_payment_method_types": null,
            "manual_retry_allowed": null,
            "connector_transaction_id": null,
            "frm_message": null,
            "metadata": null,
            "connector_metadata": null,
            "connector_response_metadata": null,
            "feature_metadata": null,
            "reference_id": null,
            "payment_link": null,
            "profile_id": "pro_gtySM1HUCsyhg2fP9KBb",
            "surcharge_details": null,
            "attempt_count": 1,
            "merchant_decision": null,
            "merchant_connector_id": null,
            "incremental_authorization_allowed": null,
            "authorization_count": null,
            "incremental_authorizations": null,
            "external_authentication_details": null,
            "external_3ds_authentication_attempted": null,
            "expires_on": null,
            "fingerprint": null,
            "browser_info": null,
            "payment_channel": null,
            "payment_method_id": null,
            "network_transaction_id": null,
            "network_transaction_link_id": null,
            "payment_method_status": null,
            "updated": "2026-07-02T07:33:37.824Z",
            "split_payments": null,
            "frm_metadata": null,
            "extended_authorization_applied": null,
            "extended_authorization_last_applied_at": null,
            "request_extended_authorization": "[REDACTED]",
            "capture_before": null,
            "merchant_order_reference_id": null,
            "order_tax_amount": null,
            "connector_mandate_id": null,
            "card_discovery": null,
            "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": "[REDACTED]",
            "enable_overcapture": null,
            "is_overcapture_enabled": null,
            "network_details": null,
            "is_stored_credential": null,
            "mit_category": null,
            "billing_descriptor": null,
            "tokenization": null,
            "partner_merchant_identifier_details": null,
            "payment_method_tokenization_details": null,
            "installment_options": null,
            "installment_data": null,
            "sender_payment_instrument_id": null
        },
        {
            "payment_id": "pay_49R7SoQUubz6NUiVh3OL",
            "merchant_id": "merchant_test_1782976430",
            "status": "requires_payment_method",
            "amount": 6540,
            "net_amount": 6540,
            "shipping_cost": null,
            "amount_capturable": 0,
            "amount_received": null,
            "processor_merchant_id": "merchant_test_1782976430",
            "initiator": null,
            "sdk_authorization": "[REDACTED]",
            "connector": null,
            "state_metadata": null,
            "client_secret": "[REDACTED]",
            "created": "2026-07-02T07:17:10.233Z",
            "modified_at": "2026-07-02T07:17:10.258Z",
            "connector_customer_id": null,
            "currency": "USD",
            "customer_id": null,
            "customer": {
                "id": null,
                "name": null,
                "email": "guest@example.com",
                "phone": null,
                "phone_country_code": null,
                "customer_document_details": null
            },
            "description": "Wallet card_network test - Google Pay",
            "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": null,
            "payment_method_data": null,
            "payment_token": "[REDACTED]",
            "shipping": null,
            "billing": 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": null,
            "error_message": null,
            "unified_code": null,
            "unified_message": null,
            "error_details": null,
            "payment_experience": null,
            "payment_method_type": null,
            "connector_label": null,
            "business_country": null,
            "business_label": "default",
            "business_sub_label": null,
            "allowed_payment_method_types": null,
            "manual_retry_allowed": null,
            "connector_transaction_id": null,
            "frm_message": null,
            "metadata": null,
            "connector_metadata": null,
            "connector_response_metadata": null,
            "feature_metadata": null,
            "reference_id": null,
            "payment_link": null,
            "profile_id": "pro_gtySM1HUCsyhg2fP9KBb",
            "surcharge_details": null,
            "attempt_count": 1,
            "merchant_decision": null,
            "merchant_connector_id": null,
            "incremental_authorization_allowed": null,
            "authorization_count": null,
            "incremental_authorizations": null,
            "external_authentication_details": null,
            "external_3ds_authentication_attempted": null,
            "expires_on": null,
            "fingerprint": null,
            "browser_info": null,
            "payment_channel": null,
            "payment_method_id": null,
            "network_transaction_id": null,
            "network_transaction_link_id": null,
            "payment_method_status": null,
            "updated": "2026-07-02T07:17:10.258Z",
            "split_payments": null,
            "frm_metadata": null,
            "extended_authorization_applied": null,
            "extended_authorization_last_applied_at": null,
            "request_extended_authorization": "[REDACTED]",
            "capture_before": null,
            "merchant_order_reference_id": null,
            "order_tax_amount": null,
            "connector_mandate_id": null,
            "card_discovery": null,
            "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": "[REDACTED]",
            "enable_overcapture": null,
            "is_overcapture_enabled": null,
            "network_details": null,
            "is_stored_credential": null,
            "mit_category": null,
            "billing_descriptor": null,
            "tokenization": null,
            "partner_merchant_identifier_details": null,
            "payment_method_tokenization_details": null,
            "installment_options": null,
            "installment_data": null,
            "sender_payment_instrument_id": null
        }
    ]
}
3. Payments Retrieve

Request

curl --location 'http://localhost:8080/payments/pay_5Vv9UddeDEh28R4Pg2uG?force_sync=false' \
--header 'Accept: application/json' \
--header 'api-key: [REDACTED]

Response

{
    "payment_id": "pay_5Vv9UddeDEh28R4Pg2uG",
    "merchant_id": "merchant_test_1782976430",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "processor_merchant_id": "merchant_test_1782976430",
    "initiator": null,
    "sdk_authorization": "[REDACTED]",
    "connector": "cybersource",
    "state_metadata": null,
    "client_secret": "[REDACTED]",
    "created": "2026-07-02T08:25:37.279Z",
    "modified_at": "2026-07-02T08:25:38.766Z",
    "connector_customer_id": null,
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null,
        "customer_document_details": null
    },
    "description": "Wallet card_network test - Google Pay (real token)",
    "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": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "1111",
                "card_network": "VISA",
                "type": "CARD",
                "card_exp_month": null,
                "card_exp_year": null,
                "auth_code": null,
                "email": null
            }
        },
        "billing": null
    },
    "payment_token": "[REDACTED]",
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": null,
    "phone": null,
    "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,
    "error_details": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "7829807375216745603812",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "connector_response_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "pix_additional_details": null,
        "boleto_additional_details": null,
        "pix_automatico_additional_details": null,
        "finix_additional_details": null
    },
    "reference_id": "pay_5Vv9UddeDEh28R4Pg2uG_1",
    "payment_link": null,
    "profile_id": "pro_gtySM1HUCsyhg2fP9KBb",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_qft8oYSYXS8lAyIILiYm",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2026-07-02T08:40:37.279Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "016153570198200",
    "network_transaction_link_id": null,
    "payment_method_status": null,
    "updated": "2026-07-02T08:25:38.766Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": null,
    "request_extended_authorization": "[REDACTED]",
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null,
    "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": "[REDACTED]",
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": null,
    "installment_options": null,
    "installment_data": null,
    "sender_payment_instrument_id": 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

@ayush22667 ayush22667 requested a review from a team as a code owner July 2, 2026 08:38
@semanticdiff-com

semanticdiff-com Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments/transformers.rs  21% smaller

@ayush22667 ayush22667 self-assigned this Jul 2, 2026
@ayush22667 ayush22667 added the S-test-ready Status: This PR is ready for cypress-tests label Jul 2, 2026
);
None
}
_ => match data.parse_value::<api_models::payments::AdditionalPaymentData>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

instead of wild card, parse only in case of json

@XyneSpaces

Copy link
Copy Markdown

⚠️ Missing #[instrument] on modified flow

The ForeignFrom impl for PaymentsResponse in transformers.rs is invoked during list-payments response construction. Since this is an async-adjacent transformation that processes payment data, it should carry #[instrument(skip_all)] to maintain observability consistency with other payment flow conversions.

Add #[instrument(skip_all)] to the impl block to ensure this conversion is traceable in logs and metrics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-test-ready Status: This PR is ready for cypress-tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants