Skip to content

Conversation

bsayak03
Copy link
Contributor

@bsayak03 bsayak03 commented Jun 11, 2025

Type of Change

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

Description

In the CIT call, we store the stripe split payment details inside Mandate Metadata and during the MIT calls we retrieve the split payments data from there and use it in the MIT calls. And if the merchant sends split payment details again in the MIT call, we match it. If its the same we move forward. If different we throw an error.

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?

Case 1 : In MIT call donot pass Split Object

Do a CIT Call in Stripe :

cURL :

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_xBcDc9pB8qAMMQPKevYgWc9OmJX4g8uJNdumSg0r0MJniBLmiIKg2RGZd8xfZaKJ' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data '{
    "amount": 200,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "amount_to_capture": 200,
    "customer_id": "knhfhka1777771lsklkdlo",
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "09",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "split_payments": {
        "stripe_split_payment": {
            "charge_type": "direct",
            "application_fees": 100,
            "transfer_account_id": "STRIPE_CONNECT_ACCOUNT_ID"
        }
    },
    "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": "128.0.0.1"
    }
}

'

Response:

{
    "payment_id": "pay_cEcqgSSp33PsX5R4uwFM",
    "merchant_id": "merchant_1749631905",
    "status": "succeeded",
    "amount": 200,
    "net_amount": 200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 200,
    "connector": "stripe",
    "client_secret": "pay_cEcqgSSp33PsX5R4uwFM_secret_boU7DjdGaKtsrnFKMIbK",
    "created": "2025-06-11T15:15:55.676Z",
    "currency": "USD",
    "customer_id": "knhfhka1777771lsklkdlo",
    "customer": {
        "id": "knhfhka1777771lsklkdlo",
        "name": "John Doe",
        "email": null,
        "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "09",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://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": "debit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "knhfhka1777771lsklkdlo",
        "created_at": 1749654955,
        "expires": 1749658555,
        "secret": "epk_516e99419e6a4258a80564a35597b79f"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RYqNdB7KCg1IWRp0et6BMH5",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RYqNdB7KCg1IWRp0et6BMH5",
    "payment_link": null,
    "profile_id": "pro_akVQl6yaf45xunErXMGC",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_apjrpOfsP9HdQUueJzyk",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-06-11T15:30:55.676Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.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_method_id": "pm_UOhsKOUeYM6fnzWyCHtU",
    "payment_method_status": "active",
    "updated": "2025-06-11T15:15:58.088Z",
    "split_payments": {
        "stripe_split_payment": {
            "charge_id": "ch_3RYqNdB7KCg1IWRp0ngPDpVO",
            "charge_type": "direct",
            "application_fees": 100,
            "transfer_account_id": "STRIPE_CONNECT_ACCOUNT_ID"
        }
    },
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RYqNcB7KCg1IWRpVkNUOCV3",
    "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
}

Do a MIT call now (without passing any split payment object now) :

cURL:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_xBcDc9pB8qAMMQPKevYgWc9OmJX4g8uJNdumSg0r0MJniBLmiIKg2RGZd8xfZaKJ' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data '{
    "amount": 200,
    "currency": "USD",
    "customer_id": "knhfhka1777771lsklkdlo",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_UOhsKOUeYM6fnzWyCHtU"
    }
}'

Response:

{
    "payment_id": "pay_yKso0LToFJVpDpiM5e6y",
    "merchant_id": "merchant_1749631905",
    "status": "succeeded",
    "amount": 200,
    "net_amount": 200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 200,
    "connector": "stripe",
    "client_secret": "pay_yKso0LToFJVpDpiM5e6y_secret_HPX9Di3YfCBAmnK3T9mw",
    "created": "2025-06-11T15:16:34.464Z",
    "currency": "USD",
    "customer_id": "knhfhka1777771lsklkdlo",
    "customer": {
        "id": "knhfhka1777771lsklkdlo",
        "name": "John Doe",
        "email": null,
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "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": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "09",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": "999999999",
    "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": "debit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "knhfhka1777771lsklkdlo",
        "created_at": 1749654994,
        "expires": 1749658594,
        "secret": "epk_59c99d7518734fa98c1bc49f0d15ee90"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RYqOEB7KCg1IWRp15Y5b8Ws",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RYqOEB7KCg1IWRp15Y5b8Ws",
    "payment_link": null,
    "profile_id": "pro_akVQl6yaf45xunErXMGC",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_apjrpOfsP9HdQUueJzyk",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-06-11T15:31:34.464Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_UOhsKOUeYM6fnzWyCHtU",
    "payment_method_status": "active",
    "updated": "2025-06-11T15:16:35.853Z",
    "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": "pm_1RYqNcB7KCg1IWRpVkNUOCV3",
    "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
}

Case 2: Pass same Split Payment object in MIT

CIT ->
cURL:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_J474LWDEIbaWEUYUsem0vNOktW8XRXbWZhhtraxUwJKhMSG3KmkhE3dUEJfg2S9I' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data '{
    "amount": 200,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "amount_to_capture": 200,
    "customer_id": "knhfhka177777kf1lsklkdlo",
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "09",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "split_payments": {
        "stripe_split_payment": {
            "charge_type": "direct",
            "application_fees": 100,
            "transfer_account_id": "acct_1RQUkaB7KCg1IWRp"
        }
    },
    "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": "128.0.0.1"
    }
}'

Response:

{
    "payment_id": "pay_lvorbry91cIh0tcmYMKu",
    "merchant_id": "merchant_1750246108",
    "status": "succeeded",
    "amount": 200,
    "net_amount": 200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 200,
    "connector": "stripe",
    "client_secret": "pay_lvorbry91cIh0tcmYMKu_secret_yANjaH3qyy1kfOKkChUA",
    "created": "2025-06-18T11:30:12.025Z",
    "currency": "USD",
    "customer_id": "knhfhka177777kf1lsklkdlo",
    "customer": {
        "id": "knhfhka177777kf1lsklkdlo",
        "name": "John Doe",
        "email": null,
        "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "09",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://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": "debit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "knhfhka177777kf1lsklkdlo",
        "created_at": 1750246212,
        "expires": 1750249812,
        "secret": "epk_db804d8d19f74db8b025ac9c28b60d00"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RbKC5B7KCg1IWRp0v6JhJvF",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RbKC5B7KCg1IWRp0v6JhJvF",
    "payment_link": null,
    "profile_id": "pro_45FnuEIqMGyjxm8Z9YlD",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_S7lNHNJ3ZhshzKzxb4Mr",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-06-18T11:45:12.025Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.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_method_id": "pm_B8jkZiFsvTVIPj6Or7jr",
    "payment_method_status": "active",
    "updated": "2025-06-18T11:30:18.094Z",
    "split_payments": {
        "stripe_split_payment": {
            "charge_id": "ch_3RbKC5B7KCg1IWRp0juYzSkW",
            "charge_type": "direct",
            "application_fees": 100,
            "transfer_account_id": "acct_1RQUkaB7KCg1IWRp"
        }
    },
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RbKC4B7KCg1IWRpTw5KYQpL",
    "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
}

MIT ->

cURL :

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_J474LWDEIbaWEUYUsem0vNOktW8XRXbWZhhtraxUwJKhMSG3KmkhE3dUEJfg2S9I' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data '{
    "amount": 200,
    "currency": "USD",
    "customer_id": "knhfhka177777kf1lsklkdlo",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_B8jkZiFsvTVIPj6Or7jr"
    },
    "split_payments": {
        "stripe_split_payment": {
            "charge_type": "direct",
            "application_fees": 100,
            "transfer_account_id": "acct_1RQUkaB7KCg1IWRp"
        }
    }
}'

Response:

{
    "payment_id": "pay_HoVJE20WJVKH0jmI0Sfx",
    "merchant_id": "merchant_1750246108",
    "status": "succeeded",
    "amount": 200,
    "net_amount": 200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 200,
    "connector": "stripe",
    "client_secret": "pay_HoVJE20WJVKH0jmI0Sfx_secret_7Y9d2KfeSZehf0ptV6zF",
    "created": "2025-06-18T11:37:24.360Z",
    "currency": "USD",
    "customer_id": "knhfhka177777kf1lsklkdlo",
    "customer": {
        "id": "knhfhka177777kf1lsklkdlo",
        "name": "John Doe",
        "email": null,
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "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": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "09",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": "999999999",
    "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": "debit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "knhfhka177777kf1lsklkdlo",
        "created_at": 1750246644,
        "expires": 1750250244,
        "secret": "epk_b2e0c070c1aa4fff97dd7e96c0d57fc8"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RbKIzB7KCg1IWRp1EDwUqZ3",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RbKIzB7KCg1IWRp1EDwUqZ3",
    "payment_link": null,
    "profile_id": "pro_45FnuEIqMGyjxm8Z9YlD",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_S7lNHNJ3ZhshzKzxb4Mr",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-06-18T11:52:24.360Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_B8jkZiFsvTVIPj6Or7jr",
    "payment_method_status": "active",
    "updated": "2025-06-18T11:37:26.148Z",
    "split_payments": {
        "stripe_split_payment": {
            "charge_id": "ch_3RbKIzB7KCg1IWRp1CFfiKhZ",
            "charge_type": "direct",
            "application_fees": 100,
            "transfer_account_id": "acct_1RQUkaB7KCg1IWRp"
        }
    },
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RbKC4B7KCg1IWRpTw5KYQpL",
    "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
}

Case 3: Pass Split Payment object in MIT but different from the one which was sent in CIT (conflicted case)

CIT ->
cURL :

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_J474LWDEIbaWEUYUsem0vNOktW8XRXbWZhhtraxUwJKhMSG3KmkhE3dUEJfg2S9I' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data '{
    "amount": 200,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "amount_to_capture": 200,
    "customer_id": "knhfhka177777kf1lsklkdlo",
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "09",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "split_payments": {
        "stripe_split_payment": {
            "charge_type": "direct",
            "application_fees": 100,
            "transfer_account_id": "STRIPE_CONNECT_ACCOUNT_ID"
        }
    },
    "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": "128.0.0.1"
    }
}'

Response:

{
    "payment_id": "pay_lvorbry91cIh0tcmYMKu",
    "merchant_id": "merchant_1750246108",
    "status": "succeeded",
    "amount": 200,
    "net_amount": 200,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 200,
    "connector": "stripe",
    "client_secret": "pay_lvorbry91cIh0tcmYMKu_secret_yANjaH3qyy1kfOKkChUA",
    "created": "2025-06-18T11:30:12.025Z",
    "currency": "USD",
    "customer_id": "knhfhka177777kf1lsklkdlo",
    "customer": {
        "id": "knhfhka177777kf1lsklkdlo",
        "name": "John Doe",
        "email": null,
        "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "09",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": null,
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://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": "debit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "knhfhka177777kf1lsklkdlo",
        "created_at": 1750246212,
        "expires": 1750249812,
        "secret": "epk_db804d8d19f74db8b025ac9c28b60d00"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RbKC5B7KCg1IWRp0v6JhJvF",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RbKC5B7KCg1IWRp0v6JhJvF",
    "payment_link": null,
    "profile_id": "pro_45FnuEIqMGyjxm8Z9YlD",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_S7lNHNJ3ZhshzKzxb4Mr",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-06-18T11:45:12.025Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.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_method_id": "pm_B8jkZiFsvTVIPj6Or7jr",
    "payment_method_status": "active",
    "updated": "2025-06-18T11:30:18.094Z",
    "split_payments": {
        "stripe_split_payment": {
            "charge_id": "ch_3RbKC5B7KCg1IWRp0juYzSkW",
            "charge_type": "direct",
            "application_fees": 100,
            "transfer_account_id": "STRIPE_CONNECT_ACCOUNT_ID"
        }
    },
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": "pm_1RbKC4B7KCg1IWRpTw5KYQpL",
    "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
}

MIT (application_fees passed is different than the one sent in MIT) ->

cURL:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_J474LWDEIbaWEUYUsem0vNOktW8XRXbWZhhtraxUwJKhMSG3KmkhE3dUEJfg2S9I' \
--header 'Cookie: PHPSESSID=0b47db9d7de94c37b6b272087a9f2fa7' \
--data '{
    "amount": 200,
    "currency": "USD",
    "customer_id": "knhfhka177777kf1lsklkdlo",
    "description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_B8jkZiFsvTVIPj6Or7jr"
    },
    "split_payments": {
        "stripe_split_payment": {
            "charge_type": "direct",
            "application_fees": 10,
            "transfer_account_id": "STRIPE_CONNECT_ACCOUNT_ID"
        }
    }
}'

Response:

{
    "error": {
        "type": "invalid_request",
        "message": "Field transfer_account_id, application_fees, charge_type doesn't match with the ones used during mandate creation",
        "code": "IR_46",
        "fields": "transfer_account_id, application_fees, charge_type"
    }
}

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 review from a team as code owners June 11, 2025 15:23
Copy link

semanticdiff-com bot commented Jun 11, 2025

@bsayak03 bsayak03 self-assigned this Jun 11, 2025
@@ -193,6 +193,8 @@ pub enum ConnectorError {
InvalidDataFormat { field_name: &'static str },
#[error("Payment Method data / Payment Method Type / Payment Experience Mismatch ")]
MismatchedPaymentData,
#[error("transfer_account_id/application_fees/charge_type sent in request doesn't match with the values used during mandate creation ")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use generic field name instead of transfer_account_id/application_fees/charge_type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to say i should make the error message Dynamic and at the connector level populate the message?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like we do for FlowNotSupported

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

@bsayak03 bsayak03 requested a review from a team as a code owner June 13, 2025 12:28
@@ -290,6 +290,8 @@ pub enum ApiErrorResponse {
InvalidPlatformOperation,
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_45", message = "External vault failed during processing with connector")]
ExternalVaultFailed,
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_46", message = "Fields like {fields} doesn't match with the ones used during mandate creation")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_46", message = "Fields like {fields} doesn't match with the ones used during mandate creation")]
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_46", message = "Field {fields} doesn't match with the ones used during mandate creation")]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

@@ -651,6 +653,9 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
Self::ExternalVaultFailed => {
AER::BadRequest(ApiError::new("IR", 45, "External Vault failed while processing with connector.", None))
},
Self::MandatePaymentDataMismatch { fields} => {
AER::BadRequest(ApiError::new("IR", 46, format!("Fields like {fields} doesn't match with the ones used during mandate creation"), Some(Extra {fields: Some(fields.to_owned()), ..Default::default()}))) //FIXME: error message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AER::BadRequest(ApiError::new("IR", 46, format!("Fields like {fields} doesn't match with the ones used during mandate creation"), Some(Extra {fields: Some(fields.to_owned()), ..Default::default()}))) //FIXME: error message
AER::BadRequest(ApiError::new("IR", 46, format!("Field {fields} doesn't match with the ones used during mandate creation"), Some(Extra {fields: Some(fields.to_owned()), ..Default::default()}))) //FIXME: error message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

@@ -193,6 +193,8 @@ pub enum ConnectorError {
InvalidDataFormat { field_name: &'static str },
#[error("Payment Method data / Payment Method Type / Payment Experience Mismatch ")]
MismatchedPaymentData,
#[error("Fields like {fields} doesn't match with the ones used during mandate creation")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[error("Fields like {fields} doesn't match with the ones used during mandate creation")]
#[error("Field {fields} doesn't match with the ones used during mandate creation")]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

jagan-jaya
jagan-jaya previously approved these changes Jun 16, 2025
Copy link
Contributor

@jagan-jaya jagan-jaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Framework changes looks good. please update the PR description as it is empty now

@deepanshu-iiitu deepanshu-iiitu requested a review from sahkal June 16, 2025 06:35
})
.and_then(|secret_value| {
let json_value = secret_value.clone().expose();
serde_json::from_value::<Self>(json_value).ok()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we not ignore error here, instead log the error if not populate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

@@ -600,6 +600,9 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
errors::ApiErrorResponse::AddressNotFound => Self::AddressNotFound,
errors::ApiErrorResponse::NotImplemented { .. } => Self::Unauthorized,
errors::ApiErrorResponse::FlowNotSupported { .. } => Self::InternalServerError,
errors::ApiErrorResponse::MandatePaymentDataMismatch { .. } => {
Self::InternalServerError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 4xx if we are checking some request data to our internal saved data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

Comment on lines 7011 to 7025
.get_amount_as_i64()
!= 0
{
return Err(errors::ApiErrorResponse::InvalidDataValue {
field_name: "split_payments.stripe_split_payment.application_fees",
});
}
}
api::Amount::Value(amount) => {
if stripe_split_payment.application_fees.get_amount_as_i64() > amount.into() {
if stripe_split_payment
.application_fees
.as_ref()
.map_or(MinorUnit::zero(), |amount| *amount)
.get_amount_as_i64()
> amount.into()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please try removing get_amount_as_i64() function from here, also not use it any of the future use cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright

@bsayak03 bsayak03 dismissed stale reviews from jagan-jaya and deepanshu-iiitu via 2edd8d0 June 16, 2025 09:01
sahkal
sahkal previously approved these changes Jun 16, 2025
@@ -386,6 +386,14 @@ impl AmountConvertor for MinorUnitForConnector {
#[diesel(sql_type = sql_types::BigInt)]
pub struct MinorUnit(i64);

use std::num::NonZeroI64;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this import to top of the file

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 18, 2025
Merged via the queue into main with commit 17c30b6 Jun 18, 2025
26 of 32 checks passed
@Gnanasundari24 Gnanasundari24 deleted the stripe_connect/mit/fix branch June 18, 2025 12:23
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.

5 participants