Skip to content

Conversation

@Sakilmostak
Copy link
Contributor

@Sakilmostak Sakilmostak commented Dec 2, 2025

Type of Change

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

Description

  • both first name and last name are currently mandatory for MIT payouts through Adyen platform
  • but we want the transaction to proceed in case they are not present thus we made them optional

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?

Generate storePaymentMethodId with Adyen during Payments

curl --location 'https://checkout-test.adyen.com/v68/payments' \
--header 'x-api-key: {{api_key}}' \
--header 'content-type: application/json' \
--data '{
    "amount": {
      "currency": "USD",
      "value": 1000
    },
    "reference": "6cc1f0b3-b6d2-4e9e-8584-62cb0b34f86a",
    "paymentMethod": {
      "type": "scheme",
      "number": "4111111111111111",
      "expiryMonth": "03",
      "expiryYear": "2030",
      "cvc": "737",
      "holderName": "S. Hopper"
    },
    "returnUrl": "https://your-company.example.com/...",
    "merchantAccount": "{{merchantAccount}}",
    "shopperReference": "{{your_reference_id}}",
    "enablePayOut": true
    
  }'

In the response collect the value from additionalData.tokenization.shopperReference

Create an CIT payment with Adyen in Hyperswitch:

curl --location '{{baseUrl}}/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-feature: integ-custom' \
--header 'api-key:{{api_key}}' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "customer_id": "sakilmostak",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holdewdwedjhwqbdhj": "Joseph Doe",
            "card_cvc": "737"
            
        }
    },
    "routing": {
        "type": "single",
        "data": "adyen"
    },
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "online"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "swangi",
            "last_name": "kumari"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "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": "127.0.0.1"
    }
}'

Collect the payment_method_id from the response, below is an example

{
    "payment_id": "pay_vdZOCJaDB7tUHYlSuCRj",
    "merchant_id": "merchant_1764162777",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "adyen",
    "client_secret": "pay_vdZOCJaDB7tUHYlSuCRj_secret_KvDtMiCOG8CMYJ0KrQzW",
    "created": "2025-11-26T13:21:26.692Z",
    "currency": "USD",
    "customer_id": "sakilmostak",
    "customer": {
        "id": "sakilmostak",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "1111",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": null,
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "swangi",
            "last_name": "kumari",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "error_reason": 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": "sakilmostak",
        "created_at": 1764163286,
        "expires": 1764166886,
        "secret": "epk_9eb696cdc6e74acdb96ef2d7cc49775b"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "PJ7BQWNLVKRSPBV5",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pay_vdZOCJaDB7tUHYlSuCRj_1",
    "payment_link": null,
    "profile_id": "pro_9XM85ivRnMPWkQ4v2NPn",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_kQNpdfEoaAAj5xeZCEMK",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-11-26T13:36:26.692Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "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",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_JinKwP9YZzxxHlXOBh7m",
    "network_transaction_id": "314231115705711",
    "payment_method_status": "active",
    "updated": "2025-11-26T13:21:28.032Z",
    "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": "F5HFLNLM6L74STT5",
    "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,
    "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
}

Insert the storePaymentMethodId generated with Adyen against the payment_method_id entry of our table with the given format.
Save it with the mca_id of the payout connector (Adyenplatform)
Change the value of connector_mandate_details with below details for the payment method entry

{
  "payouts": {
    "mca_TnJ09inDv9kBJUcXenme": { "transfer_method_id": "KHD742NNK95TPM75" }
  },
  "mca_kQNpdfEoaAAj5xeZCEMK": {
    "mandate_metadata": null,
    "payment_method_type": "credit",
    "connector_mandate_id": "F5HFLNLM6L74STT5",
    "connector_customer_id": null,
    "connector_mandate_status": "active",
    "original_payment_authorized_amount": 1000,
    "original_payment_authorized_currency": "USD",
    "connector_mandate_request_reference_id": "2G7WjbVkQxxL8gIVSn"
  }
}

Create a payout using the payment_method_id of the payment (with valid first and last name):

curl --location '{{baseUrl}}/payouts/create' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:{{api_key}}' \
--data-raw '{
    "amount": 10,
    "currency": "EUR",
    "customer_id": "sakilmostak",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payout request",
    "payout_method_id": "pm_JinKwP9YZzxxHlXOBh7m",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "DE",
            "zip": "94122",
            "country": "US",
            "first_name": "",
            "last_name": "THOMPSON   thompson   "  
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "auto_fulfill": true,
    "confirm": true
}'

Following should be the response

{
    "payout_id": "payout_Vo63qeSuJVKMVdEmwCIl",
    "merchant_id": "merchant_1764162777",
    "merchant_order_reference_id": null,
    "amount": 10,
    "currency": "EUR",
    "connector": "adyenplatform",
    "payout_type": "card",
    "payout_method_data": {
        "card": {
            "card_issuer": null,
            "card_network": null,
            "card_type": null,
            "card_issuing_country": null,
            "bank_code": null,
            "last4": "1111",
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "swangi kumari"
        }
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "DE",
            "first_name": "Sakil",
            "last_name": "Mostak",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "auto_fulfill": true,
    "customer_id": "sakilmostak",
    "customer": {
        "id": "sakilmostak",
        "name": null,
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "client_secret": "payout_payout_Vo63qeSuJVKMVdEmwCIl_secret_JBNbFyrBvmjo6yjnpVIQ",
    "return_url": null,
    "business_country": null,
    "business_label": null,
    "description": "Its my first payout request",
    "entity_type": "Individual",
    "recurring": true,
    "metadata": {
        "ref": "123"
    },
    "merchant_connector_id": "mca_TnJ09inDv9kBJUcXenme",
    "status": "initiated",
    "error_message": null,
    "error_code": null,
    "profile_id": "pro_9XM85ivRnMPWkQ4v2NPn",
    "created": "2025-11-27T09:24:45.163Z",
    "connector_transaction_id": "38EBKI694SAKJ3HR",
    "priority": null,
    "payout_link": null,
    "email": "[email protected]",
    "name": null,
    "phone": "999999999",
    "phone_country_code": "+1",
    "unified_code": null,
    "unified_message": null,
    "payout_method_id": "pm_JinKwP9YZzxxHlXOBh7m"
}

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

@Sakilmostak Sakilmostak self-assigned this Dec 2, 2025
@Sakilmostak Sakilmostak requested a review from a team as a code owner December 2, 2025 08:31
@Sakilmostak Sakilmostak added A-connector-integration Area: Connector integration C-refactor Category: Refactor Payouts Area: Payouts labels Dec 2, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 2, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs  54% smaller

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

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

Files with missing lines Patch % Lines
...c/connectors/adyenplatform/transformers/payouts.rs 0.00% 19 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10502   +/-   ##
=======================================
  Coverage        ?    6.47%           
=======================================
  Files           ?     1249           
  Lines           ?   311339           
  Branches        ?        0           
=======================================
  Hits            ?    20171           
  Misses          ?   291168           
  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.

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-refactor Category: Refactor Payouts Area: Payouts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR]: [PAYOUTS] make first_name and last_name optional for MIT payouts through adyen platform

3 participants