Bug: [BUG] refused payment responses missing error codes and messages for Access Worldpay



### Bug Description

Worldpay refused payment responses are not populating error codes and error messages due to incorrect deserialization. The `WorldpayPaymentResponseFields` enum incorrectly deserializes refused responses as `AuthorizedResponse` instead of `RefusedResponse`, causing `refusalCode` and `refusalDescription` fields to be silently ignored.

### Expected Behavior

Refused payment responses should deserialize as `RefusedResponse` and populate error details in the final response.

### Actual Behavior

Refused payment responses deserialize as `AuthorizedResponse`, causing error codes and messages to be missing from the client response.

### Steps To Reproduce

1. Process a Worldpay payment that will be refused (e.g., insufficient funds)
2. Check the deserialized response structure in logs
3. Observe that it matches `AuthorizedResponse` instead of `RefusedResponse`
4. Note that `refusalDescription` and `refusalCode` are missing from the final response

### Context For The Bug

**Root Cause:** Enum variant ordering in `WorldpayPaymentResponseFields` causes `#[serde(untagged)]` to match `AuthorizedResponse` first since both response types share common fields.

**Sample Worldpay Response:**
```json
{
    "outcome": "refused",
    "refusalDescription": "Insufficient funds", 
    "refusalCode": "51",
    "paymentInstrument": {...},
    "riskFactors": [...]
}
```

**Current Enum Order:**
```rust
pub enum WorldpayPaymentResponseFields {
    AuthorizedResponse(Box<AuthorizedResponse>), // Matches first
    DDCResponse(DDCResponse),
    FraudHighRisk(FraudHighRiskResponse),
    RefusedResponse(RefusedResponse),            // Never reached
    ThreeDsChallenged(ThreeDsChallengedResponse),
}
```

**Fix:** Reorder enum variants to put `RefusedResponse` first and add `#[serde(deny_unknown_fields)]` to `AuthorizedResponse`.

### Environment

Are you using hyperswitch hosted version? Yes

### Have you spent some time checking if this bug has been raised before?

- [x] I checked and didn't find a similar issue

### Have you read the Contributing Guidelines?

- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

Yes, I am willing to submit a PR!

diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
index e7fa40c7114..b1a3a86a04f 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
@@ -18,11 +18,11 @@ pub struct WorldpayPaymentsResponse {
 #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
 #[serde(untagged)]
 pub enum WorldpayPaymentResponseFields {
-    AuthorizedResponse(Box<AuthorizedResponse>),
-    DDCResponse(DDCResponse),
-    FraudHighRisk(FraudHighRiskResponse),
     RefusedResponse(RefusedResponse),
+    DDCResponse(DDCResponse),
     ThreeDsChallenged(ThreeDsChallengedResponse),
+    FraudHighRisk(FraudHighRiskResponse),
+    AuthorizedResponse(Box<AuthorizedResponse>),
 }
 
 #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->

Fixes Worldpay refused payment responses not populating error codes and messages.

**Changes in this PR**
- Reorder `WorldpayPaymentResponseFields` enum variants to prioritize `RefusedResponse` over `AuthorizedResponse`

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
-->

Fixes enum deserialization issue where refused responses were incorrectly matched as `AuthorizedResponse` due to variant ordering, causing `refusalCode` and `refusalDescription` fields to be silently ignored.

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Things to be verified
- Failed transactions
- Successfull transactions
- Across 3DS and Non3DS payments

Acceptance criteria
- Failed transactions should ALWAYS have error code and error message
- Existing behavior should not be impacted

<details>
    <summary>1. Create a refused 3DS payment</summary>

cURL

    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_OcigA2cQZxBX9COYGBfHgAWOZUukSoY32EnWQfuFtRPpW5lmWhJSsxtQxmvFOr3K' \
        --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","capture_method":"automatic","authentication_type":"three_ds","setup_future_usage":"off_session","customer_id":"cus_HMf1El4VyvUOTQcyPabO","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_data":{"card":{"card_number":"4000000000002503","card_exp_month":"12","card_exp_year":"49","card_holder_name":"SOFT_DECLINED","card_cvc":"123"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"SG","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":60}'

Response

    {"payment_id":"pay_nf1wozrQrzByP9V4yeoD","merchant_id":"merchant_1752829595","status":"requires_customer_action","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":4500,"amount_received":null,"connector":"worldpay","client_secret":"pay_nf1wozrQrzByP9V4yeoD_secret_oPWhpyOQDgJxMryKsRGw","created":"2025-07-18T09:23:30.740Z","currency":"EUR","customer_id":"cus_HMf1El4VyvUOTQcyPabO","customer":{"id":"cus_HMf1El4VyvUOTQcyPabO","name":"John Nether","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"2503","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"49","card_holder_name":"SOFT_DECLINED","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"John Nether","phone":"6168205362","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_nf1wozrQrzByP9V4yeoD/merchant_1752829595/pay_nf1wozrQrzByP9V4yeoD_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":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,"ephemeral_key":{"customer_id":"cus_HMf1El4VyvUOTQcyPabO","created_at":1752830610,"expires":1752834210,"secret":"epk_94ed61cae43c47cfa3812753e04b645a"},"manual_retry_allowed":null,"connector_transaction_id":"eyJrIjoxLCJkIjoiNWwwQkpkeFd4UXA2dUw0b2dHRWlaVzlUUzh0aEhIL0F2WVFJN2ROYnZWNGl3V1R3UXYwb0tLYTdJQm1hY3hQdiJ9_2","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"06ecb837-d1ff-4baa-b608-18d2e56074f0","payment_link":null,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_21oWs6dvHalGcN2EkEzx","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-18T09:24:30.740Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-07-18T09:23:32.148Z","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":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}

Open and complete the payment
Fetch payment

cURL

    curl --location --request GET 'http://localhost:8080/payments/pay_nf1wozrQrzByP9V4yeoD?force_sync=true' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_OcigA2cQZxBX9COYGBfHgAWOZUukSoY32EnWQfuFtRPpW5lmWhJSsxtQxmvFOr3K'

Response

    {"payment_id":"pay_nf1wozrQrzByP9V4yeoD","merchant_id":"merchant_1752829595","status":"failed","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"worldpay","client_secret":"pay_nf1wozrQrzByP9V4yeoD_secret_oPWhpyOQDgJxMryKsRGw","created":"2025-07-18T09:23:30.740Z","currency":"EUR","customer_id":"cus_HMf1El4VyvUOTQcyPabO","customer":{"id":"cus_HMf1El4VyvUOTQcyPabO","name":"John Nether","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"2503","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"49","card_holder_name":"SOFT_DECLINED","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"John Nether","phone":"6168205362","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":"65","error_message":"Authentication requested","unified_code":"UE_9000","unified_message":"Something went wrong","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,"ephemeral_key":null,"manual_retry_allowed":true,"connector_transaction_id":"5d0040f1-bb19-4ac5-8baa-9f083ce53cb0","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"62043e75-b414-4d8e-aa4d-5970a990152b","payment_link":null,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_21oWs6dvHalGcN2EkEzx","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-18T09:24:30.740Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":"pm_us4PtNRsIDqN5ABOVj7J","payment_method_status":"inactive","updated":"2025-07-18T09:24:31.424Z","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":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":"65","issuer_error_message":"Authentication requested","is_iframe_redirection_enabled":null,"whole_connector_response":null}

</details>

<details>
    <summary>2. Create a refused Non3DS payment</summary>

cURL

    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_OcigA2cQZxBX9COYGBfHgAWOZUukSoY32EnWQfuFtRPpW5lmWhJSsxtQxmvFOr3K' \
        --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","capture_method":"automatic","authentication_type":"no_three_ds","setup_future_usage":"off_session","customer_id":"cus_HMf1El4VyvUOTQcyPabO","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_data":{"card":{"card_number":"4000000000002503","card_exp_month":"12","card_exp_year":"49","card_holder_name":"SOFT_DECLINED","card_cvc":"123"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"SG","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":60}'

Response

    {"payment_id":"pay_7xBftAitD04sY2GZJ8Z2","merchant_id":"merchant_1752829595","status":"failed","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"worldpay","client_secret":"pay_7xBftAitD04sY2GZJ8Z2_secret_hKtavE5ciTrVajUHJjZc","created":"2025-07-18T09:25:11.617Z","currency":"EUR","customer_id":"cus_HMf1El4VyvUOTQcyPabO","customer":{"id":"cus_HMf1El4VyvUOTQcyPabO","name":"John Nether","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"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":"2503","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"49","card_holder_name":"SOFT_DECLINED","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"John Nether","phone":"6168205362","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":"65","error_message":"Authentication requested","unified_code":"UE_9000","unified_message":"Something went wrong","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,"ephemeral_key":{"customer_id":"cus_HMf1El4VyvUOTQcyPabO","created_at":1752830711,"expires":1752834311,"secret":"epk_89925864b5a44ace803a9c3bfd9d3a5a"},"manual_retry_allowed":true,"connector_transaction_id":"6ec4e6b4-b2cc-4816-b8de-d682c3799560","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":null,"payment_link":null,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_21oWs6dvHalGcN2EkEzx","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-18T09:26:11.617Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-07-18T09:25:12.302Z","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":null,"card_discovery":"manual","force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":"65","issuer_error_message":"Authentication requested","is_iframe_redirection_enabled":null,"whole_connector_response":null}

</details>

<details>
    <summary>3. Create a successful Non3DS payment</summary>

cURL

    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_OcigA2cQZxBX9COYGBfHgAWOZUukSoY32EnWQfuFtRPpW5lmWhJSsxtQxmvFOr3K' \
        --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","capture_method":"automatic","authentication_type":"no_three_ds","setup_future_usage":"off_session","customer_id":"cus_HMf1El4VyvUOTQcyPabO","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_data":{"card":{"card_number":"4000000000002503","card_exp_month":"12","card_exp_year":"49","card_cvc":"123"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"SG","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":60}'

Response

    {"payment_id":"pay_fvSgG7vbmiancVdM7egW","merchant_id":"merchant_1752829595","status":"succeeded","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":4500,"connector":"worldpay","client_secret":"pay_fvSgG7vbmiancVdM7egW_secret_Tf1f2y1DQin8y7nQHp7y","created":"2025-07-18T09:27:05.084Z","currency":"EUR","customer_id":"cus_HMf1El4VyvUOTQcyPabO","customer":{"id":"cus_HMf1El4VyvUOTQcyPabO","name":"John Nether","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"2503","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"49","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"John Nether","phone":"6168205362","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":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_HMf1El4VyvUOTQcyPabO","created_at":1752830825,"expires":1752834425,"secret":"epk_cb4c1f4042ab432fa0cc74d74ad1bf7f"},"manual_retry_allowed":false,"connector_transaction_id":"eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNi4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99HBj426bdlJXCgTskLhNY5Ml0rXtEPNSyl2cbsnj4b2DZwiqL3HuQDxN:neVn+zbpclW4Z+fnZKMutoUGX3m1:mly6gHHs10vDfRKiqHMymO64+yqY47+sAF1kkNrL23Bs3QiAabaRzXyjYDjJ+U38V81VQ0:KjdVX14V+Q12mM8Z5iKyQs9iW3YxEeAqFJXOYrW66yFNGsWi87tzkRENLR8ix3NBfHPU2KlzlyTrmR0mwasA4zRNlfY:bG7Aaa:GaUgn8jvCNhmdUlN6uDEfAu3+Gpx8cadeYO0VLI6Wl9IlMW1jd8Xy+vVmj3Q+75eENcq03E2danxlr+Vv+81CEF","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"0d52ed33-52a5-4180-a8c0-a594dfce4250","payment_link":null,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_21oWs6dvHalGcN2EkEzx","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-18T09:28:05.084Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-07-18T09:27:07.450Z","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":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}

</details>

<details>
    <summary>4. Create a successful 3DS payment</summary>

cURL

    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_OcigA2cQZxBX9COYGBfHgAWOZUukSoY32EnWQfuFtRPpW5lmWhJSsxtQxmvFOr3K' \
        --data-raw '{"amount":4500,"currency":"EUR","confirm":true,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","capture_method":"automatic","authentication_type":"three_ds","setup_future_usage":"off_session","customer_id":"cus_HMf1El4VyvUOTQcyPabO","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_data":{"card":{"card_number":"4000000000002503","card_exp_month":"12","card_exp_year":"49","card_cvc":"123"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","zip":"94122","country":"SG","first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"session_expiry":60}'

Response

    {"payment_id":"pay_B0btcvBLNpPhJ1s7NEGc","merchant_id":"merchant_1752829595","status":"requires_customer_action","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":4500,"amount_received":null,"connector":"worldpay","client_secret":"pay_B0btcvBLNpPhJ1s7NEGc_secret_FoMuFj3e5H5vxBtXLOJ6","created":"2025-07-18T09:27:55.106Z","currency":"EUR","customer_id":"cus_HMf1El4VyvUOTQcyPabO","customer":{"id":"cus_HMf1El4VyvUOTQcyPabO","name":"John Nether","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"2503","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"49","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"John Nether","phone":"6168205362","return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay_B0btcvBLNpPhJ1s7NEGc/merchant_1752829595/pay_B0btcvBLNpPhJ1s7NEGc_1"},"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":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,"ephemeral_key":{"customer_id":"cus_HMf1El4VyvUOTQcyPabO","created_at":1752830875,"expires":1752834475,"secret":"epk_0ca1d0b0a4324a30b287522647a4e1e7"},"manual_retry_allowed":null,"connector_transaction_id":"eyJrIjoxLCJkIjoiMjVnYzlzNUVaWU94M1hPaFYvbXUwT21hRmZjMFNmZWQvR0pnRGxaWU5vc2l3V1R3UXYwb0tLYTdJQm1hY3hQdiJ9_2","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"187b8a5d-10e8-4711-8f61-321d497174c5","payment_link":null,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_21oWs6dvHalGcN2EkEzx","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-18T09:28:55.106Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-07-18T09:27:55.619Z","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":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}

Open and complete payment
Fetch payment

cURL

    curl --location --request GET 'http://localhost:8080/payments/pay_B0btcvBLNpPhJ1s7NEGc?force_sync=true' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_OcigA2cQZxBX9COYGBfHgAWOZUukSoY32EnWQfuFtRPpW5lmWhJSsxtQxmvFOr3K'

Response

    {"payment_id":"pay_B0btcvBLNpPhJ1s7NEGc","merchant_id":"merchant_1752829595","status":"succeeded","amount":4500,"net_amount":4500,"shipping_cost":null,"amount_capturable":0,"amount_received":4500,"connector":"worldpay","client_secret":"pay_B0btcvBLNpPhJ1s7NEGc_secret_FoMuFj3e5H5vxBtXLOJ6","created":"2025-07-18T09:27:55.106Z","currency":"EUR","customer_id":"cus_HMf1El4VyvUOTQcyPabO","customer":{"id":"cus_HMf1El4VyvUOTQcyPabO","name":"John Nether","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"2503","card_type":null,"card_network":null,"card_issuer":null,"card_issuing_country":null,"card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"49","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"SG","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":null,"first_name":"joseph","last_name":"Doe"},"phone":{"number":"8056594427","country_code":"+91"},"email":"guest@example.com"},"order_details":null,"email":"abc@example.com","name":"John Nether","phone":"6168205362","return_url":"https://google.com/","authentication_type":"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":null,"connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"3749d357-0130-498e-8c74-6a8e2069fa55","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"3749d357-0130-498e-8c74-6a8e2069fa55","payment_link":null,"profile_id":"pro_lIwQy04ZJdIxAZHNj6cf","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_21oWs6dvHalGcN2EkEzx","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-07-18T09:28:55.106Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":"pm_fu8PQqH8zNwUxq5cyixG","payment_method_status":"active","updated":"2025-07-18T09:28:08.906Z","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":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}

</details>


## Checklist
<!-- Put an `x` in the boxes that apply -->

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