feat(connector): [BRAINTREE] Googlepay, Applepay wallets added
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Googlepay, Applepay wallets added in BRAINTREE.
In the current implementation of the session-token response flow, only the core layer logic is triggered for apple_pay and google_pay. However, for Braintree, we require a client_token generated from the connector layer.
To support this, I’ve added three new methods in ConnectorSpecifications:
- is_sdk_session_token_generation_enabled()
- supported_payment_methods_for_sdk_session_token()
- validate_sdk_session_token_for_payment_method()
These methods determine whether a connector supports session-token response for a specific payment_method_type. Based on this, mapping is being done whether the session-token should be formed in the core layer or the connector layer.
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?
1. MCA
curl --location 'http://localhost:8080/account/merchant_1754943264/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x_merchant_domain: https://popular-grasshopper-95.telebit.io' \
--header 'api-key: dev_LyW7U8k5lBfnRiPjF75igyRatN0xh1g7cYbUW4pJiuZnmlaVOzeY0mw4bREoiQxh' \
--data '{
"connector_type": "payment_processor",
"connector_name": "braintree",
"connector_account_details": {
"auth_type": "SignatureKey",
"api_key": "API_KEY",
"api_secret": "API_SECRET",
"key1": "KEY1"
},
"test_mode": true,
"disabled": false,
"payment_methods_enabled": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"card_networks": [
"Visa",
"Mastercard"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true,
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"accepted_currencies": {
"type": "enable_only",
"list": [
"USD",
"GBP",
"INR"
]
}
},
{
"payment_method_type": "debit",
"card_networks": [
"Visa",
"Mastercard"
],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true,
"accepted_countries": {
"type": "disable_only",
"list": [
"HK"
]
},
"accepted_currencies": {
"type": "enable_only",
"list": [
"USD",
"GBP",
"INR"
]
}
}
]
},
{
"payment_method": "wallet",
"payment_method_types": [
{
"payment_method_type": "paypal",
"payment_experience": "invoke_sdk_client",
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "google_pay",
"payment_experience": "invoke_sdk_client",
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "apple_pay",
"payment_experience": "invoke_sdk_client",
"card_networks": null,
"accepted_currencies": null,
"accepted_countries": null,
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
}
]
}
],
"metadata": {
"merchant_account_id": "PAYPAL_MERCHANT_ACCOUNT_ID",
"merchant_config_currency": "USD",
"paypal_sdk": {
"client_id": "PAYPAL_CLIENT_ID"
},
"apple_pay_combined": {
"simplified": {
"session_token_data": {
"initiative_context": "web",
"merchant_business_country": "US"
},
"payment_request_data": {
"label": "applepay",
"supported_networks": [
"visa",
"masterCard",
"amex",
"discover"
],
"merchant_capabilities": [
"supports3DS"
]
}
}
}
},
"connector_webhook_details": {
"merchant_secret": "MyWebhookSecret"
},
"business_country": "US",
"business_label": "default"
}'
Response:
{"connector_type":"payment_processor","connector_name":"braintree","connector_label":"braintree_US_default","merchant_connector_id":"mca_HrBB5GxZaPbMIZm9sAkO","profile_id":"pro_UF7x1VUr8LV9gu1lQwn1","connector_account_details":{"auth_type":"SignatureKey","api_key":"5j************93","key1":"gs************sk","api_secret":"26****************************55"},"payment_methods_enabled":[{"payment_method":"card","payment_method_types":[{"payment_method_type":"credit","payment_experience":null,"card_networks":["Visa","Mastercard"],"accepted_currencies":{"type":"enable_only","list":["USD","GBP","INR"]},"accepted_countries":{"type":"disable_only","list":["HK"]},"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"debit","payment_experience":null,"card_networks":["Visa","Mastercard"],"accepted_currencies":{"type":"enable_only","list":["USD","GBP","INR"]},"accepted_countries":{"type":"disable_only","list":["HK"]},"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true}]},{"payment_method":"pay_later","payment_method_types":[{"payment_method_type":"klarna","payment_experience":"redirect_to_url","card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"affirm","payment_experience":"redirect_to_url","card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"afterpay_clearpay","payment_experience":"redirect_to_url","card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true}]},{"payment_method":"wallet","payment_method_types":[{"payment_method_type":"paypal","payment_experience":"invoke_sdk_client","card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"google_pay","payment_experience":"invoke_sdk_client","card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"apple_pay","payment_experience":"invoke_sdk_client","card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"mobile_pay","payment_experience":null,"card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"ali_pay","payment_experience":null,"card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"we_chat_pay","payment_experience":null,"card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true},{"payment_method_type":"mb_way","payment_experience":null,"card_networks":null,"accepted_currencies":null,"accepted_countries":null,"minimum_amount":1,"maximum_amount":68607706,"recurring_enabled":true,"installment_payment_enabled":true}]}],"connector_webhook_details":{"merchant_secret":"MyWebhookSecret","additional_secret":null},"metadata":{"paypal_sdk":{"client_id":"PAYPAL_CLIENT_ID"},"apple_pay_combined":{"simplified":{"session_token_data":{"initiative_context":"debuglab.basilisk-char.ts.net","merchant_business_country":"US"},"payment_request_data":{"label":"applepay","supported_networks":["visa","masterCard","amex","discover"],"merchant_capabilities":["supports3DS"]}}},"merchant_account_id":"MERCHANT_ACCOUNT_ID","merchant_config_currency":"USD"},"test_mode":true,"disabled":false,"frm_configs":null,"business_country":"US","business_label":"default","business_sub_label":null,"applepay_verified_domains":null,"pm_auth_config":null,"status":"active","additional_merchant_data":null,"connector_wallets_details":{"apple_pay_combined":{"simplified":{"payment_request_data":{"supported_networks":["visa","masterCard","amex","discover"],"merchant_capabilities":["supports3DS"],"label":"applepay"},"session_token_data":{"initiative_context":null,"merchant_business_country":"US"}}}}}
2. Session Token
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'x-merchant-domain: https://popular-grasshopper-95.telebit.io' \
--header 'api-key: pk_dev_d9bc174655254b479705763816e61259' \
--data '{
"payment_id": "pay_z7h5aBGzTHwYhw4Aw5WC",
"wallets": [],
"client_secret": "pay_z7h5aBGzTHwYhw4Aw5WC_secret_hIDNsxR1lOzC5AQydKKy"
}
'
Response:
{
"payment_id": "pay_z7h5aBGzTHwYhw4Aw5WC",
"client_secret": "pay_z7h5aBGzTHwYhw4Aw5WC_secret_hIDNsxR1lOzC5AQydKKy",
"session_token": [
{
"wallet_name": "google_pay",
"merchant_info": {
"merchant_name": "Braintree Merchant"
},
"shipping_address_required": false,
"email_required": false,
"shipping_address_parameters": {
"phone_number_required": false
},
"allowed_payment_methods": [],
"transaction_info": {
"country_code": "US",
"currency_code": "USD",
"total_price_status": "FINAL",
"total_price": "65.40"
},
"delayed_session_token": false,
"connector": "braintree",
"sdk_next_action": {
"next_action": "confirm"
},
"secrets": {
"display": "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiJleUowZVhBaU9pSktWMVFpTENKaGJHY2lPaUpGVXpJMU5pSXNJbXRwWkNJNklqSXdNVGd3TkRJMk1UWXRjMkZ1WkdKdmVDSXNJbWx6Y3lJNkltaDBkSEJ6T2k4dllYQnBMbk5oYm1SaWIzZ3VZbkpoYVc1MGNtVmxaMkYwWlhkaGVTNWpiMjBpZlEuZXlKbGVIQWlPakUzTlRVd016VTNNeklzSW1wMGFTSTZJbVZoWTJReE5tUTBMVFF6TURNdE5ERm1OaTFpWWpabExUY3dNbUpsWXpJNVptRTVNeUlzSW5OMVlpSTZJbWR6Wm5BMmJubG5lVE5rZW1JNGMyc2lMQ0pwYzNNaU9pSm9kSFJ3Y3pvdkwyRndhUzV6WVc1a1ltOTRMbUp5WVdsdWRISmxaV2RoZEdWM1lYa3VZMjl0SWl3aWJXVnlZMmhoYm5RaU9uc2ljSFZpYkdsalgybGtJam9pWjNObWNEWnVlV2Q1TTJSNllqaHpheUlzSW5abGNtbG1lVjlqWVhKa1gySjVYMlJsWm1GMWJIUWlPbVpoYkhObExDSjJaWEpwWm5sZmQyRnNiR1YwWDJKNVgyUmxabUYxYkhRaU9tWmhiSE5sZlN3aWNtbG5hSFJ6SWpwYkltMWhibUZuWlY5MllYVnNkQ0pkTENKelkyOXdaU0k2V3lKQ2NtRnBiblJ5WldVNlZtRjFiSFFpTENKQ2NtRnBiblJ5WldVNlFWaFBJbDBzSW05d2RHbHZibk1pT25zaWJ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UtYXBpLmNvbS9nc2ZwNm55Z3kzZHpiOHNrIn0sImFwcGxlUGF5Ijp7ImNvdW50cnlDb2RlIjoiVVMiLCJjdXJyZW5jeUNvZGUiOiJVU0QiLCJtZXJjaGFudElkZW50aWZpZXIiOiJtZXJjaGFudC5jb20uYWR5ZW4uc2FuIiwic3RhdHVzIjoibW9jayIsInN1cHBvcnRlZE5ldHdvcmtzIjpbInZpc2EiLCJtYXN0ZXJjYXJkIiwiYW1leCIsImRpc2NvdmVyIl19LCJwYXlwYWxFbmFibGVkIjp0cnVlLCJwYXlwYWwiOnsiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJlbnZpcm9ubWVudE5vTmV0d29yayI6ZmFsc2UsInVudmV0dGVkTWVyY2hhbnQiOmZhbHNlLCJhbGxvd0h0dHAiOnRydWUsImRpc3BsYXlOYW1lIjoiSnVzcGF5IiwiY2xpZW50SWQiOiJBU0tBR2gyV1hncWZRNVR6anBaekxzZmhWR2xGYmpxNVZyVjVJT1g4S1hERDJOX1hxa0dlWU5Ea1d5cl9VWG5maFhwRWtBQmRtUDI4NGJfMiIsImFjY291bnROdW1iZXIiOm51bGwsImJhc2VVcmwiOiJodHRwczovL2Fzc2V0cy5icmFpbnRyZWVnYXRld2F5LmNvbSIsImFzc2V0c1VybCI6Imh0dHBzOi8vY2hlY2tvdXQucGF5cGFsLmNvbSIsImRpcmVjdEJhc2VVcmwiOm51bGwsImVudmlyb25tZW50Ijoib2ZmbGluZSIsImJyYWludHJlZUNsaWVudElkIjoibWFzdGVyY2xpZW50MyIsIm1lcmNoYW50QWNjb3VudElkIjoiQW5hbmQiLCJjdXJyZW5jeUlzb0NvZGUiOiJVU0QifX0=",
"payment": null
}
},
"payment_request_data": {
"country_code": "US",
"currency_code": "USD",
"total": {
"label": "applepay",
"type": null,
"amount": "65.40"
},
"merchant_capabilities": [
"supports3DS"
],
"supported_networks": [
"visa",
"masterCard",
"amex",
"discover"
],
"merchant_identifier": null
},
"connector": "braintree",
"delayed_session_token": false,
"sdk_next_action": {
"next_action": "confirm"
},
"connector_reference_id": null,
"connector_sdk_public_key": null,
"connector_merchant_id": null
}
]
}
3. Google pay
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_LyW7U8k5lBfnRiPjF75igyRatN0xh1g7cYbUW4pJiuZnmlaVOzeY0mw4bREoiQxh' \
--data-raw '{
"amount": 100,
"currency": "USD",
"confirm": true,
"payment_link": false,
"capture_method": "sequential_automatic",
"capture_on": "2022-09-10T10:11:12Z",
"amount_to_capture": 100,
"customer_id": "StripeCustomer",
"email": "[email protected]",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"authentication_type": "three_ds",
"return_url": "https://google.com",
"payment_method": "wallet",
"payment_method_type": "google_pay",
"payment_method_data": {
"wallet": {
"google_pay_redirect": {
"token":"c801ae44-0860-1f44-4179-1d61904e0f8a"
}
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "CA",
"line3": "CA",
"city": "Musterhausen",
"state": "California",
"zip": "12345",
"country": "DE",
"first_name": "Max",
"last_name": "Mustermann"
},
"email": "[email protected]",
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"shipping": {
"address": {
"line1": "Musterstr",
"line2": "CA",
"line3": "CA",
"city": "Musterhausen",
"state": "California",
"zip": "94122",
"country": "DE",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "8056594427",
"country_code": "+91"
}
},
"browser_info": {
"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",
"accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,\/;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"ip_address": "103.77.139.95",
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true
},
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "value1",
"new_customer": "true",
"login_date": "2019-09-10T10:11:12Z"
}
}'
Response:
{"payment_id":"pay_bZ0aXWR7c4XyoZPgBp1o","merchant_id":"merchant_1754943264","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"braintree","client_secret":"pay_bZ0aXWR7c4XyoZPgBp1o_secret_70pJCGdL6IsG554zfj7V","created":"2025-08-12T07:35:15.497Z","currency":"USD","customer_id":"StripeCustomer","customer":{"id":"StripeCustomer","name":"John Doe","email":"[email protected]","phone":"999999999","phone_country_code":"+1"},"description":"Its my first payment request","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"}},"billing":null},"payment_token":null,"shipping":{"address":{"city":"Musterhausen","country":"DE","line1":"Musterstr","line2":"CA","line3":"CA","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":null},"billing":{"address":{"city":"Musterhausen","country":"DE","line1":"1467","line2":"CA","line3":"CA","zip":"12345","state":"California","first_name":"Max","last_name":"Mustermann","origin_zip":null},"phone":{"number":"8056594427","country_code":"+91"},"email":"[email protected]"},"order_details":null,"email":"[email protected]","name":"John Doe","phone":"999999999","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":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,"ephemeral_key":{"customer_id":"StripeCustomer","created_at":1754984115,"expires":1754987715,"secret":"epk_4fd82246514e4294b8e656686e8dd50c"},"manual_retry_allowed":false,"connector_transaction_id":"dHJhbnNhY3Rpb25fZnpzaGdncGY","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"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_UF7x1VUr8LV9gu1lQwn1","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_HrBB5GxZaPbMIZm9sAkO","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-08-12T07:50:15.497Z","fingerprint":null,"browser_info":{"language":"nl-NL","time_zone":0,"ip_address":"103.77.139.95","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-08-12T07:35:17.108Z","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":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":null}
4. Apple pay
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_LyW7U8k5lBfnRiPjF75igyRatN0xh1g7cYbUW4pJiuZnmlaVOzeY0mw4bREoiQxh' \
--data '
{
"amount": 100,
"currency": "USD",
"confirm": true,
"capture_method": "automatic",
"customer_id": "StripeCustomer",
"payment_method": "wallet",
"payment_method_type": "apple_pay",
"payment_method_data": {
"wallet": {
"apple_pay_redirect": {
"token":"4d156270-6a1c-1c56-7e06-6fe922e4de8b"
}
},
"billing": null
},
"billing": {
"address": {
"first_name": "John",
"last_name": "Doe",
"line1": "Harrison Street",
"city": "San Francisco",
"state": "California",
"zip": "94016",
"country": "US"
}
}
}'
Response:
{"payment_id":"pay_OQVfaSax3HlpcptsZU9P","merchant_id":"merchant_1752600273","status":"succeeded","amount":100,"net_amount":100,"shipping_cost":null,"amount_capturable":0,"amount_received":100,"connector":"braintree","client_secret":"pay_OQVfaSax3HlpcptsZU9P_secret_ZlepECcFLxoUnkI75eYU","created":"2025-07-15T17:24:42.658Z","currency":"USD","customer_id":"StripeCustomer","customer":{"id":"StripeCustomer","name":null,"email":null,"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":"automatic","payment_method":"wallet","payment_method_data":{"wallet":{"apple_pay":{"last4":"0121","card_network":"Visa","type":"debit"}},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Francisco","country":"US","line1":"Harrison Street","line2":null,"line3":null,"zip":"94016","state":"California","first_name":"John","last_name":"Doe"},"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":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"apple_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"StripeCustomer","created_at":1752600282,"expires":1752603882,"secret":"epk_6a07cf81f20d420ea7ac55e4a080c3e4"},"manual_retry_allowed":false,"connector_transaction_id":"dHJhbnNhY3Rpb25fMTI5NW16ZGU","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_8u6aGw4HuUDKamhgmjfZ","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_FVuIgKveXUPQx1YwVrzb","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-15T17:39:42.657Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-07-15T17:24:45.020Z","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":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}
Checklist
- [x] I formatted the code
cargo +nightly fmt --all - [x] I addressed lints thrown by
cargo clippy - [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
Changed Files
To get session-token, we shouldn't use PMD in payment-intent call. This is because now the we have different logic for session-token (segregating core and connector layer). And if we use PMD in payment-intent (for connectors to form session-token in connector layer), that pmt will be given priority (backward compatibility) and session-token won't be fetched. For eg. if we use card as pm and credit as pmt in payment-intent and try to form session-token for apple_pay at connector-layer, the routerData will have pmt as credit and will fail. Also, this is a standard way of flows that we don't pass PMD in intent call.
CC: @ShankarSinghC