Skip to content

Conversation

@awasthi21
Copy link
Contributor

@awasthi21 awasthi21 commented Jan 5, 2026

Type of Change

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

Description

Mollie can return HTTP 2xx responses even when a payment fails (for example, after a 3DS authentication flow). In such cases, the payment status is marked as failed or expired, and failure information is provided inside the details object.

Previously, these failures were not being surfaced correctly as connector errors in Hyperswitch.

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?

request create

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_iZc5amc1LbErVU7bwagJXEa61TQ7K1OsLXTxsXiPHzclDUjiC1K05aSvgFPeJN21' \
--data-raw '{
    "amount": 100200,
    "currency": "EUR",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    
    "customer_id": "cu_1757579182",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "setup_future_usage": "off_session",
    
    "return_url": "https://google.com",
    "email": "[email protected]",
    "name": "Joseph Doe",
    "phone": "999999999",
     "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "Zurich",
            "state": "asd",
            "zip": "8008",
            "country": "CH",
            "first_name": "joseph",
            "last_name": "Doe"
        }
    },
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "payment_method": "card",
    "payment_method_type": "credit",
    "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": "13.232.74.226"
    },
    "payment_method_data": {
        "card": {
            "card_number": "4543474002249996",
            "card_exp_month": "04",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "card_cvc": "123"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    }
}'

Response

{
    "payment_id": "pay_0GZt6OGeGveHduNPIZ9u",
    "merchant_id": "merchant_1767611044",
    "status": "requires_customer_action",
    "amount": 100100,
    "net_amount": 100100,
    "shipping_cost": null,
    "amount_capturable": 100100,
    "amount_received": null,
    "connector": "mollie",
    "client_secret": "pay_0GZt6OGeGveHduNPIZ9u_secret_n24ey5tpJ2Cl6eMDx450",
    "created": "2026-01-05T11:04:52.870Z",
    "modified_at": "2026-01-05T11:04:55.117Z",
    "currency": "EUR",
    "customer_id": "cu_1757579182",
    "customer": {
        "id": "cu_1757579182",
        "name": "Joseph Doe",
        "email": "[email protected]",
        "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": "9996",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "SBM BANK (MAURITIUS) LTD",
            "card_issuing_country": "MAURITIUS",
            "card_isin": "454347",
            "card_extended_bin": null,
            "card_exp_month": "04",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Zurich",
            "country": "CH",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "8008",
            "state": "asd",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_0GZt6OGeGveHduNPIZ9u/merchant_1767611044/pay_0GZt6OGeGveHduNPIZ9u_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": "mollie_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "tr_Rv7Z6JUk4efZc2jDZ7LKJ",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "tr_Rv7Z6JUk4efZc2jDZ7LKJ",
    "payment_link": null,
    "profile_id": "pro_4OfHOaiqvXxuG1b51A5r",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_KHuZ2ExQ0Nk7JLKdJR5h",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2026-01-05T11:19:52.870Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "13.232.74.226",
        "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_rkcjppb82wF7wtiKKLQT",
    "network_transaction_id": null,
    "payment_method_status": "inactive",
    "updated": "2026-01-05T11:04:55.117Z",
    "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": "mdt_8Guc3hoYi4",
    "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_rkcjppb82wF7wtiKKLQT",
        "payment_method_status": "inactive",
        "psp_tokenization": false,
        "network_tokenization": false,
        "network_transaction_id": null,
        "is_eligible_for_mit_payment": false
    }
}

Psync after Redirect Response

{
    "payment_id": "pay_0GZt6OGeGveHduNPIZ9u",
    "merchant_id": "merchant_1767611044",
    "status": "failed",
    "amount": 100100,
    "net_amount": 100100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "mollie",
    "client_secret": "pay_0GZt6OGeGveHduNPIZ9u_secret_n24ey5tpJ2Cl6eMDx450",
    "created": "2026-01-05T11:04:52.870Z",
    "modified_at": "2026-01-05T11:05:12.856Z",
    "currency": "EUR",
    "customer_id": "cu_1757579182",
    "customer": {
        "id": "cu_1757579182",
        "name": "Joseph Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_0GZt6OGeGveHduNPIZ9u_1",
            "status": "failure",
            "amount": 100100,
            "order_tax_amount": null,
            "currency": "EUR",
            "connector": "mollie",
            "error_message": "The card number provided is invalid.",
            "payment_method": "card",
            "connector_transaction_id": "tr_Rv7Z6JUk4efZc2jDZ7LKJ",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2026-01-05T11:04:52.870Z",
            "modified_at": "2026-01-05T11:05:12.856Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": "invalid_card_number",
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": "tr_Rv7Z6JUk4efZc2jDZ7LKJ",
            "unified_code": "UE_9000",
            "unified_message": "Something went wrong",
            "client_source": null,
            "client_version": 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": "9996",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "SBM BANK (MAURITIUS) LTD",
            "card_issuing_country": "MAURITIUS",
            "card_isin": "454347",
            "card_extended_bin": null,
            "card_exp_month": "04",
            "card_exp_year": "2026",
            "card_holder_name": "John Smith",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "Zurich",
            "country": "CH",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "8008",
            "state": "asd",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": "invalid_card_number",
    "error_message": "The card number provided is invalid.",
    "unified_code": "UE_9000",
    "unified_message": "Something went wrong",
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": "mollie_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "tr_Rv7Z6JUk4efZc2jDZ7LKJ",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "tr_Rv7Z6JUk4efZc2jDZ7LKJ",
    "payment_link": null,
    "profile_id": "pro_4OfHOaiqvXxuG1b51A5r",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_KHuZ2ExQ0Nk7JLKdJR5h",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2026-01-05T11:19:52.870Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "13.232.74.226",
        "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_rkcjppb82wF7wtiKKLQT",
    "network_transaction_id": null,
    "payment_method_status": "inactive",
    "updated": "2026-01-05T11:05:12.856Z",
    "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,
    "whole_connector_response": null,
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": {
        "network_advice_code": 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_rkcjppb82wF7wtiKKLQT",
        "payment_method_status": "inactive",
        "psp_tokenization": false,
        "network_tokenization": false,
        "network_transaction_id": null,
        "is_eligible_for_mit_payment": false
    }
}
Screenshot 2026-01-09 at 11 39 15 AM Screenshot 2026-01-09 at 11 39 51 AM Screenshot 2026-01-09 at 11 39 59 AM Screenshot 2026-01-09 at 11 40 03 AM

few of the refund tests are giving 4xx : capture calls were in processing state
Screenshot 2026-01-09 at 11 48 45 AM
Screenshot 2026-01-09 at 11 48 52 AM
Screenshot 2026-01-09 at 11 49 00 AM
Screenshot 2026-01-09 at 11 49 08 AM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@awasthi21 awasthi21 requested a review from a team as a code owner January 5, 2026 10:37
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jan 5, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs  1% smaller

@awasthi21 awasthi21 changed the title fix/format feat(connector): Handle Mollie failed payments with error details from details object Jan 5, 2026
@awasthi21 awasthi21 changed the title feat(connector): Handle Mollie failed payments with error details from details object fix(connector): Handle Mollie failed payments with error details from details object Jan 5, 2026
@awasthi21 awasthi21 self-assigned this Jan 5, 2026

let error_code = failure_reason
.clone()
.unwrap_or_else(|| "PAYMENT_FAILED".to_string());
Copy link
Contributor

Choose a reason for hiding this comment

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

Use const no error code here

.unwrap_or_else(|| "PAYMENT_FAILED".to_string());
let error_message = failure_message
.clone()
.unwrap_or_else(|| "Payment failed".to_string());
Copy link
Contributor

Choose a reason for hiding this comment

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

Use const no error message here

@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

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

Files with missing lines Patch % Lines
...h_connectors/src/connectors/mollie/transformers.rs 0.00% 38 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10824   +/-   ##
=======================================
  Coverage        ?    6.32%           
=======================================
  Files           ?     1273           
  Lines           ?   322280           
  Branches        ?        0           
=======================================
  Hits            ?    20395           
  Misses          ?   301885           
  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.

deepanshu-iiitu
deepanshu-iiitu previously approved these changes Jan 7, 2026
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jan 13, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 13, 2026
@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 13, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 13, 2026
@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 14, 2026
Merged via the queue into main with commit 8429e48 Jan 14, 2026
26 of 27 checks passed
@likhinbopanna likhinbopanna deleted the fix/mollie branch January 14, 2026 06:47
siaass842 pushed a commit that referenced this pull request Jan 14, 2026
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