Skip to content

refactor(connector): [Adyen] map ssn and session validity for Pix#8702

Merged
pranav-arjunan merged 4 commits intomainfrom
8637-feature-expiration-for-pix-payments
Jul 22, 2025
Merged

refactor(connector): [Adyen] map ssn and session validity for Pix#8702
pranav-arjunan merged 4 commits intomainfrom
8637-feature-expiration-for-pix-payments

Conversation

@kashif-m
Copy link
Contributor

@kashif-m kashif-m commented Jul 21, 2025

Type of Change

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

Description

Enhanced Pix payment support for Adyen connector with two changes:

  1. Expiry Date Support: Added expiry_date field to BankTransferData::Pix variant in API and domain models and mapped it to Adyen's sessionValidity
  2. CPF/CNPJ Mapping: Map CPF or CNPJ from Pix payment data to Adyen's socialSecurityNumber field

Additional Changes

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

Motivation and Context

Enables merchants to specify expiry dates for Pix QR codes and ensures proper customer identification through CPF/CNPJ mapping as per Adyen's Pix API requirements.

How did you test it?

1. Create a Pix payment using custom SSN and expiry date

cURL

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_uXENxlgLNNVyGVRpR0D4S1om0k65a6X3nyc5WfAXjwUlVWmBSl3ZPGJHhywazTN6' \
    --data-raw '{"amount":4500,"currency":"BRL","confirm":true,"profile_id":"pro_U1KoDSmwFwzKn649yraI","capture_on":"2022-09-10T10:11:12Z","connector":["adyen"],"customer_id":"cus_6vLys2IeaGT4xVbFj2U9","email":"abc@example.com","return_url":"https://google.com","payment_method":"bank_transfer","payment_method_type":"pix","payment_method_data":{"bank_transfer":{"pix":{"pix_key":"test","cpf":"test","cnpj":"test","expiry_date":"2025-07-23T10:11:12Z"}}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"California","zip":"94122","country":"BR","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"Force-PSP":"Adyen","udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"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"}},"session_expiry":60}'

Response

{"payment_id":"pay_iB7uN0kUtp51wVHpLhQF","merchant_id":"merchant_1753076715","status":"requires_customer_action","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":4500,"amount_received":null,"connector":"adyen","client_secret":"pay_iB7uN0kUtp51wVHpLhQF_secret_6kerLIBddt2ShUGKwXcP","created":"2025-07-21T08:12:53.420Z","currency":"BRL","customer_id":"cus_6vLys2IeaGT4xVbFj2U9","customer":{"id":"cus_6vLys2IeaGT4xVbFj2U9","name":"John Nether","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":null,"payment_method":"bank_transfer","payment_method_data":{"bank_transfer":{"pix":{"pix_key":"test","cpf":"test","cnpj":"test","source_bank_account_id":null,"destination_bank_account_id":null,"expiry_date":"2025-07-23T10:11:12.000Z"}},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"BR","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"John Nether","phone":"6168205362","return_url":"https://google.com/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":{"type":"qr_code_information","image_data_url":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQgAAAEICAAAAACGnTUjAAAGJElEQVR4Ae3gAZAkSZIkSRKLqpm7R0REZmZmVlVVVVV3d3d3d/fMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMdHd3d3dXV1VVVVVmZkZGRIS7m5kKz0xmV3d1d3dPz8zMzMxMYjVXAVSuAqByFQCVqwCoXAVA5SoAKlcBULkKgMpVAFSuAqByFQCVqwCoXAVA5SoAKlcBULkKgMpVAFSuAqByFQCVqwCoXAVA5SoAKlcBULkKgMpVAFSuAqByFQCVqwCoXAVA5SoAKlcBULkKgMq/QPzbmCvEFeY5iedkrhDPn7lC/NuYF4rKVQBUrgKgchUAlasAqFwFQOUqACpXAVB5EZkXjXhO5gpxhXnhzHMSz5950YgXCZWrAKhcBUDlKgAqVwFQuQqAylUAVK4CoPKvJJ4/88KZK8QV5grx/IkrzAsnnj/zr0LlKgAqVwFQuQqAylUAVK4CoHIVAJWrAKj8JxPPn7jCvHDiCvOfispVAFSuAqByFQCVqwCoXAVA5SoAKlcBUPkvZq4Qz5/4b0HlKgAqVwFQuQqAylUAVK4CoHIVAJWrAKj8K5l/H/GcxBXmCvOcxAtn/kNQuQqAylUAVK4CoHIVAJWrAKhcBUDlKgAqLyLx72OuEFeYK8RzEleYF078h6JyFQCVqwCoXAVA5SoAKlcBULkKgMpVAFT+Bea/hrjCvHDmPwWVqwCoXAVA5SoAKlcBULkKgMpVAFSuAqDyLxBXmOdPXGGuEM+fuMK8aMQV5grxojHPSVxhXigqVwFQuQqAylUAVK4CoHIVAJWrAKhcBYDMv494TuYK8fyZK8S/jnn+xBXmOYkrzIuEylUA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5SoAKlcBULkKgMpVAFSuAqByFQCVqwCoXAVA5SoAKlcBULkKgMpVAFSuAqByFQCVqwCoXAVA5SoAKlcBULkKgMpVAFSuAuAfAfHRhAhvVmeEAAAAAElFTkSuQmCC","display_to_timestamp":1753265472000,"qr_code_url":"https://test.adyen.com/hpp/generateQRCodeImage.shtml?url=TestQRCodeEMVToken","display_text":null,"border_color":null},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"pix","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_6vLys2IeaGT4xVbFj2U9","created_at":1753085573,"expires":1753089173,"secret":"epk_e1db82c9ea524cfba83011c631f34bf9"},"manual_retry_allowed":null,"connector_transaction_id":"DVB7NMC4DVHVLD75","frm_message":null,"metadata":{"udf1":"value1","Force-PSP":"Adyen","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"DVB7NMC4DVHVLD75","payment_link":null,"profile_id":"pro_U1KoDSmwFwzKn649yraI","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_lBjLVbnnprul6b7CLyQE","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-21T08:13:53.420Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"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,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-07-21T08:12:53.932Z","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}

Things to verify

  1. Expiry time in response (display_to_timestamp) - should be same as the one sent in request
  2. Social security number must be sent to Adyen
Screenshot 2025-07-21 at 1 53 44 PM
2. Create a Pix payment using a expiry date > 5 days in future from now

cURL

curl --location --request POST 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_uXENxlgLNNVyGVRpR0D4S1om0k65a6X3nyc5WfAXjwUlVWmBSl3ZPGJHhywazTN6' \
    --data-raw '{"amount":4500,"currency":"BRL","confirm":true,"profile_id":"pro_U1KoDSmwFwzKn649yraI","capture_on":"2022-09-10T10:11:12Z","connector":["adyen"],"customer_id":"cus_6vLys2IeaGT4xVbFj2U9","email":"abc@example.com","return_url":"https://google.com","payment_method":"bank_transfer","payment_method_type":"pix","payment_method_data":{"bank_transfer":{"pix":{"pix_key":"test","cpf":"test","cnpj":"test","expiry_date":"2025-08-23T10:11:12Z"}}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"California","zip":"94122","country":"BR","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"Force-PSP":"Adyen","udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"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"}},"session_expiry":60}'

Response

{
    "error": {
        "type": "invalid_request",
        "message": "Invalid value provided: expiry_date cannot be more than 5 days from now",
        "code": "IR_07"
    }
}

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 added 2 commits July 21, 2025 11:50
refactor(connector): [Adyen] map cpf or cnpj to socialSecurityNumber for payments
refactor(connector): [Adyen] send expiry date in payments request
@kashif-m kashif-m self-assigned this Jul 21, 2025
@kashif-m kashif-m requested review from a team as code owners July 21, 2025 07:08
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jul 21, 2025

@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Jul 21, 2025
@kashif-m kashif-m linked an issue Jul 21, 2025 that may be closed by this pull request
2 tasks
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 21, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 21, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 22, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jul 22, 2025
)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 22, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 22, 2025
@pranav-arjunan pranav-arjunan merged commit 9bf1e95 into main Jul 22, 2025
25 of 34 checks passed
@pranav-arjunan pranav-arjunan deleted the 8637-feature-expiration-for-pix-payments branch July 22, 2025 10:15
pixincreate added a commit that referenced this pull request Jul 22, 2025
…ordea-sepa

* 'main' of github.com:juspay/hyperswitch:
  refactor(connector): [Adyen] map ssn and session validity for Pix (#8702)
  feat(core): Implement UCS kill switch for emergency fallback (#8651)
  fix(openapi): Added Error Response Schema for Status Code 400 (#8684)
  feat(connector): Add template code for breadpay (#8655)
  chore(version): 2025.07.21.1
  refactor(payments): fetch payment method information in attempts list api v2 and add custom billing connector template (#8681)
  fix(router): Make v2 endpoints follow standard naming conventions (#8630)
  fix(connector): [Cybersource] Add type_selection_indicator as 1 for all cards  (#8663)
  feat(routing): Add API key auth for decision engine endpoints (#8640)
  feat(authentication): Added eligibility flow for modular authentication (#8431)
  feat(connector): [BLACKHAWKNETWORK] Add Template Code  (#8632)
  fix: remove straight through routing from routing approach (#8695)
  fix(connector): [Access Worldpay] correct enum deserialization for payment responses for (#8689)
  chore(version): 2025.07.21.0
pixincreate added a commit that referenced this pull request Jul 22, 2025
…ayload-recurring

* 'main' of github.com:juspay/hyperswitch: (48 commits)
  fix(connector): Add Trustpay in Authentication Providers Config (#8622)
  refactor(connector): [Adyen] map ssn and session validity for Pix (#8702)
  feat(core): Implement UCS kill switch for emergency fallback (#8651)
  fix(openapi): Added Error Response Schema for Status Code 400 (#8684)
  feat(connector): Add template code for breadpay (#8655)
  chore(version): 2025.07.21.1
  refactor(payments): fetch payment method information in attempts list api v2 and add custom billing connector template (#8681)
  fix(router): Make v2 endpoints follow standard naming conventions (#8630)
  fix(connector): [Cybersource] Add type_selection_indicator as 1 for all cards  (#8663)
  feat(routing): Add API key auth for decision engine endpoints (#8640)
  feat(authentication): Added eligibility flow for modular authentication (#8431)
  feat(connector): [BLACKHAWKNETWORK] Add Template Code  (#8632)
  fix: remove straight through routing from routing approach (#8695)
  fix(connector): [Access Worldpay] correct enum deserialization for payment responses for (#8689)
  chore(version): 2025.07.21.0
  feat(debit_routing): add debit routing support for apple pay (#8673)
  refactor(router): decrypt the wallet token before the debit routing call (#8598)
  chore: update org retrieve api response to include org type (#8660)
  feat(routing): Add routing evaluation rule endpoint and related flow (#8656)
  fix(connector): [AUTHORIZEDOTNET] Added Invoice Number Fix (#8685)
  ...
pixincreate added a commit that referenced this pull request Jul 22, 2025
…acilitapay-mca-metadata

* 'main' of github.com:juspay/hyperswitch:
  fix(connector): Add Trustpay in Authentication Providers Config (#8622)
  refactor(connector): [Adyen] map ssn and session validity for Pix (#8702)
  feat(core): Implement UCS kill switch for emergency fallback (#8651)
  fix(openapi): Added Error Response Schema for Status Code 400 (#8684)
  feat(connector): Add template code for breadpay (#8655)
  chore(version): 2025.07.21.1
  refactor(payments): fetch payment method information in attempts list api v2 and add custom billing connector template (#8681)
  fix(router): Make v2 endpoints follow standard naming conventions (#8630)
  fix(connector): [Cybersource] Add type_selection_indicator as 1 for all cards  (#8663)
  feat(routing): Add API key auth for decision engine endpoints (#8640)
  feat(authentication): Added eligibility flow for modular authentication (#8431)
  feat(connector): [BLACKHAWKNETWORK] Add Template Code  (#8632)
  fix: remove straight through routing from routing approach (#8695)
  fix(connector): [Access Worldpay] correct enum deserialization for payment responses for (#8689)
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.

[FEATURE] expiration for Pix payments

4 participants