Skip to content

feat(connector): [FISERV] Added ApplePay Wallet#8670

Merged
likhinbopanna merged 16 commits intomainfrom
fiserv/apple_pay
Aug 12, 2025
Merged

feat(connector): [FISERV] Added ApplePay Wallet#8670
likhinbopanna merged 16 commits intomainfrom
fiserv/apple_pay

Conversation

@bsayak03
Copy link
Contributor

@bsayak03 bsayak03 commented Jul 17, 2025

Type of Change

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

Description

This PR is about adding ApplePay Payment Method in Hyperswitch. This has both the Hyperswitch level Decryption Flow as well as the Connector Level Decryption Flow.

NOTE: The connector returns an error as missing fields probably because this particular payment method is not enabled from the connector's end.

Additional Changes

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

Motivation and Context

https://developer.fiserv.com/product/CommerceHub/docs/?path=docs/Online-Mobile-Digital/Wallets-AltPayments/Apple-Pay/Apple-Pay-Web-REST.md&branch=main
https://developer.fiserv.com/product/CommerceHub/docs/?path=docs/Resources/Guides/Payment-Sources/Decrypted-Wallet.md&branch=main

How did you test it?

ApplePay (Hyperswitch level Decryption Flow)

MCA Create :

cURL:

curl --location 'http://localhost:8080/account/merchant_1752758081/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_g89XN9cueAh4pSQUzkDPoHMZdBqx71OHkC7RWEN5tRuyHfuukKf3EvJlVbHDZTHU' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "fiserv",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "API_KEY",
        "key1": "MERCHANT_ID",
        "api_secret": "API_SECRET"
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    
                    
                    
                    
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                },
                {
                    "payment_method_type": "debit",
                    
                    
                    
                    
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                }
            ]
        },
        {
            "payment_method": "bank_transfer",
            "payment_method_types": [
                {
                    "payment_method_type": "pix",
                    "payment_experience": "redirect_to_url",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        },
        {
            "payment_method": "wallet",
            "payment_method_types": [
                {
                    "payment_method_type": "google_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "paypal",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                },
                {
                    "payment_method_type": "apple_pay",
                    "payment_experience": "invoke_sdk_client",
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 0,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": false
                }
            ]
        },
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "klarna",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "affirm",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_type": "afterpay_clearpay",
                    "payment_experience": "redirect_to_url",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "metadata": {
        "terminal_id": "10000001",
        "apple_pay_combined": {
            "manual": {
                "session_token_data": {
                    "initiative": "web",
                    "certificate": "",
                    "display_name": "Applepay",
                    "certificate_keys": "",
                    "initiative_context": "hyperswitch-demo-store.netlify.app",
                    "merchant_identifier": "merchant.com.stripe.sang",
                    "merchant_business_country": "US",
                    "payment_processing_details_at": "Hyperswitch",
                    "payment_processing_certificate": "",
                    "payment_processing_certificate_key": ""
                },
                "payment_request_data": {
                    "label": "Applepay",
                    "supported_networks": [
                        "visa",
                        "masterCard",
                        "amex",
                        "discover"
                    ],
                    "merchant_capabilities": [
                        "supports3DS"
                    ]
                }
            }
        }
    },
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "business_country": "US",
    "business_label": "default"
}'

Payments Create:

cURL:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_g89XN9cueAh4pSQUzkDPoHMZdBqx71OHkC7RWEN5tRuyHfuukKf3EvJlVbHDZTHU' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data-raw '{
    "amount": 650,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 650,
    "customer_id": "cu_1752502119",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "setup_future_usage": "off_session",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "billing": {
        "address": {
            "line1": "1467",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": "",
                "payment_method": {
                    "display_name": "Discover 2780",
                    "network": "Discover",
                    "type": "credit"
                },
                "transaction_identifier": ""
            }
        }
    }
}'

How to get this Payment data token?
use the same certificates for any other connector. Make the payment go through. From the confirm call, you can get the payment data.

Response:

{
    "payment_id": "pay_9j9yB94x2K0qYJQphQar",
    "merchant_id": "merchant_1752758081",
    "status": "failed",
    "amount": 650,
    "net_amount": 650,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "fiserv",
    "client_secret": "pay_9j9yB94x2K0qYJQphQar_secret_xLJgzYugilFS94JUW06S",
    "created": "2025-07-17T13:23:31.584Z",
    "currency": "USD",
    "customer_id": "cu_1752502119",
    "customer": {
        "id": "cu_1752502119",
        "name": "Joseph Doe",
        "email": "something@gmail.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": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "2780",
                "card_network": "Discover",
                "type": "credit"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": null,
            "line3": null,
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": "100",
    "error_message": "Invalid or Missing Field Data",
    "unified_code": "UE_9000",
    "unified_message": "Something went wrong",
    "payment_experience": null,
    "payment_method_type": "apple_pay",
    "connector_label": "fiserv_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1752502119",
        "created_at": 1752758611,
        "expires": 1752762211,
        "secret": "epk_ec67acda9d1040a9b2bc485aaa98d038"
    },
    "manual_retry_allowed": true,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_W6n4bH9SswzOUuIdN6Lz",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_KflfYITEK5eom2aVRhPy",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-07-17T13:38:31.584Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-07-17T13:23:35.717Z",
    "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
}

Cypress test

Fiserv Screenshot 2025-08-04 at 4 05 05 PM

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

@bsayak03 bsayak03 requested a review from a team as a code owner July 17, 2025 04:55
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jul 17, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs  4% 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/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/fiserv.rs  0% smaller

@bsayak03 bsayak03 self-assigned this Jul 17, 2025
@bsayak03 bsayak03 changed the title feat(connector): [FISERV] Added ApplePay Payment Method for Connector & Hyperswitch Decryption feat(connector): [FISERV] Added ApplePay Payment Method Aug 4, 2025
@bsayak03 bsayak03 changed the title feat(connector): [FISERV] Added ApplePay Payment Method feat(connector): [FISERV] Added ApplePay Wallet Aug 4, 2025
@bsayak03 bsayak03 requested a review from a team as a code owner August 4, 2025 11:35
deepanshu-iiitu
deepanshu-iiitu previously approved these changes Aug 4, 2025
jagan-jaya
jagan-jaya previously approved these changes Aug 5, 2025
Base automatically changed from fiserv/paypal to main August 8, 2025 09:29
@Gnanasundari24 Gnanasundari24 dismissed stale reviews from jagan-jaya and deepanshu-iiitu August 8, 2025 09:29

The base branch was changed.

@likhinbopanna likhinbopanna added this pull request to the merge queue Aug 12, 2025
Merged via the queue into main with commit 8bb8b20 Aug 12, 2025
21 of 26 checks passed
@likhinbopanna likhinbopanna deleted the fiserv/apple_pay branch August 12, 2025 07:25
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