Skip to content

feat(payments): propagate additional payment method data for apple pay during MIT#7170

Merged
likhinbopanna merged 7 commits intomainfrom
5868-apay-additional-data-during-mit
Jul 11, 2025
Merged

feat(payments): propagate additional payment method data for apple pay during MIT#7170
likhinbopanna merged 7 commits intomainfrom
5868-apay-additional-data-during-mit

Conversation

@kashif-m
Copy link
Contributor

@kashif-m kashif-m commented Feb 3, 2025

Type of Change

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

Description

Described in #5868 point # 3

This PR enables sending out payment_method_data for AP MIT

Additional Changes

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

Motivation and Context

Helps the requestor identify the cards used for ApplePay MIT

How did you test it?

1. Process an ApplePay CIT payment

cURL (using payment links)

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_1uTESxXpaQnwB8NTMzbiY0f09gtorvVq3FngeQkFN1UY0JtlEVGC0BCC5ZLLViuo' \
    --data '{"payment_id":"97a10a7f-7d78-42a2-838e-1f6051ae65f8","authentication_type":"three_ds","customer_id":"cus_gBWmUTIZ5DmABhSNAEjP","profile_id":"pro_qA3tbnls38Scviwwy7hz","customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"setup_future_usage":"off_session","amount":1,"currency":"EUR","confirm":false,"payment_link":true,"session_expiry":172800,"return_url":"https://www.example.com"}'

Response

{"payment_id":"f552b557-1883-46c1-8475-d721ae743fb2","merchant_id":"merchant_1752180309","status":"requires_payment_method","amount":1,"net_amount":1,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":null,"client_secret":"f552b557-1883-46c1-8475-d721ae743fb2_secret_pfJ4eI3tvPI2iOSmv5y9","created":"2025-07-10T21:18:53.061Z","currency":"EUR","customer_id":"cus_gBWmUTIZ5DmABhSNAEjP","customer":{"id":"cus_gBWmUTIZ5DmABhSNAEjP","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+65"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":null,"payment_method":null,"payment_method_data":null,"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":"https://www.example.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_gBWmUTIZ5DmABhSNAEjP","created_at":1752182333,"expires":1752185933,"secret":"epk_46fb291b8a9b4f15854dfa2cf7bb0d52"},"manual_retry_allowed":null,"connector_transaction_id":null,"frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":{"link":"https://onemore.tame-bird-39.telebit.io/payment_link/merchant_1752180309/f552b557-1883-46c1-8475-d721ae743fb2?locale=en","secure_link":null,"payment_link_id":"plink_IQGQunGBCDnr8pA6ksR3"},"profile_id":"pro_qA3tbnls38Scviwwy7hz","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":false,"expires_on":"2025-07-12T21:18:53.055Z","fingerprint":null,"browser_info":null,"payment_method_id":null,"payment_method_status":null,"updated":"2025-07-10T21:18:53.081Z","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}

Process AP payment

2. Retrieve payment

cURL

curl --location --request GET 'http://localhost:8080/payments/f552b557-1883-46c1-8475-d721ae743fb2?force_sync=true' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_1uTESxXpaQnwB8NTMzbiY0f09gtorvVq3FngeQkFN1UY0JtlEVGC0BCC5ZLLViuo'

Response

{"payment_id":"f552b557-1883-46c1-8475-d721ae743fb2","merchant_id":"merchant_1752180309","status":"succeeded","amount":1,"net_amount":1,"shipping_cost":null,"amount_capturable":0,"amount_received":1,"connector":"adyen","client_secret":"f552b557-1883-46c1-8475-d721ae743fb2_secret_pfJ4eI3tvPI2iOSmv5y9","created":"2025-07-10T21:18:53.061Z","currency":"EUR","customer_id":"cus_gBWmUTIZ5DmABhSNAEjP","customer":{"id":"cus_gBWmUTIZ5DmABhSNAEjP","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+65"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":null,"payment_method":"wallet","payment_method_data":{"wallet":{"apple_pay":{"last4":"0049","card_network":"MasterCard","type":"credit"}},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":"https://www.example.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"apple_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"K6SSTJD5QTTUXHN2","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":"f552b557-1883-46c1-8475-d721ae743fb2_1","payment_link":{"link":"https://onemore.tame-bird-39.telebit.io/payment_link/merchant_1752180309/f552b557-1883-46c1-8475-d721ae743fb2?locale=en","secure_link":null,"payment_link_id":"plink_IQGQunGBCDnr8pA6ksR3"},"profile_id":"pro_qA3tbnls38Scviwwy7hz","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_WPKmOYrtCqcPfL2xue29","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-12T21:18:53.055Z","fingerprint":null,"browser_info":{"os_type":"macOS","language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","os_version":"10.15.7","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15","color_depth":24,"device_model":"Macintosh","java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"accept_language":"en-US,en;q=0.9","java_script_enabled":true},"payment_method_id":"pm_wgu2MWu3eTrQ9XbRf2Wj","payment_method_status":"active","updated":"2025-07-10T21:20:28.794Z","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}

Note down payment_method_id

3. Create MIT payment

cURL

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_1uTESxXpaQnwB8NTMzbiY0f09gtorvVq3FngeQkFN1UY0JtlEVGC0BCC5ZLLViuo' \
    --data-raw '{"amount":6500,"currency":"EUR","confirm":true,"capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","customer_id":"cus_gBWmUTIZ5DmABhSNAEjP","email":"guest@example.com","name":"John Doe","phone":"999999999","profile_id":"pro_qA3tbnls38Scviwwy7hz","phone_country_code":"+65","description":"Its my first payment request","return_url":"https://hyperswitch.io","off_session":true,"recurring_details":{"type":"payment_method_id","data":"pm_wgu2MWu3eTrQ9XbRf2Wj"},"connector":["adyen"]}'

Response

{"payment_id":"pay_IiOzDjK3egmVbg3OKqn8","merchant_id":"merchant_1752180309","status":"succeeded","amount":6500,"net_amount":6500,"shipping_cost":null,"amount_capturable":0,"amount_received":6500,"connector":"adyen","client_secret":"pay_IiOzDjK3egmVbg3OKqn8_secret_Mi0BjvdeTQlu1etWD3FM","created":"2025-07-10T21:22:46.283Z","currency":"EUR","customer_id":"cus_gBWmUTIZ5DmABhSNAEjP","customer":{"id":"cus_gBWmUTIZ5DmABhSNAEjP","name":"John Doe","email":"guest@example.com","phone":"999999999","phone_country_code":"+65"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":"automatic","payment_method":"wallet","payment_method_data":{"wallet":{"apple_pay":{"last4":"0049","card_network":"MasterCard","type":"credit"}},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"guest@example.com","name":"John Doe","phone":"999999999","return_url":"https://hyperswitch.io/","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":"cus_gBWmUTIZ5DmABhSNAEjP","created_at":1752182566,"expires":1752186166,"secret":"epk_b479f7cb8f1e4ca7b568cbcc47196b95"},"manual_retry_allowed":false,"connector_transaction_id":"ZFQA3LJZICX1Q0R1","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":"pay_IiOzDjK3egmVbg3OKqn8_1","payment_link":null,"profile_id":"pro_qA3tbnls38Scviwwy7hz","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_WPKmOYrtCqcPfL2xue29","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-10T21:37:46.283Z","fingerprint":null,"browser_info":null,"payment_method_id":"pm_wgu2MWu3eTrQ9XbRf2Wj","payment_method_status":"active","updated":"2025-07-10T21:22:46.302Z","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":"RECURRING_1752182120551_HHLP38","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}

Things to verify

  • payment_method_data is present for both CIT and MIT

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

@kashif-m kashif-m self-assigned this Feb 3, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 3, 2025

@kashif-m kashif-m linked an issue Mar 4, 2025 that may be closed by this pull request
2 tasks
@kashif-m kashif-m marked this pull request as ready for review July 11, 2025 07:17
@kashif-m kashif-m requested review from a team as code owners July 11, 2025 07:17
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 11, 2025
Merged via the queue into main with commit 0f70fc5 Jul 11, 2025
22 of 30 checks passed
@likhinbopanna likhinbopanna deleted the 5868-apay-additional-data-during-mit branch July 11, 2025 15:18
pixincreate added a commit that referenced this pull request Jul 11, 2025
…ayload-webhooks

* 'main' of github.com:juspay/hyperswitch:
  feat(payments): propagate additional payment method data for apple pay during MIT (#7170)
  feat(core): Hyperswitch <|> UCS integration v2 (#8439)
  feat(connector): [payload] add webhook support (#8558)
  ci(cypress): Added Dlocal Connector Test (#8362)
  feat(connector): [AIRWALLEX] - Added Paypal, Trustly, Klarna , Atome, Blik Payment Methods (#8475)
  refactor(cypress): update skip logic and test flow for cypress incremental auth tests (#8594)
  chore(version): 2025.07.11.0
  chore: address Rust 1.88.0 clippy lints (#8607)
  chore(version): 2025.07.10.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Extend storage of additional payment method details to wallets

4 participants