Skip to content

feat(connector): [BRAINTREE] Googlepay, Applepay wallets added#8728

Merged
Gnanasundari24 merged 14 commits intomainfrom
braintree-wallets
Oct 7, 2025
Merged

feat(connector): [BRAINTREE] Googlepay, Applepay wallets added#8728
Gnanasundari24 merged 14 commits intomainfrom
braintree-wallets

Conversation

@swetasharma03
Copy link
Contributor

@swetasharma03 swetasharma03 commented Jul 23, 2025

Type of Change

  • Bugfix
  • 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:

  1. is_sdk_session_token_generation_enabled()
  2. supported_payment_methods_for_sdk_session_token()
  3. 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?

Currently, testing can be done S2S only, because SDK and dashboard are yet to be done.

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"
        },
       "google_pay": {
            "allowed_payment_methods": [
                {
                    "type": "CARD",
                    "parameters": {
                        "allowed_auth_methods": [
                            "PAN_ONLY",
                            "CRYPTOGRAM_3DS"
                        ],
                        "allowed_card_networks": [
                            "AMEX",
                            "DISCOVER",
                            "INTERAC",
                            "JCB",
                            "MASTERCARD",
                            "VISA"
                        ]
                    },
                    "tokenization_specification": {
                        "type": "PAYMENT_GATEWAY",
                        "parameters": {
                            "gateway": "braintree"
                        }
                    }
                }
            ],
            "merchant_info": {
                "merchant_name": "Sweta Sharma"
            }
        },
       "apple_pay_combined": {
            "manual": {
                "payment_request_data": {
                    "label": "applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                },
                "session_token_data":null
            }
        }
    },
    "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"},{"google_pay":{"merchant_info":{"merchant_name":"Sweta Sharma"},"allowed_payment_methods":[{"type":"CARD","parameters":{"allowed_auth_methods":["PAN_ONLY","CRYPTOGRAM_3DS"]},"tokenization_specification":{"type":"PAYMENT_GATEWAY","parameters":{"gateway":"stripe"}}}]},"apple_pay_combined":{"manual":{"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"}}}}}

PMD shouldn't be passed in payment-intent to fetch session-token for braintree. Ref

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": "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiJleUowZVhBaU9pSktWMVFpTENKaGJHY2lPaUpGVXpJMU5pSXNJbXRwWkNJNklqSXdNVGd3TkRJMk1UWXRjMkZ1WkdKdmVDSXNJbWx6Y3lJNkltaDBkSEJ6T2k4dllYQnBMbk5oYm1SaWIzZ3VZbkpoYVc1MGNtVmxaMkYwWlhkaGVTNWpiMjBpZlEuZXlKbGVIQWlPakUzTlRVd016VTNNeklzSW1wMGFTSTZJbVZoWTJReE5tUTBMVFF6TURNdE5ERm1OaTFpWWpabExUY3dNbUpsWXpJNVptRTVNeUlzSW5OMVlpSTZJbWR6Wm5BMmJubG5lVE5rZW1JNGMyc2lMQ0pwYzNNaU9pSm9kSFJ3Y3pvdkwyRndhUzV6WVc1a1ltOTRMbUp5WVdsdWRISmxaV2RoZEdWM1lYa3VZMjl0SWl3aWJXVnlZMmhoYm5RaU9uc2ljSFZpYkdsalgybGtJam9pWjNObWNEWnVlV2Q1TTJSNllqaHpheUlzSW5abGNtbG1lVjlqWVhKa1gySjVYMlJsWm1GMWJIUWlPbVpoYkhObExDSjJaWEpwWm5sZmQyRnNiR1YwWDJKNVgyUmxabUYxYkhRaU9tWmhiSE5sZlN3aWNtbG5hSFJ6SWpwYkltMWhibUZuWlY5MllYVnNkQ0pkTENKelkyOXdaU0k2V3lKQ2NtRnBiblJ5WldVNlZtRjFiSFFpTENKQ2NtRnBiblJ5WldVNlFWaFBJbDBzSW05d2RHbHZibk1pT25zaWJXVnlZMmhoYm5SZllXTmpiM1Z1ZEY5cFpDSTZJa0Z1WVc1a0lpd2ljR0Y1Y0dGc1gyTnNhV1Z1ZEY5cFpDSTZJa0ZUUzBGSGFESlhXR2R4WmxFMVZIcHFjRnA2VEhObWFGWkhiRVppYW5FMVZuSldOVWxQV0RoTFdFUkVNazVmV0hGclIyVlpUa1JyVjNseVgxVll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n0sImFwcGxlUGF5Ijp7ImNvdW50cnlDb2RlIjoiVVMiLCJjdXJyZW5jeUNvZGUiOiJVU0QiLCJtZXJjaGFudElkZW50aWZpZXIiOiJtZXJjaGFudC5jb20uYWR5ZW4uc2FuIiwic3RhdHVzIjoibW9jayIsInN1cHBvcnRlZE5ldHdvcmtzIjpbInZpc2EiLCJtYXN0ZXJjYXJkIiwiYW1leCIsImRpc2NvdmVyIl19LCJwYXlwYWxFbmFibGVkIjp0cnVlLCJwYXlwYWwiOnsiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJlbnZpcm9ubWVudE5vTmV0d29yayI6ZmFsc2UsInVudmV0dGVkTWVyY2hhbnQiOmZhbHNlLCJhbGxvd0h0dHAiOnRydWUsImRpc3BsYXlOYW1lIjoiSnVzcGF5IiwiY2xpZW50SWQiOiJBU0tBR2gyV1hncWZRNVR6anBaekxzZmhWR2xGYmpxNVZyVjVJT1g4S1hERDJOX1hxa0dlWU5Ea1d5cl9VWG5maFhwRWtBQmRtUDI4NGJfMiIsImFjY291bnROdW1iZXIiOm51bGwsImJhc2VVcmwiOiJodHRwczovL2Fzc2V0cy5icmFpbnRyZWVnYXRld2F5LmNvbSIsImFzc2V0c1VybCI6Imh0dHBzOi8vY2hlY2tvdXQucGF5cGFsLmNvbSIsImRpcmVjdEJhc2VVcmwiOm51bGwsImVudmlyb25tZW50Ijoib2ZmbGluZSIsImJyYWludHJlZUNsaWVudElkIjoibWFzdGVyY2xpZW50MyIsIm1lcmNoYW50QWNjb3VudElkIjoiQW5hbmQiLCJjdXJyZW5jeUlzb0NvZGUiOiJVU0QifX0=",
                "payment": null
            }
        },
        {
            "wallet_name": "apple_pay",
            "session_token_data": {
                "secrets": {
                    "display": "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiJleUowZVhBaU9pSktWMVFpTENKaGJHY2lPaUpGVXpJMU5pSXNJbXRwWkNJNklqSXdNVGd3TkRJMk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cHBvcnRlZE5ldHdvcmtzIjpbInZpc2EiLCJtYXN0ZXJjYXJkIiwiYW1leCIsImRpc2NvdmVyIl19LCJwYXlwYWxFbmFibGVkIjp0cnVlLCJwYXlwYWwiOnsiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJlbnZpcm9ubWVudE5vTmV0d29yayI6ZmFsc2UsInVudmV0dGVkTWVyY2hhbnQiOmZhbHNlLCJhbGxvd0h0dHAiOnRydWUsImRpc3BsYXlOYW1lIjoiSnVzcGF5IiwiY2xpZW50SWQiOiJBU0tBR2gyV1hncWZRNVR6anBaekxzZmhWR2xGYmpxNVZyVjVJT1g4S1hERDJOX1hxa0dlWU5Ea1d5cl9VWG5maFhwRWtBQmRtUDI4NGJfMiIsImFjY291bnROdW1iZXIiOm51bGwsImJhc2VVcmwiOiJodHRwczovL2Fzc2V0cy5icmFpbnRyZWVnYXRld2F5LmNvbSIsImFzc2V0c1VybCI6Imh0dHBzOi8vY2hlY2tvdXQucGF5cGFsLmNvbSIsImRpcmVjdEJhc2VVcmwiOm51bGwsImVudmlyb25tZW50Ijoib2ZmbGluZSIsImJyYWludHJlZUNsaWVudElkIjoibWFzdGVyY2xpZW50MyIsIm1lcmNoYW50QWNjb3VudElkIjoiQW5hbmQiLCJjdXJyZW5jeUlzb0NvZGUiOiJVU0QifX0=",
                    "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": "guest@example.com",
    "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_third_party_sdk": {
                "token":"43d96d4d-934f-1e50-4ac0-74ea696a2696"
            }
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "12345",
            "country": "DE",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "email": "test@novalnet.de",
        "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":"guest@example.com","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":"test@novalnet.de"},"order_details":null,"email":"guest@example.com","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_third_party_sdk": {
                "token": "a84ed55a-fc0a-13d4-7fbf-5ab3dac058b5"
            }
        }
    "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}

Test apple_pay, google_pay for other prod connectors (trustpay, stripe, cybersource).

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

@swetasharma03 swetasharma03 self-assigned this Jul 23, 2025
@swetasharma03 swetasharma03 requested a review from a team as a code owner July 23, 2025 09:23
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jul 23, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/fraud_check/flows/fulfillment_flow.rs  83% smaller
  crates/hyperswitch_domain_models/src/payment_method_data.rs  78% smaller
  crates/api_models/src/payments.rs  59% smaller
  crates/router/src/core/payment_methods/cards.rs  59% smaller
  crates/router/src/core/payments/operations/payment_session.rs  30% smaller
  api-reference/v1/openapi_spec_v1.json  25% smaller
  api-reference/v2/openapi_spec_v2.json  25% smaller
  crates/router/src/core/payments/operations/payment_session_intent.rs  23% smaller
  crates/router/src/core/utils.rs  21% smaller
  crates/router/src/core/payments/transformers.rs  11% smaller
  crates/router/src/core/payments/helpers.rs  6% smaller
  crates/hyperswitch_connectors/src/connectors/braintree.rs  4% smaller
  crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs  2% smaller
  crates/connector_configs/toml/development.toml Unsupported file format
  crates/connector_configs/toml/production.toml Unsupported file format
  crates/connector_configs/toml/sandbox.toml Unsupported file format
  crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/utils.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_data.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_request_types.rs  0% smaller
  crates/hyperswitch_interfaces/src/api.rs  0% smaller
  crates/hyperswitch_interfaces/src/connector_integration_interface.rs Unsupported file format
  crates/hyperswitch_interfaces/src/conversion_impls.rs  0% smaller
  crates/router/src/core/authentication/transformers.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/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/utils.rs  0% smaller
  crates/router/src/core/payment_methods.rs  0% smaller
  crates/router/src/core/payments.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/cancel_post_capture_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/relay/utils.rs  0% smaller
  crates/router/src/core/unified_authentication_service/utils.rs Unsupported file format
  crates/router/src/core/webhooks/utils.rs  0% smaller
  crates/router/src/types.rs  0% smaller
  crates/router/src/types/api/verify_connector.rs  0% smaller
  crates/router/tests/connectors/utils.rs  0% smaller

@swetasharma03 swetasharma03 force-pushed the braintree-wallets branch 4 times, most recently from 0142ee7 to 8f49cb0 Compare July 23, 2025 09:32
@swetasharma03 swetasharma03 changed the title feat(connector): [AUTHORIZEDOTNET] Paypal, Googlepay, Applepay wallets added feat(connector): [BRAINTREE] Paypal, Googlepay, Applepay wallets added Jul 23, 2025
@swetasharma03 swetasharma03 force-pushed the braintree-wallets branch 2 times, most recently from cf97700 to a438026 Compare July 23, 2025 09:38
@swetasharma03 swetasharma03 requested review from a team as code owners July 28, 2025 16:05
@swetasharma03 swetasharma03 requested a review from a team as a code owner August 11, 2025 21:23
@swetasharma03 swetasharma03 force-pushed the braintree-wallets branch 10 times, most recently from 718b836 to 2428ff1 Compare August 12, 2025 13:02
@swetasharma03 swetasharma03 requested a review from a team as a code owner August 18, 2025 07:57
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Aug 18, 2025
@swetasharma03 swetasharma03 force-pushed the braintree-wallets branch 2 times, most recently from 12f526e to fcbeb6c Compare August 18, 2025 11:05
@swetasharma03 swetasharma03 force-pushed the braintree-wallets branch 3 times, most recently from 7b6c352 to a9b5735 Compare September 26, 2025 06:27
ShankarSinghC
ShankarSinghC previously approved these changes Sep 26, 2025
ShankarSinghC
ShankarSinghC previously approved these changes Sep 29, 2025
apoorvdixit88
apoorvdixit88 previously approved these changes Sep 29, 2025
Copy link
Contributor

@apoorvdixit88 apoorvdixit88 left a comment

Choose a reason for hiding this comment

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

Dashboard changes look fine.

jarnura
jarnura previously approved these changes Oct 1, 2025
@swetasharma03
Copy link
Contributor Author

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

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.

6 participants