Skip to content

feat(connector): [NMI] Implement Apple Pay - hyperswitch decryption flow#10686

Merged
likhinbopanna merged 1 commit intomainfrom
nmi-applepay-hsdecrypt
Dec 17, 2025
Merged

feat(connector): [NMI] Implement Apple Pay - hyperswitch decryption flow#10686
likhinbopanna merged 1 commit intomainfrom
nmi-applepay-hsdecrypt

Conversation

@Vani-1107
Copy link
Contributor

@Vani-1107 Vani-1107 commented Dec 16, 2025

Type of Change

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

Description

[NMI] Implement Apple Pay - hyperswitch decryption flow

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?

Hyperswitch decryption flow:

Payment - one off

Request:


{
    "amount": 6500,
    "currency": "USD",
    "confirm": true,
    "return_url": "https://www.google.com",
    "setup_future_usage":"on_session",
    "capture_method": "automatic",
    "all_keys_required": true,
    "enable_partial_authorization": true,
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "shipping": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "customer": {
        "phone": "12345678911",
        "phone_country_code": "+91",
        "name": "test add",
        "id": "cus_1234"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": true,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 864,
        "screen_width": 1536,
        "time_zone": 300,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": "eyJkYXRhIjoiNHUr***",
                "payment_method": {
                    "display_name": "Visa 4228",
                    "network": "Visa",
                    "type": "debit"
                },
                "transaction_identifier": "a003eb***b9e6c1dc873504a"
            }
        }
    }
}

Response:


{
    "payment_id": "pay_mRnMRMzHiZamANSChVMp",
    "merchant_id": "merchant_1765888499",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "nmi",
    "client_secret": "pay_mRnMRMzHiZamANSChVMp_secret_U5fi0IXxXub4eC15dCvx",
    "created": "2025-12-16T12:40:29.138Z",
    "modified_at": "2025-12-16T12:40:36.372Z",
    "currency": "USD",
    "customer_id": "cus_1234",
    "customer": {
        "id": "cus_1234",
        "name": "test add",
        "email": "hello@gmail.com",
        "phone": "12345678911",
        "phone_country_code": "+91"
    },
    "description": "hellow world",
    "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": "4228",
                "card_network": "Visa",
                "type": "debit",
                "card_exp_month": "01",
                "card_exp_year": "2030"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": "test add",
    "phone": "12345678911",
    "return_url": "https://www.google.com/",
    "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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "11483015585",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_mRnMRMzHiZamANSChVMp_1",
    "payment_link": null,
    "profile_id": "pro_pvgBY5BYSh5L55VBn1Ft",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_M9hRDRUqfOt5yRHGawnQ",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-12-16T12:55:29.138Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 300,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 864,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-12-16T12:40:36.372Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": null,
    "request_extended_authorization": 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": "response=1&responsetext=SUCCESS&authcode=123456&transactionid=11483015585&avsresponse=&cvvresponse=&orderid=pay_mRnMRMzHiZamANSChVMp_1&type=sale&response_code=100",
    "enable_partial_authorization": true,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": null
}

Payments - CIT

Request:


{
    "amount": 6500,
    "currency": "USD",
    "confirm": true,
    "return_url": "https://www.google.com",
    "setup_future_usage":"off_session",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "2025-11-05T11:22:44-05:00",
        "online": {
            "ip_address": "192.168.0.1",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
        }
    },
    "capture_method": "automatic",
    "all_keys_required": true,
    "enable_partial_authorization": true,
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "shipping": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "customer": {
        "phone": "12345678911",
        "phone_country_code": "+91",
        "name": "test add",
        "id": "cus_1234"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": true,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 864,
        "screen_width": 1536,
        "time_zone": 300,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": "eyJkYXRhIjoiNH****YxIn0=",
                "payment_method": {
                    "display_name": "Visa 4228",
                    "network": "Visa",
                    "type": "debit"
                },
                "transaction_identifier": "a00**c1dc873504a"
            }
        }
    }
}

Response:


{
    "payment_id": "pay_ndTs13oA4xJXzU1U2oT6",
    "merchant_id": "merchant_1765890073",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "nmi",
    "client_secret": "pay_ndTs13oA4xJXzU1U2oT6_secret_OgzS5Iu9VR285NKNvaYk",
    "created": "2025-12-16T13:01:45.000Z",
    "modified_at": "2025-12-16T13:01:48.493Z",
    "currency": "USD",
    "customer_id": "cus_1234",
    "customer": {
        "id": "cus_1234",
        "name": "test add",
        "email": "hello@gmail.com",
        "phone": "12345678911",
        "phone_country_code": "+91"
    },
    "description": "hellow world",
    "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": "4228",
                "card_network": "Visa",
                "type": "debit",
                "card_exp_month": "01",
                "card_exp_year": "2030"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": "test add",
    "phone": "12345678911",
    "return_url": "https://www.google.com/",
    "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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "11483054707",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_ndTs13oA4xJXzU1U2oT6_1",
    "payment_link": null,
    "profile_id": "pro_mSXgosTHWiKpgikj8bgv",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_UK7wq3GuOZUkiftGrI0Z",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-12-16T13:16:45.000Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 300,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 864,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_1tcudaNiZNjjEKKOhcdf",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-12-16T13:01:48.493Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "520180793",
    "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": "response=1&responsetext=SUCCESS&authcode=123456&transactionid=11483054707&avsresponse=&cvvresponse=&orderid=pay_ndTs13oA4xJXzU1U2oT6_1&type=sale&response_code=100&customer_vault_id=520180793",
    "enable_partial_authorization": true,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": {
        "payment_method_id": "pm_1tcudaNiZNjjEKKOhcdf",
        "payment_method_status": "active",
        "psp_tokenization": false,
        "network_tokenization": false,
        "network_transaction_id": null,
        "is_eligible_for_mit_payment": false
    }
}

Payment - MIT

request:


{
    "amount": 100,
    "currency": "USD",
    "customer_id": "cus_1234",
    "confirm": true,
    "off_session": true,
    "email": "guest@example.com",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_1tcudaNiZNjjEKKOhcdf"
    }
}

Response:


{
    "payment_id": "pay_ZAvsu0L30HttXjMwS598",
    "merchant_id": "merchant_1765890073",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "nmi",
    "client_secret": "pay_ZAvsu0L30HttXjMwS598_secret_mbMlWbxLz2sE2XO5bd2D",
    "created": "2025-12-16T13:04:39.548Z",
    "modified_at": "2025-12-16T13:04:42.264Z",
    "currency": "USD",
    "customer_id": "cus_1234",
    "customer": {
        "id": "cus_1234",
        "name": "test add",
        "email": "guest@example.com",
        "phone": "12345678911",
        "phone_country_code": "+91"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "4228",
                "card_network": "Visa",
                "type": "debit",
                "card_exp_month": "01",
                "card_exp_year": "2030"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "guest@example.com",
    "name": "test add",
    "phone": "12345678911",
    "return_url": null,
    "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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "11483061336",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_ZAvsu0L30HttXjMwS598_1",
    "payment_link": null,
    "profile_id": "pro_mSXgosTHWiKpgikj8bgv",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_UK7wq3GuOZUkiftGrI0Z",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-12-16T13:19:39.548Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": "pm_1tcudaNiZNjjEKKOhcdf",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-12-16T13:04:42.264Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "520180793",
    "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,
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": true,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": {
        "payment_method_id": "pm_1tcudaNiZNjjEKKOhcdf",
        "payment_method_status": "active",
        "psp_tokenization": true,
        "network_tokenization": false,
        "network_transaction_id": null,
        "is_eligible_for_mit_payment": true
    }
}

Payment - setup mandate

Request:


{
    "amount": 0,
    "currency": "USD",
    "confirm": true,
    "return_url": "https://www.google.com",
    "payment_type": "setup_mandate",
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "2025-11-05T11:22:44-05:00",
        "online": {
            "ip_address": "192.168.0.1",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
        }
    },
    "capture_method": "automatic",
    "all_keys_required": true,
    "enable_partial_authorization": true,
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "shipping": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "customer": {
        "phone": "12345678911",
        "phone_country_code": "+91",
        "name": "test add",
        "id": "cus_12345"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": true,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 864,
        "screen_width": 1536,
        "time_zone": 300,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": "eyJkYXRhIjoi***8xIn0=",
                "payment_method": {
                    "display_name": "Visa 4228",
                    "network": "Visa",
                    "type": "debit"
                },
                "transaction_identifier": "a003eb53b3fd5f4429***bdbb9e6c1dc873504a"
            }
        }
    }
}

Response:


{
    "payment_id": "pay_1vIlbJ0bP963Q8m8sCyM",
    "merchant_id": "merchant_1765890073",
    "status": "succeeded",
    "amount": 0,
    "net_amount": 0,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "nmi",
    "client_secret": "pay_1vIlbJ0bP963Q8m8sCyM_secret_B5yLe1Ev2InPk2yz3fCy",
    "created": "2025-12-16T13:27:53.740Z",
    "modified_at": "2025-12-16T13:27:56.902Z",
    "currency": "USD",
    "customer_id": "cus_12345",
    "customer": {
        "id": "cus_12345",
        "name": "test add",
        "email": "hello@gmail.com",
        "phone": "12345678911",
        "phone_country_code": "+91"
    },
    "description": "hellow world",
    "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": "4228",
                "card_network": "Visa",
                "type": "debit",
                "card_exp_month": "01",
                "card_exp_year": "2030"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": "test add",
    "phone": "12345678911",
    "return_url": "https://www.google.com/",
    "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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "11483123501",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_1vIlbJ0bP963Q8m8sCyM_1",
    "payment_link": null,
    "profile_id": "pro_mSXgosTHWiKpgikj8bgv",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_UK7wq3GuOZUkiftGrI0Z",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-12-16T13:42:53.740Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 300,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 864,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_75jo3oU5KOL5lJvb3usu",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-12-16T13:27:56.902Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "885550337",
    "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,
    "enable_partial_authorization": true,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": {
        "payment_method_id": "pm_75jo3oU5KOL5lJvb3usu",
        "payment_method_status": "active",
        "psp_tokenization": false,
        "network_tokenization": false,
        "network_transaction_id": null,
        "is_eligible_for_mit_payment": false
    }
}

Payment MIT - Setup Mandate

Request:


{
    "amount": 100,
    "currency": "USD",
    "customer_id": "cus_12345",
    "confirm": true,
    "off_session": true,
    "email": "guest@example.com",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_75jo3oU5KOL5lJvb3usu"
    }
}

Response:


{
    "payment_id": "pay_ROGi8F32n9CUZnXXP8Fa",
    "merchant_id": "merchant_1765890073",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "nmi",
    "client_secret": "pay_ROGi8F32n9CUZnXXP8Fa_secret_O7Sa1suggxl4KuIp94jf",
    "created": "2025-12-16T13:30:58.319Z",
    "modified_at": "2025-12-16T13:31:03.253Z",
    "currency": "USD",
    "customer_id": "cus_12345",
    "customer": {
        "id": "cus_12345",
        "name": "test add",
        "email": "guest@example.com",
        "phone": "12345678911",
        "phone_country_code": "+91"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": true,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "4228",
                "card_network": "Visa",
                "type": "debit",
                "card_exp_month": "01",
                "card_exp_year": "2030"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "guest@example.com",
    "name": "test add",
    "phone": "12345678911",
    "return_url": null,
    "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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "11483131707",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_ROGi8F32n9CUZnXXP8Fa_1",
    "payment_link": null,
    "profile_id": "pro_mSXgosTHWiKpgikj8bgv",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_UK7wq3GuOZUkiftGrI0Z",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-12-16T13:45:58.319Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": "pm_75jo3oU5KOL5lJvb3usu",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-12-16T13:31:03.253Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": null,
    "request_extended_authorization": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "885550337",
    "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,
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": true,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": {
        "payment_method_id": "pm_75jo3oU5KOL5lJvb3usu",
        "payment_method_status": "active",
        "psp_tokenization": true,
        "network_tokenization": false,
        "network_transaction_id": null,
        "is_eligible_for_mit_payment": true
    }
}

Sanity test: Connector Decryption flow

Payments- one off

Request:


{
    "amount": 6500,
    "currency": "USD",
    "confirm": true,
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "all_keys_required": true,
    "enable_partial_authorization": true,
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "shipping": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "customer": {
        "phone": "12345678911",
        "phone_country_code": "+91",
        "name": "test add",
        "id": "cus_12e"
    },
    "browser_info": {
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "ip_address": "192.168.1.1",
        "java_enabled": true,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 864,
        "screen_width": 1536,
        "time_zone": 300,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    },
    "email": "hello@gmail.com",
    "payment_method": "wallet",
    "payment_method_type": "apple_pay",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "payment_data": "eyJkYX***3YxIn0=",
                "payment_method": {
                    "display_name": "Visa 0492",
                    "network": "Visa",
                    "type": "debit"
                },
                "transaction_identifier": "6167e1a1***c1ac503f2a9c"
            }
        }
    }
}

Response:


{
    "payment_id": "pay_uMuM6ovblwxsH6oqS4m4",
    "merchant_id": "merchant_1765894844",
    "status": "succeeded",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6500,
    "connector": "nmi",
    "client_secret": "pay_uMuM6ovblwxsH6oqS4m4_secret_Fi6DqnSdrvnxKYZknFgh",
    "created": "2025-12-16T14:21:08.580Z",
    "modified_at": "2025-12-16T14:21:10.920Z",
    "currency": "USD",
    "customer_id": "cus_12e",
    "customer": {
        "id": "cus_12e",
        "name": "test add",
        "email": "hello@gmail.com",
        "phone": "12345678911",
        "phone_country_code": "+91"
    },
    "description": "hellow world",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "apple_pay": {
                "last4": "0492",
                "card_network": "Visa",
                "type": "debit",
                "card_exp_month": null,
                "card_exp_year": null
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "Fasdf",
            "country": "US",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "line3": null,
            "zip": "560095",
            "state": null,
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "hello@gmail.com",
    "name": "test add",
    "phone": "12345678911",
    "return_url": "https://www.google.com/",
    "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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "11483290611",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_uMuM6ovblwxsH6oqS4m4_1",
    "payment_link": null,
    "profile_id": "pro_xjKT90lu2v1XdniAIDZ0",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_RQDiLSHdNeBMnMnpi3Id",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-12-16T14:36:08.580Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 300,
        "ip_address": "192.168.1.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 864,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-12-16T14:21:10.920Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "extended_authorization_last_applied_at": null,
    "request_extended_authorization": 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": "response=1&responsetext=SUCCESS&authcode=123456&transactionid=11483290611&avsresponse=&cvvresponse=&orderid=pay_uMuM6ovblwxsH6oqS4m4_1&type=sale&response_code=100",
    "enable_partial_authorization": true,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": null
}

Screenshot 2025-12-16 at 8 21 41 PM Screenshot 2025-12-16 at 8 26 51 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

@Vani-1107 Vani-1107 requested a review from a team as a code owner December 16, 2025 12:42
@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 16, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs  45% smaller

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 0% with 74 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@a407bda). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...itch_connectors/src/connectors/nmi/transformers.rs 0.00% 74 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10686   +/-   ##
=======================================
  Coverage        ?    6.42%           
=======================================
  Files           ?     1262           
  Lines           ?   315679           
  Branches        ?        0           
=======================================
  Hits            ?    20289           
  Misses          ?   295390           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Vani-1107 Vani-1107 force-pushed the nmi-applepay-hsdecrypt branch from 830c87f to 3c6976f Compare December 16, 2025 14:29
@Vani-1107 Vani-1107 self-assigned this Dec 16, 2025
@Vani-1107 Vani-1107 linked an issue Dec 16, 2025 that may be closed by this pull request
2 tasks
@Vani-1107 Vani-1107 added the A-payment-methods Area: Payment Methods label Dec 16, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 17, 2025
Merged via the queue into main with commit 6140e88 Dec 17, 2025
32 of 34 checks passed
@likhinbopanna likhinbopanna deleted the nmi-applepay-hsdecrypt branch December 17, 2025 14:10
pixincreate added a commit that referenced this pull request Dec 22, 2025
…rmers

* 'main' of github.com:juspay/hyperswitch: (67 commits)
  refactor: Introduce PreAuth for redsys HS<>UCS tunnel (#10727)
  chore(version): 2025.12.22.0
  feat(braintree): add UCS wallet support for PaypalSdk, ApplePayThirdPartySdk, and GooglePayThirdPartySdk (#10513)
  Fix: WorldpayVantiv Cypress fix (#10656)
  feat(connector): Add Apple Pay HS-Decryption support for Braintree (#10734)
  ci(cypress): add bank redirect flow onlinebankingfpx for fiuu (#10642)
  chore(version): 2025.12.19.0
  refactor(connector): [paysafe] introduce `PaymentMethodToken` flow (#10541)
  fix(connectors): add 3ds validations for connector for card specific only (#10560)
  fix(router): Prevent panic when masking non-ASCII strings (#10682)
  feat(authentication): add domain models for authentication and support kafka filters in dashboard (#10446)
  fix(docker): increase RUST_MIN_STACK size to handle stack overflow (#10730)
  fix(api): align ApiEvent status_code with HTTP response when proxy_connector_http_status_code enabled (#10680)
  feat(core): [Network Token] Passing Network Token in payments request (#9975)
  feat(core): Bumped UCS Client dependency to bring latest changes (#10641)
  ci(cypress): Update cypress shadow mode rollout configs (#10689)
  chore(version): 2025.12.18.0
  feat(payment-methods): Add support for guest checkout flow in payment method service (#10487)
  feat(connector): [NMI] Implement Apple Pay - hyperswitch decryption flow (#10686)
  fix(connector): [bluesnap] pass `connector_request_ref_id` instead of `payment_id` (#10653)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-payment-methods Area: Payment Methods

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] - [NMI] Implement Apple Pay - hyperswitch decryption flow

4 participants