Skip to content

feat(connector): [Peach Payments] add network token support for connector#9754

Merged
Gnanasundari24 merged 11 commits intomainfrom
add-nt-support-in-peach-pay-conn
Oct 13, 2025
Merged

feat(connector): [Peach Payments] add network token support for connector#9754
Gnanasundari24 merged 11 commits intomainfrom
add-nt-support-in-peach-pay-conn

Conversation

@prasunna09
Copy link
Contributor

@prasunna09 prasunna09 commented Oct 8, 2025

Type of Change

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

Description

add network token support for peach payments connector

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?

  • Create MCA for peach payments
  • Enable network tokenization for profile
curl --location 'http://localhost:8080/account/merchant_id/business_profile/prof_id' \
--header 'Content-Type: application/json' \
--header 'api-key: api key' \
--data '{
    "profile_name": "US_default",
"is_network_tokenization_enabled": true
}'

  • Create payment
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_CNdykrXQ50vzfqwZtbakrK0awo6TkkdQHDXv0QnpB8tA05z3sVIKLAEUGqIEXWE8' \
--data-raw '
{
    "amount": 200,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "<customer_id>",
    
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
          "card_number": "card_number",
          "card_exp_month": "12",
          "card_exp_year": "2026",
           "card_holder_name": "joseph Doe",
          "card_cvc": "123",
          "card_network": "VISA"
        }
    },
    "setup_future_usage": "on_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX",
            "last_name": "ss"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "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,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {},
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 0,
            "account_name": "transaction_processing"
        }
    ],
    "profile_id": "<profile_id>"
}'

  • Do repeat CIT [Saved Card flow]
    using saved card,
    payment method data sent to connector in logs should be network token data.
    ps. please search for raw_connector_request
    create payment-
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_CNdykrXQ50vzfqwZtbakrK0awo6TkkdQHDXv0QnpB8tA05z3sVIKLAEUGqIEXWE8' \
--data '{
    "amount": 200,
    "currency": "EUR",
    "capture_method": "manual",
    "authentication_type": "no_three_ds",
    "confirm": false,
    "setup_future_usage": "on_session",
    "customer_id": "cu_1760091918",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "profile_id": "pro_55Ey3rupyS9BnqWKLkG3"
}'

confirm -

curl --location 'http://localhost:8080/payments/<payment_id>/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api key' \
--data '
{
    "payment_token": "payment_token",
    "client_secret": "client_secret",
    "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,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "payment_method": "card",
    "payment_method_data":{
        "card_token":{
            "card_cvc": "737"
        }
    }

}'
Screenshot 2025-10-13 at 3 58 40 PM Screenshot 2025-10-13 at 4 42 39 PM Screenshot 2025-10-13 at 4 42 58 PM

three test cases are failing due to incorrect assertion. this is currently on main.
How to replicate this -
in create call, confirm is set to falsem capture method to automatic, and payment method data is not sent. in create response, requires_payment_method status is given.

now in confirm api, send payment method data.
expected - Throw error saying automatic capture is not supported
current output - Trying to make a call to connector.

Can be taken up in seperate pr.

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

@prasunna09 prasunna09 self-assigned this Oct 8, 2025
@prasunna09 prasunna09 requested a review from a team as a code owner October 8, 2025 13:07
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 8, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/peachpayments/transformers.rs  32% smaller
  config/config.example.toml Unsupported file format
  config/deployments/integration_test.toml Unsupported file format
  config/deployments/production.toml Unsupported file format
  config/deployments/sandbox.toml Unsupported file format
  config/development.toml Unsupported file format
  config/docker_compose.toml Unsupported file format
  crates/router/src/core/payment_methods/network_tokenization.rs  0% smaller

@prasunna09 prasunna09 requested a review from a team as a code owner October 9, 2025 09:35
@prasunna09 prasunna09 requested a review from a team as a code owner October 10, 2025 11:27
swangi-kumari
swangi-kumari previously approved these changes Oct 10, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Oct 13, 2025
Merged via the queue into main with commit c2da9db Oct 13, 2025
37 of 40 checks passed
@Gnanasundari24 Gnanasundari24 deleted the add-nt-support-in-peach-pay-conn branch October 13, 2025 12:38
prasunna09 added a commit that referenced this pull request Oct 13, 2025
…ctor (#9754)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
chaitak-gorai pushed a commit that referenced this pull request Oct 16, 2025
…ctor (#9754)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
drdholu pushed a commit to drdholu/hyperswitch that referenced this pull request Oct 30, 2025
…ctor (juspay#9754)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
aadityaguptaa pushed a commit that referenced this pull request Nov 10, 2025
…ctor (#9754)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
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.

4 participants