chore(connector): [paypal] store paypal email and payer_id in payment_method_data - #13902
Open
Nithin1506200 wants to merge 6 commits into
Open
chore(connector): [paypal] store paypal email and payer_id in payment_method_data#13902Nithin1506200 wants to merge 6 commits into
Nithin1506200 wants to merge 6 commits into
Conversation
…_method_data encrypted
Sakilmostak
previously approved these changes
Aug 28, 2026
deepanshu-iiitu
previously approved these changes
Aug 28, 2026
deepanshu-iiitu
left a comment
Contributor
There was a problem hiding this comment.
Connector changes look good
Nithin1506200
dismissed stale reviews from deepanshu-iiitu and Sakilmostak
via
August 28, 2026 11:01
fb431a7
hrithikesh026
approved these changes
Aug 28, 2026
deepanshu-iiitu
approved these changes
Aug 28, 2026
Nithin1506200
enabled auto-merge
August 28, 2026 11:19
Nithin1506200
disabled auto-merge
August 28, 2026 11:19
Sakilmostak
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
For PayPal wallet payments (
payment_method_type = paypal), the payer details (email,payer_id) returned by PayPal in thepayerobject of the authorize / capture / sync responses were being dropped. This PR stores them (encrypted) in the payment attempt's additional payment method data and surfaces them in the Payments response underpayment_method_data.wallet.paypal.Changes:
paypal/transformers.rs: Parseemail_addressin the PayPalPayerresponse struct. PopulateAdditionalPaymentMethodConnectorResponse::Paypal { email, payer_id }in the authorize, capture and payments-sync flows viaget_connector_response_with_payer_details, only whenpayment_method_typeisPaypal(PaypalRedirect / PaypalSdk wallet flows) — card payments processed via PayPal as a card processor are unaffected.hyperswitch_domain_models/router_data.rs: AddedAdditionalPaymentMethodConnectorResponse::Paypal { email, payer_id }variant.api_models: AddedPaypalWalletAdditionalData { email, payer_id }, apaypalfield inAdditionalPaymentData::Wallet, and aWalletResponseData::Paypalvariant so the details appear in the payments response.common_enums/payment_attempt:is_additional_payment_method_data_sensitivenow also considerspayment_method_type;wallet + paypaldata is treated as sensitive (it contains PII — email and a unique payer identifier) and is therefore stored inencrypted_payment_method_data.Additional Changes
Motivation and Context
The PayPal payer's email and payer_id are required by merchants for reconciliation, customer support and to link the payment with the payer's PayPal account. These were previously discarded after the connector call.
How did you test it?
Tested manually via API calls (local server with PayPal sandbox):
1. Create a PayPal wallet payment (
confirm = true)Request:
{ "customer_id": "{{customer_id}}", "currency": "USD", "amount": 13, "confirm": true, "payment_method": "wallet", "payment_method_type": "paypal", "capture_method": "automatic", "payment_method_data": { "wallet": { "paypal_redirect": { "email": null } }, "billing": { "phone": { "number": "9898989898", "country_code": "+44" } } }, "billing": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "PiX" } }, "shipping": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "US", "first_name": "PiX" } }, "return_url": "https://www.google.com", "customer_acceptance": { "acceptance_type": "online", "accepted_at": "1963-05-03T04:07:52.723Z", "online": { "ip_address": "in sit", "user_agent": "amet irure esse" } }, "email": "something@example.com" }Response — payment moves to
requires_customer_action, wallet details are not yet available:{ "payment_id": "pay_2PmYDAP6mGkY533NzJtt", "status": "requires_customer_action", "amount": 13, "connector": "paypal", "payment_method": "wallet", "payment_method_type": "paypal", "payment_method_data": { "wallet": {}, "billing": { "phone": { "number": "9898989898", "country_code": "+44" } } }, "connector_transaction_id": "4G055721XP1572322", "next_action": { "type": "redirect_to_url", "redirect_to_url": "http://localhost:8080/payments/redirect/pay_2PmYDAP6mGkY533NzJtt/merchant_1787645676/pay_2PmYDAP6mGkY533NzJtt_1" } }2. Complete the PayPal redirect (login + approve) and retrieve the payment
Response — payment
succeeded, andpayment_method_data.wallet.paypalnow contains the payer'semailandpayer_id(also stored assender_payment_instrument_id):{ "payment_id": "pay_2PmYDAP6mGkY533NzJtt", "status": "succeeded", "amount": 13, "amount_received": 13, "connector": "paypal", "payment_method": "wallet", "payment_method_type": "paypal", "payment_method_data": { "wallet": { "paypal": { "email": "bernard.eugine@juspay.in", "payer_id": "RRFL3BGBVCH94" } }, "billing": { "phone": { "number": "9898989898", "country_code": "+44" } } }, "connector_transaction_id": "4G055721XP1572322", "payment_method_id": "pm_ehNoDlUSQcjmMT5Ju6B5", "payment_method_status": "active", "sender_payment_instrument_id": "RRFL3BGBVCH94" }Checklist
cargo +nightly fmt --allcargo clippy