Skip to content

feat(connector): [Nuvei] Implement setup mandate flow for cards#9012

Merged
likhinbopanna merged 8 commits intomainfrom
mandate-flow-nuvei
Aug 26, 2025
Merged

feat(connector): [Nuvei] Implement setup mandate flow for cards#9012
likhinbopanna merged 8 commits intomainfrom
mandate-flow-nuvei

Conversation

@Vani-1107
Copy link
Contributor

@Vani-1107 Vani-1107 commented Aug 21, 2025

Type of Change

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

Description

Add setup mandate flow for cards

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://github.com/juspay/hyperswitch-cloud/issues/10774

How did you test it?

Setup mandate flow :

Request

{
    "amount": 0,
    "currency": "EUR",
    "confirm": true,
    "customer_id":"nithxxinn",
    "return_url": "https://www.google.com",
    "capture_method": "automatic",
    "payment_type" : "setup_mandate",
    "setup_future_usage": "off_session",
    "authentication_type": "no_three_ds",
    "description": "hellow world",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "zip": "560095",
            "country": "US",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "line1": "Fasdf",
            "line2": "Fasdf",
            "city": "Fasdf"
        }
    },
    "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": false,
        "java_script_enabled": true,
        "language": "en-US",
        "color_depth": 24,
        "screen_height": 1080,
        "screen_width": 1920,
        "time_zone": 330,
        "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": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "2221008123677736",
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "card_cvc": "217"
        }
    }
}

Response

{
    "payment_id": "pay_pIlTtdr1FzpccQG2efu1",
    "merchant_id": "merchant_1755776197",
    "status": "succeeded",
    "amount": 0,
    "net_amount": 0,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "nuvei",
    "client_secret": "pay_pIlTtdr1FzpccQG2efu1_secret_81FAsrNQcaGOZA9kn4wg",
    "created": "2025-08-21T12:22:44.656Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "payment_checks": {
                "avs_description": null,
                "avs_result_code": "",
                "cvv_2_reply_code": "",
                "cvv_2_description": null,
                "merchant_advice_code": "",
                "merchant_advice_code_description": null
            },
            "authentication_data": {}
        },
        "billing": null
    },
    "payment_token": "token_HvFMUgI2CKK3b4yjzVAl",
    "shipping": 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": null,
    "phone": null,
    "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": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1755778964,
        "expires": 1755782564,
        "secret": "epk_959b0c962665436da106a97edbd70ae3"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016661021",
    "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": "8110755112",
    "payment_link": null,
    "profile_id": "pro_zCDeu3sBLjaoR0j1q2f0",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_DKTxGltWZglmtIc8ESRB",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-21T12:37:44.656Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "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": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_1e16m2dO2LGRw0xHN4Ns",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-21T12:22:47.199Z",
    "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": "2088668112",
    "card_discovery": "manual",
    "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
}

Recurring call :

Request

{
    "amount": 100,
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_1e16m2dO2LGRw0xHN4Ns" 
    }
}

Request

{
    "payment_id": "pay_0yEgYyrcrlNbjuSUTlRf",
    "merchant_id": "merchant_1755776197",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "nuvei",
    "client_secret": "pay_0yEgYyrcrlNbjuSUTlRf_secret_9c0ZpjkCY5jh9HLeyw22",
    "created": "2025-08-21T12:23:44.859Z",
    "currency": "EUR",
    "customer_id": "nithxxinn",
    "customer": {
        "id": "nithxxinn",
        "name": null,
        "email": "hello@gmail.com",
        "phone": null,
        "phone_country_code": null
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "7736",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "222100",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "CL-BRW2",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "hello@gmail.com",
    "name": null,
    "phone": null,
    "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": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "nithxxinn",
        "created_at": 1755779024,
        "expires": 1755782624,
        "secret": "epk_88ca1d7865784274bad1200e6cfc4d64"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7110000000016661082",
    "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": "8110775112",
    "payment_link": null,
    "profile_id": "pro_zCDeu3sBLjaoR0j1q2f0",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_DKTxGltWZglmtIc8ESRB",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-21T12:38:44.858Z",
    "fingerprint": null,
    "browser_info": {
        "language": "en-US",
        "time_zone": 330,
        "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": false,
        "screen_width": 1920,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "screen_height": 1080,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_1e16m2dO2LGRw0xHN4Ns",
    "network_transaction_id": null,
    "payment_method_status": "active",
    "updated": "2025-08-21T12:23:46.367Z",
    "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": "2088668112",
    "card_discovery": "manual",
    "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
}

Screenshot 2025-08-26 at 8 21 38 AM

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 review from a team as code owners August 21, 2025 12:41
@semanticdiff-com
Copy link

semanticdiff-com bot commented Aug 21, 2025

@deepanshu-iiitu deepanshu-iiitu added A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement labels Aug 21, 2025
@deepanshu-iiitu
Copy link
Contributor

In the recurring call why are we passing browser info?

dgeee13
dgeee13 previously approved these changes Aug 25, 2025
@Vani-1107 Vani-1107 dismissed stale reviews from dgeee13 and deepanshu-iiitu via 393fb34 August 26, 2025 03:28
@Vani-1107 Vani-1107 requested review from a team as code owners August 26, 2025 03:28
@Vani-1107 Vani-1107 removed the request for review from a team August 26, 2025 03:33
dgeee13
dgeee13 previously approved these changes Aug 26, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Aug 26, 2025
Merged via the queue into main with commit 58ff01b Aug 26, 2025
21 of 25 checks passed
@likhinbopanna likhinbopanna deleted the mandate-flow-nuvei branch August 26, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants