Skip to content
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
efc84c3
feat(gsm): add standardised error fields to GSM models and database s…
ayush22667 Dec 10, 2025
34ffbad
feat(gsm): add StandardisedCode enum for error handling in API specif…
ayush22667 Dec 10, 2025
9ba8345
feat(gsm): add StandardisedCode enum for standardized error handling …
ayush22667 Dec 10, 2025
c59775a
feat(gsm): standardize error code naming for wallet and token configu…
ayush22667 Dec 10, 2025
900c65b
feat(gsm): standardize error codes to snake_case in API specification…
ayush22667 Dec 11, 2025
6e9b324
feat(gsm): increase max length for description and user guidance mess…
ayush22667 Dec 11, 2025
460921f
feat(gsm): enhance descriptions and user guidance messages for error …
ayush22667 Dec 11, 2025
c565e52
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Dec 11, 2025
8a15baf
feat(gsm): standardize error code naming for unknown errors in API sp…
ayush22667 Dec 11, 2025
364c67c
feat(gsm): enhance descriptions and guidance for standardised error c…
ayush22667 Dec 11, 2025
7f77448
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Dec 11, 2025
695c9d6
chore: run formatter
hyperswitch-bot[bot] Dec 11, 2025
6a4c7ba
feat(payment): Sort StandardisedCode enum variants alphabetically
ayush22667 Dec 12, 2025
99fb741
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Dec 12, 2025
75554e6
feat(payments): add structured error details to payment attempts
ayush22667 Dec 12, 2025
8b1f761
Merge branch 'main' of https://github.com/juspay/hyperswitch into fea…
ayush22667 Dec 12, 2025
ceb9a19
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Dec 12, 2025
678e649
feat(payment): update error_details field to use Box<Option<ErrorDeta…
ayush22667 Dec 12, 2025
e191ef0
Merge branch 'feat/error-details-struct' of https://github.com/juspay…
ayush22667 Dec 12, 2025
7e9615a
Merge branch 'feat/gsm-standardised-codes' into feat/error-details-st…
ayush22667 Dec 12, 2025
79ddb6c
Merge branch 'main' into feat/gsm-standardised-codes
ayush22667 Dec 12, 2025
6dc94b9
Merge branch 'feat/gsm-standardised-codes' into feat/error-details-st…
ayush22667 Dec 12, 2025
fb8e5b4
Merge branch 'main' into feat/error-details-struct
ayush22667 Dec 16, 2025
b43afd0
Merge branch 'main' into feat/error-details-struct
ayush22667 Dec 16, 2025
72f8109
feat(migrations): remove error_details column from payment_attempt an…
ayush22667 Dec 16, 2025
dfd5935
Merge branch 'feat/error-details-struct' of https://github.com/juspay…
ayush22667 Dec 16, 2025
90c37fb
feat(payment_attempt): add error_details field to PaymentAttempt and …
ayush22667 Dec 17, 2025
a547e78
feat(payment_attempt): replace GsmDecision with Retry enum in Unified…
ayush22667 Dec 18, 2025
84b866a
Merge branch 'main' into feat/error-details-struct
ayush22667 Dec 18, 2025
f1cfdaf
feat(enums): rename Retry enum to RecommendedAction in common_enums
ayush22667 Dec 22, 2025
b0b8bdf
Merge branch 'feat/error-details-struct' of https://github.com/juspay…
ayush22667 Dec 22, 2025
eeb93d5
feat(payments): add error details for PaymentsResponse
ayush22667 Dec 29, 2025
d50b509
chore: run formatter
hyperswitch-bot[bot] Dec 29, 2025
f06e71b
Merge branch 'main' of https://github.com/juspay/hyperswitch into fea…
ayush22667 Dec 29, 2025
7024934
Merge branch 'main' into feat/error-details-struct
ayush22667 Dec 29, 2025
a129346
feat(api): add error_details field to PaymentError schema
ayush22667 Dec 29, 2025
10201d2
Merge branch 'feat/error-details-struct' into feat/add-error-details-…
ayush22667 Dec 29, 2025
0d4ab50
feat(api): add smithy type
ayush22667 Dec 29, 2025
0078268
Merge branch 'feat/add-error-details-response' of https://github.com/…
ayush22667 Dec 29, 2025
d12d3a4
feat(api): add detailed error schemas for payment responses
ayush22667 Dec 29, 2025
847f17c
feat(api): add error_details field
ayush22667 Dec 29, 2025
71aa397
feat(api): refactor error details mapping for improved clarity
ayush22667 Dec 30, 2025
3fcaece
chore: run formatter
hyperswitch-bot[bot] Dec 30, 2025
243cb65
Update payments api models
ayush22667 Dec 30, 2025
0d4eb36
Merge branch 'main' into feat/add-error-details-response
ayush22667 Dec 30, 2025
ae408bd
refactor: Remove error_details field from PaymentAttempt conversion
ayush22667 Dec 30, 2025
c9a11b7
feat(errors): enhance error details structure with UnifiedCode and fo…
ayush22667 Jan 5, 2026
d715454
feat(errors): update error category to use UnifiedCode reference
ayush22667 Jan 5, 2026
09b0912
feat(errors): add UnifiedCode enum to error details response
ayush22667 Jan 5, 2026
12e19b7
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Jan 5, 2026
18a63a0
feat(errors): change error category type from UnifiedCode to String i…
ayush22667 Jan 7, 2026
55f0f48
Merge branch 'main' of https://github.com/juspay/hyperswitch into fea…
ayush22667 Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 187 additions & 0 deletions api-reference/v1/openapi_spec_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -9065,6 +9065,51 @@
}
}
},
"ApiConnectorErrorDetails": {
"type": "object",
"description": "Error details from the payment connector",
"properties": {
"code": {
"type": "string",
"description": "Connector-specific error code",
"nullable": true
},
"message": {
"type": "string",
"description": "Connector-specific error message",
"nullable": true
},
"reason": {
"type": "string",
"description": "Additional error reason/details",
"nullable": true
}
}
},
"ApiIssuerErrorDetails": {
"type": "object",
"description": "Error details from the card issuer",
"properties": {
"code": {
"type": "string",
"description": "Error code from the issuer",
"nullable": true
},
"message": {
"type": "string",
"description": "Error message from the issuer",
"nullable": true
},
"network_details": {
"allOf": [
{
"$ref": "#/components/schemas/ApiNetworkErrorDetails"
}
],
"nullable": true
}
}
},
"ApiKeyExpiration": {
"oneOf": [
{
Expand All @@ -9079,6 +9124,75 @@
}
]
},
"ApiNetworkErrorDetails": {
"type": "object",
"description": "Network-specific error details (e.g., Visa, Mastercard)",
"properties": {
"name": {
"allOf": [
{
"$ref": "#/components/schemas/CardNetwork"
}
],
"nullable": true
},
"advice_code": {
"type": "string",
"description": "Network advice code",
"nullable": true
},
"advice_message": {
"type": "string",
"description": "Network advice message",
"nullable": true
}
}
},
"ApiUnifiedErrorDetails": {
"type": "object",
"description": "Unified error details standardized across all payment connectors",
"properties": {
"category": {
"allOf": [
{
"$ref": "#/components/schemas/UnifiedCode"
}
],
"nullable": true
},
"message": {
"type": "string",
"description": "Human-readable error message",
"nullable": true
},
"standardised_code": {
"allOf": [
{
"$ref": "#/components/schemas/StandardisedCode"
}
],
"nullable": true
},
"description": {
"type": "string",
"description": "Detailed description of the error",
"nullable": true
},
"user_guidance_message": {
"type": "string",
"description": "User-friendly guidance message",
"nullable": true
},
"recommended_action": {
"allOf": [
{
"$ref": "#/components/schemas/RecommendedAction"
}
],
"nullable": true
}
}
},
"ApplePayAddressParameters": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -24715,6 +24829,36 @@
}
}
},
"PaymentErrorDetails": {
"type": "object",
"description": "Complete error details for V1 PaymentsResponse containing unified, issuer, and connector-level error information.",
"properties": {
"unified_details": {
"allOf": [
{
"$ref": "#/components/schemas/ApiUnifiedErrorDetails"
}
],
"nullable": true
},
"issuer_details": {
"allOf": [
{
"$ref": "#/components/schemas/ApiIssuerErrorDetails"
}
],
"nullable": true
},
"connector_details": {
"allOf": [
{
"$ref": "#/components/schemas/ApiConnectorErrorDetails"
}
],
"nullable": true
}
}
},
"PaymentExperience": {
"type": "string",
"description": "To indicate the type of payment experience that the customer would go through",
Expand Down Expand Up @@ -28263,6 +28407,14 @@
"example": "Failed while verifying the card",
"nullable": true
},
"error_details": {
"allOf": [
{
"$ref": "#/components/schemas/PaymentErrorDetails"
}
],
"nullable": true
},
"payment_experience": {
"allOf": [
{
Expand Down Expand Up @@ -29853,6 +30005,14 @@
"description": "error message unified across the connectors is received here if there was an error while calling connector",
"nullable": true
},
"error_details": {
"allOf": [
{
"$ref": "#/components/schemas/PaymentErrorDetails"
}
],
"nullable": true
},
"payment_experience": {
"allOf": [
{
Expand Down Expand Up @@ -33952,6 +34112,23 @@
}
}
},
"RecommendedAction": {
"type": "string",
"enum": [
"do_not_retry",
"retry_after10_days",
"retry_after1_hour",
"retry_after24_hours",
"retry_after2_days",
"retry_after4_days",
"retry_after6_days",
"retry_after8_days",
"retry_after_instrument_update",
"retry_later",
"retry_with_different_payment_method_data",
"stop_recurring"
]
},
"ReconStatus": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -37625,6 +37802,16 @@
"delete"
]
},
"UnifiedCode": {
"type": "string",
"enum": [
"UE_1000",
"UE_2000",
"UE_3000",
"UE_4000",
"UE_9000"
]
},
"UnpaidInvoicesHandling": {
"type": "string",
"enum": [
Expand Down
10 changes: 10 additions & 0 deletions api-reference/v2/openapi_spec_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -27608,6 +27608,16 @@
"journey"
]
},
"UnifiedCode": {
"type": "string",
"enum": [
"UE_1000",
"UE_2000",
"UE_3000",
"UE_4000",
"UE_9000"
]
},
"UpdateActiveAttempt": {
"oneOf": [
{
Expand Down
75 changes: 75 additions & 0 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7269,6 +7269,11 @@ pub struct PaymentsResponse {
#[smithy(value_type = "Option<String>")]
pub unified_message: Option<String>,

/// Complete error details containing unified, issuer, and connector-level error information.
#[schema(value_type = Option<PaymentErrorDetails>)]
#[smithy(value_type = "Option<PaymentErrorDetails>")]
pub error_details: Option<PaymentErrorDetails>,

/// Describes the type of payment flow experienced by the customer (e.g., 'redirect_to_url', 'invoke_sdk', 'display_qr_code').
#[schema(value_type = Option<PaymentExperience>, example = "redirect_to_url")]
#[smithy(value_type = "Option<PaymentExperience>")]
Expand Down Expand Up @@ -8183,6 +8188,76 @@ pub struct PaymentsStatusRequest {
pub return_raw_connector_response: Option<bool>,
}

/// Complete error details for V1 PaymentsResponse containing unified, issuer, and connector-level error information.
#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, ToSchema)]
pub struct PaymentErrorDetails {
/// Unified error details (standardized across connectors)
pub unified_details: Option<ApiUnifiedErrorDetails>,
/// Error details from the card issuer
pub issuer_details: Option<ApiIssuerErrorDetails>,
/// Error details from the payment connector
pub connector_details: Option<ApiConnectorErrorDetails>,
}

/// Unified error details standardized across all payment connectors
#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, ToSchema)]
pub struct ApiUnifiedErrorDetails {
/// Error category
#[schema(value_type = Option<UnifiedCode>)]
pub category: Option<api_enums::UnifiedCode>,
/// Human-readable error message
pub message: Option<String>,
/// Standardised error code
#[schema(value_type = Option<StandardisedCode>)]
pub standardised_code: Option<api_enums::StandardisedCode>,
/// Detailed description of the error
pub description: Option<String>,
/// User-friendly guidance message
pub user_guidance_message: Option<String>,
/// Recommended action (e.g., "do_not_retry", "retry_later")
#[schema(value_type = Option<RecommendedAction>)]
pub recommended_action: Option<api_enums::RecommendedAction>,
}

/// Error details from the card issuer
#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, ToSchema)]
pub struct ApiIssuerErrorDetails {
/// Error code from the issuer
pub code: Option<String>,
/// Error message from the issuer
pub message: Option<String>,
/// Network-specific error details
pub network_details: Option<ApiNetworkErrorDetails>,
}

/// Network-specific error details (e.g., Visa, Mastercard)
#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, ToSchema)]
pub struct ApiNetworkErrorDetails {
/// Card network (e.g., Visa, Mastercard)
#[schema(value_type = Option<CardNetwork>)]
pub name: Option<api_enums::CardNetwork>,
/// Network advice code
pub advice_code: Option<String>,
/// Network advice message
pub advice_message: Option<String>,
}

/// Error details from the payment connector
#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, ToSchema)]
pub struct ApiConnectorErrorDetails {
/// Connector-specific error code
pub code: Option<String>,
/// Connector-specific error message
pub message: Option<String>,
/// Additional error reason/details
pub reason: Option<String>,
}

/// Error details for the payment
#[cfg(feature = "v2")]
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, ToSchema)]
Expand Down
30 changes: 30 additions & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9693,6 +9693,36 @@ impl ErrorCategory {
}
}

#[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
PartialEq,
serde::Serialize,
serde::Deserialize,
strum::Display,
strum::EnumString,
ToSchema,
PartialOrd,
Ord,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[allow(non_camel_case_types)]
pub enum UnifiedCode {
/// Customer Error - Issue with payment method details
UE_1000,
/// Connector Declines - Issue with Configurations
UE_2000,
/// Connector Error - Technical issue with PSP
UE_3000,
/// Integration Error - Issue in the integration
UE_4000,
/// Others - Something went wrong
UE_9000,
}

#[derive(
Clone,
Debug,
Expand Down
2 changes: 1 addition & 1 deletion crates/diesel_models/src/payment_attempt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub struct ErrorDetails {

#[derive(Clone, Default, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]
pub struct UnifiedErrorDetails {
pub category: Option<String>,
pub category: Option<storage_enums::UnifiedCode>,
pub message: Option<String>,
pub standardised_code: Option<storage_enums::StandardisedCode>,
pub description: Option<String>,
Expand Down
Loading
Loading