Skip to content

feat(connector): [Authorizedotnet] Pass surcharge in payments request#12851

Merged
Vani-1107 merged 5 commits into
mainfrom
authorizedotnet-add-surcharge
Jun 22, 2026
Merged

feat(connector): [Authorizedotnet] Pass surcharge in payments request#12851
Vani-1107 merged 5 commits into
mainfrom
authorizedotnet-add-surcharge

Conversation

@Vani-1107

@Vani-1107 Vani-1107 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Type of Change

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

Description

Pass surcharge in payments request whenever applicable.

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?

Payment Request:


{
    "amount": 100,
    "currency": "USD",
    "confirm": false,
    "description": "Test004",
    "capture_method": "automatic",
    "customer_id": "StripeCustomer5",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "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"
    },
    "all_keys_required": true,
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    }
}

Response:


{
    "payment_id": "pay_vIHy57Xqv40lBomEKwyu",
    "merchant_id": "merchant_1781861912",
    "status": "requires_payment_method",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "processor_merchant_id": "merchant_1781861912",
    "initiator": null,
    "sdk_authorization": "cHJvZmlsZV9pZD1wcm9fd0E5UzJxbUI1Q1pleVdYaVJhNzkscHVibGlzaGFibGVfa2V5PXBrX2Rldl84ZDk2ZDU2YmY2ZGM0NTE0ODBhZWM3MzJkOTVkZDU4NSxjbGllbnRfc2VjcmV0PXBheV92SUh5NTdYcXY0MGxCb21FS3d5dV9zZWNyZXRfZnJUdFRxUzZxaGl1amxCMVNOQzIsY3VzdG9tZXJfaWQ9U3RyaXBlQ3VzdG9tZXI1LGNsaWVudF9zZXNzaW9uX2lkPWNsaWVudF9zZXNzX2FSNmgzRWZPQUVPZk9NaTBUR1VxLHBheW1lbnRfaWQ9cGF5X3ZJSHk1N1hxdjQwbEJvbUVLd3l1",
    "connector": null,
    "state_metadata": null,
    "client_secret": "pay_vIHy57Xqv40lBomEKwyu_secret_frTtTqS6qhiujlB1SNC2",
    "created": "2026-06-19T10:35:22.918Z",
    "modified_at": "2026-06-19T10:35:22.932Z",
    "connector_customer_id": null,
    "currency": "USD",
    "customer_id": "StripeCustomer5",
    "customer": {
        "id": "StripeCustomer5",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "customer_document_details": null
    },
    "description": "Test004",
    "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": null,
    "payment_method_data": 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": "John",
            "last_name": "Doe",
            "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": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": null,
    "authentication_type": null,
    "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,
    "error_details": null,
    "payment_experience": null,
    "payment_method_type": null,
    "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": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "connector_response_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_wA9S2qmB5CZeyWXiRa79",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2026-06-19T10:50:22.918Z",
    "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": null,
    "network_transaction_id": null,
    "network_transaction_link_id": null,
    "payment_method_status": null,
    "updated": "2026-06-19T10:35:22.932Z",
    "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": 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,
    "payment_method_tokenization_details": null,
    "installment_options": null,
    "installment_data": null,
    "sender_payment_instrument_id": null
}

Make a /eligibility call:


curl --location 'http://localhost:8080/payments/pay_vIHy57Xqv40lBomEKwyu/eligibility' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_AFS0cGTwo1ZuMt51VUpF6gjraQbM069g1AstY8RFvOCp6jqgB5Bs1Z1i6rAkbTZA' \
--data '{
    "payment_id": "pay_vIHy57Xqv40lBomEKwyu",
    "payment_method_type": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111"
        }

    }
}'

Response:


{
    "payment_id": "pay_vIHy57Xqv40lBomEKwyu",
    "sdk_next_action": {
        "next_action": "confirm",
        "should_block_confirm": null
    },
    "surcharge_details": {
        "surcharge": {
            "type": "fixed",
            "value": 3
        },
        "tax_on_surcharge": null,
        "display_surcharge_amount": 0.03,
        "display_tax_on_surcharge_amount": 0.0,
        "display_total_surcharge_amount": 0.03
    }
}

  1. Confirm the payment:

{
    "amount": 100,
    "currency": "USD",
    "confirm": true,
    "description": "Test004",
    "capture_method": "automatic",
    "customer_id": "StripeCustomer5",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_holder_name": "joseph Doe",
            "card_number": "4111111111111111",
            "card_exp_month": "01",
            "card_exp_year": "28",
            "card_cvc": "168"
        }
    },
    "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"
    },
    "all_keys_required": true,
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    }
}

Response:


{
    "payment_id": "pay_vIHy57Xqv40lBomEKwyu",
    "merchant_id": "merchant_1781861912",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 103,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 103,
    "processor_merchant_id": "merchant_1781861912",
    "initiator": null,
    "sdk_authorization": "cHJvZmlsZV9pZD1wcm9fd0E5UzJxbUI1Q1pleVdYaVJhNzkscHVibGlzaGFibGVfa2V5PXBrX2Rldl84ZDk2ZDU2YmY2ZGM0NTE0ODBhZWM3MzJkOTVkZDU4NSxjbGllbnRfc2VjcmV0PXBheV92SUh5NTdYcXY0MGxCb21FS3d5dV9zZWNyZXRfZnJUdFRxUzZxaGl1amxCMVNOQzIsY3VzdG9tZXJfaWQ9U3RyaXBlQ3VzdG9tZXI1LHBheW1lbnRfaWQ9cGF5X3ZJSHk1N1hxdjQwbEJvbUVLd3l1",
    "connector": "authorizedotnet",
    "state_metadata": null,
    "client_secret": "pay_vIHy57Xqv40lBomEKwyu_secret_frTtTqS6qhiujlB1SNC2",
    "created": "2026-06-19T10:35:22.918Z",
    "modified_at": "2026-06-19T10:40:07.363Z",
    "connector_customer_id": "526936233",
    "currency": "USD",
    "customer_id": "StripeCustomer5",
    "customer": {
        "id": "StripeCustomer5",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "customer_document_details": null
    },
    "description": "Test004",
    "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": "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": "01",
            "card_exp_year": "28",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "description": "The street address and postal code matched.",
                "avs_result_code": "Y"
            },
            "authentication_data": null,
            "auth_code": 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": "John",
            "last_name": "Doe",
            "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": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "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,
    "error_details": 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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "80056321418",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "connector_response_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "pix_additional_details": null,
        "boleto_additional_details": null,
        "pix_automatico_additional_details": null,
        "finix_additional_details": null
    },
    "reference_id": "80056321418",
    "payment_link": null,
    "profile_id": "pro_wA9S2qmB5CZeyWXiRa79",
    "surcharge_details": {
        "surcharge_amount": 3,
        "tax_amount": 0
    },
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_lSmj6V35EbNq93xvfPi0",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2026-06-19T10:50:22.918Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "referer": null,
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "os_version": null,
        "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,
        "device_model": null,
        "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,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": "7ZWOV5ZOIF1Y0J21JBL3G2X",
    "network_transaction_link_id": null,
    "payment_method_status": null,
    "updated": "2026-06-19T10:40:07.363Z",
    "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": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": 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,
    "payment_method_tokenization_details": null,
    "installment_options": null,
    "installment_data": null,
    "sender_payment_instrument_id": null
}

Screenshot 2026-06-19 at 4 11 26 PM

Setup Mandate:


{
    "amount": 0,
    "currency": "USD",
    "confirm": false,
    "description": "Test004",
    "payment_type": "setup_mandate",
    "capture_method": "automatic",
    "customer_id": "StripeCustomer5u22w1",
    "email": "abcdef12j3@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_holder_name": "joseph Doe",
            "card_number": "4111111111111111",
            "card_exp_month": "01",
            "card_exp_year": "28",
            "card_cvc": "168"
        }
    },
    "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"
    },
    "all_keys_required": true,
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "setup_future_usage": "off_session",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    }
}

Response:


{
    "payment_id": "pay_mglxTdTRHBG6bBSgJAeQ",
    "merchant_id": "merchant_1782029975",
    "status": "succeeded",
    "amount": 0,
    "net_amount": 0,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "processor_merchant_id": "merchant_1782029975",
    "initiator": null,
    "sdk_authorization": "cHJvZmlsZV9pZD1wcm9fbVI0TTRYdTY3dFlDY09wamtrdXoscHVibGlzaGFibGVfa2V5PXBrX2Rldl8yMjY1ZGY5Y2E5MGI0ODhiYTYwMTVkODUwN2YxNmI4ZSxjbGllbnRfc2VjcmV0PXBheV9tZ2x4VGRUUkhCRzZiQlNnSkFlUV9zZWNyZXRfdTcwZzQyOVA3NjNDM0hHNkZ3Sk0sY3VzdG9tZXJfaWQ9U3RyaXBlQ3VzdG9tZXI1dTIydzEscGF5bWVudF9pZD1wYXlfbWdseFRkVFJIQkc2YkJTZ0pBZVE=",
    "connector": "authorizedotnet",
    "state_metadata": null,
    "client_secret": "pay_mglxTdTRHBG6bBSgJAeQ_secret_u70g429P763C3HG6FwJM",
    "created": "2026-06-21T08:42:32.562Z",
    "modified_at": "2026-06-21T08:45:13.338Z",
    "connector_customer_id": "526942932",
    "currency": "USD",
    "customer_id": "StripeCustomer5u22w1",
    "customer": {
        "id": "StripeCustomer5u22w1",
        "name": "John Doe",
        "email": "abcdef12j3@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "customer_document_details": null
    },
    "description": "Test004",
    "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": "01",
            "card_exp_year": "28",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null,
            "auth_code": 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": "John",
            "last_name": "Doe",
            "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": "John",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef12j3@gmail.com",
    "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,
    "error_details": 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,
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "connector_response_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "pix_additional_details": null,
        "boleto_additional_details": null,
        "pix_automatico_additional_details": null,
        "finix_additional_details": null
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_mR4M4Xu67tYCcOpjkkuz",
    "surcharge_details": {
        "surcharge_amount": 0,
        "tax_amount": 0
    },
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_bon5PqubA5W5hAMs346V",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2026-06-21T08:57:32.562Z",
    "fingerprint": null,
    "browser_info": {
        "os_type": null,
        "referer": null,
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "os_version": null,
        "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,
        "device_model": null,
        "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,
        "accept_language": "en",
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": "pm_bS777hamlTdziLMdNHEF",
    "network_transaction_id": null,
    "network_transaction_link_id": null,
    "payment_method_status": "active",
    "updated": "2026-06-21T08:45:13.338Z",
    "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": "526942932-539015961",
    "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,
    "payment_method_tokenization_details": {
        "payment_method_id": "pm_bS777hamlTdziLMdNHEF",
        "payment_method_status": "active",
        "psp_tokenization": false,
        "network_tokenization": false,
        "network_transaction_id": null,
        "network_transaction_link_id": null,
        "is_eligible_for_mit_payment": false
    },
    "installment_options": null,
    "installment_data": null,
    "sender_payment_instrument_id": null
}

MIT:


curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_mMY4zESjDpphpfpT0nF6wsj46uhTOSfR3xS7VTsQ0p8yQJQXCU1IB50Ih39R7sbL' \
--data '{
    "amount": 1000,
    "currency": "USD",
    "customer_id": "StripeCustomer5u22w1",
    "confirm": true,
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_bS777hamlTdziLMdNHEF"
    }
}'

Response:


{
    "payment_id": "pay_pFJQIZsDTx6eQPYgemmL",
    "merchant_id": "merchant_1782029975",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1030,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1030,
    "processor_merchant_id": "merchant_1782029975",
    "initiator": null,
    "sdk_authorization": "cHJvZmlsZV9pZD1wcm9fbVI0TTRYdTY3dFlDY09wamtrdXoscHVibGlzaGFibGVfa2V5PXBrX2Rldl8yMjY1ZGY5Y2E5MGI0ODhiYTYwMTVkODUwN2YxNmI4ZSxjbGllbnRfc2VjcmV0PXBheV9wRkpRSVpzRFR4NmVRUFlnZW1tTF9zZWNyZXRfMXdRRmp2dVpYUFQxV3lEZnFENFMsY3VzdG9tZXJfaWQ9U3RyaXBlQ3VzdG9tZXI1dTIydzEsY2xpZW50X3Nlc3Npb25faWQ9Y2xpZW50X3Nlc3NfUXZTdHZMaEFVVGZvMW9DaG9WREQscGF5bWVudF9pZD1wYXlfcEZKUUlac0RUeDZlUVBZZ2VtbUw=",
    "connector": "authorizedotnet",
    "state_metadata": null,
    "client_secret": "pay_pFJQIZsDTx6eQPYgemmL_secret_1wQFjvuZXPT1WyDfqD4S",
    "created": "2026-06-21T08:46:10.623Z",
    "modified_at": "2026-06-21T08:46:11.968Z",
    "connector_customer_id": "526942932",
    "currency": "USD",
    "customer_id": "StripeCustomer5u22w1",
    "customer": {
        "id": "StripeCustomer5u22w1",
        "name": "John Doe",
        "email": "abcdef12j3@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65",
        "customer_document_details": 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": "1111",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "28",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "description": "The street address and postal code matched.",
                "avs_result_code": "Y"
            },
            "authentication_data": null,
            "auth_code": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": "abcdef12j3@gmail.com",
    "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,
    "error_details": 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,
    "manual_retry_allowed": null,
    "connector_transaction_id": "80056352069",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "connector_response_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "pix_additional_details": null,
        "boleto_additional_details": null,
        "pix_automatico_additional_details": null,
        "finix_additional_details": null
    },
    "reference_id": "80056352069",
    "payment_link": null,
    "profile_id": "pro_mR4M4Xu67tYCcOpjkkuz",
    "surcharge_details": {
        "surcharge_amount": 30,
        "tax_amount": 0
    },
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_bon5PqubA5W5hAMs346V",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2026-06-21T09:01:10.623Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_channel": null,
    "payment_method_id": "pm_bS777hamlTdziLMdNHEF",
    "network_transaction_id": "FDWPLHK045A0AUVO1PS4DD9",
    "network_transaction_link_id": null,
    "payment_method_status": "active",
    "updated": "2026-06-21T08:46:11.968Z",
    "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": "526942932-539015961",
    "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": true,
    "mit_category": null,
    "billing_descriptor": null,
    "tokenization": null,
    "partner_merchant_identifier_details": null,
    "payment_method_tokenization_details": {
        "payment_method_id": "pm_bS777hamlTdziLMdNHEF",
        "payment_method_status": "active",
        "psp_tokenization": true,
        "network_tokenization": false,
        "network_transaction_id": null,
        "network_transaction_link_id": null,
        "is_eligible_for_mit_payment": true
    },
    "installment_options": null,
    "installment_data": null,
    "sender_payment_instrument_id": null
}

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 June 19, 2026 10:34
@semanticdiff-com

semanticdiff-com Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs  2% smaller

@Vani-1107 Vani-1107 self-assigned this Jun 19, 2026
@Vani-1107 Vani-1107 added the S-test-ready Status: This PR is ready for cypress-tests label Jun 19, 2026

@XyneSpaces XyneSpaces left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review: Authorizedotnet Surcharge Support

I've reviewed the changes for adding surcharge support to the Authorizedotnet connector. The implementation correctly extracts surcharge details and adds them to the transaction request. However, I've identified a few areas for improvement:

Issues Found:

  1. Code Duplication: The surcharge calculation logic is duplicated across 4 different TryFrom implementations. Consider extracting this into a helper function.

  2. Error Context: The error message could include more diagnostic information (currency, amount) to aid debugging production issues.

  3. Test Coverage: The PR checklist indicates unit tests were not added. Connector changes should include tests for the new surcharge mapping logic.

Inline Comments:

See detailed comments on specific lines below.

) -> Result<Self, Self::Error> {
let surcharge_amount = item
.router_data
.request

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ Suggestion: The error message could include more context for debugging. Consider:

.attach_printable(format!(
    "Failed to convert surcharge amount to major unit float for currency: {:?}",
    item.router_data.request.currency
))

This would help identify issues faster in production logs.

@XyneSpaces XyneSpaces left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review: Authorizedotnet Surcharge Support

This PR adds surcharge support to the Authorizedotnet connector. Below are my findings:

🟡 Medium: Code Duplication

The surcharge calculation logic is duplicated 4 times across different impl blocks (lines ~900, ~1048, ~1166, ~1281). Consider extracting this into a helper function to improve maintainability.

🟢 Good

  • Proper use of #[serde(skip_serializing_if = "Option::is_none")] to avoid sending empty surcharge objects
  • Appropriate error handling with change_context and attach_printable
  • Correct conversion from minor to major units using to_major_unit_as_f64

ℹ️ Suggestion

The Surcharge struct could benefit from a doc comment explaining it's for Authorizedotnet's surcharge API.

Comment thread crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs Outdated
subsequent_auth_information: Option<SubsequentAuthInformation>,
#[serde(skip_serializing_if = "Option::is_none")]
surcharge: Option<Surcharge>,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📝 Documentation Suggestion

Add a doc comment to the Surcharge struct:

/// Represents a surcharge amount to be added to the transaction.
/// Used for passing fee amounts to Authorizedotnet's API.
#[derive(Debug, Serialize)]
struct Surcharge {
    amount: FloatMajorUnit,
}

@XyneSpaces

Copy link
Copy Markdown
Contributor

🔍 Automated PR Review Summary

Review Status: Commented

File Changed: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs

Key Findings

Severity Count Description
🟡 Medium 1 Code duplication - surcharge calculation repeated 4 times
🟢 Low 1 Missing documentation on Surcharge struct
🟢 Good 2 Proper serde attributes and error handling

Recommendations

  1. Extract the surcharge calculation into a reusable helper function
  2. Add doc comments to the new Surcharge struct
  3. Consider adding unit tests for the surcharge amount conversion

Testing Notes

The PR includes manual testing evidence showing successful payment flows with surcharge. Unit tests for the new surcharge logic would strengthen confidence.


This is an automated review. Please address the findings before merging.

@github-actions github-actions Bot removed the S-test-ready Status: This PR is ready for cypress-tests label Jun 19, 2026
@Vani-1107 Vani-1107 added the S-test-ready Status: This PR is ready for cypress-tests label Jun 21, 2026
@Vani-1107
Vani-1107 force-pushed the authorizedotnet-add-surcharge branch from 1e01987 to 74f20e4 Compare June 21, 2026 08:51
@github-actions github-actions Bot removed the S-test-ready Status: This PR is ready for cypress-tests label Jun 21, 2026
@Vani-1107 Vani-1107 added the S-test-ready Status: This PR is ready for cypress-tests label Jun 21, 2026
@github-actions github-actions Bot removed the S-test-ready Status: This PR is ready for cypress-tests label Jun 21, 2026
@Vani-1107 Vani-1107 added the S-test-ready Status: This PR is ready for cypress-tests label Jun 22, 2026
@Vani-1107
Vani-1107 enabled auto-merge June 22, 2026 06:43
@Vani-1107
Vani-1107 added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit 2d275c9 Jun 22, 2026
38 of 42 checks passed
@Vani-1107
Vani-1107 deleted the authorizedotnet-add-surcharge branch June 22, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-test-ready Status: This PR is ready for cypress-tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants