Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(payment_link): added expires_on in payment response (#3332)

Sahkal Poddar5ad3f8939afa
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index cac94a0732..06bd229586 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2277,6 +2277,11 @@ pub struct PaymentsResponse {
/// List of incremental authorizations happened to the payment
pub incremental_authorizations: Option<Vec<IncrementalAuthorizationResponse>>,
+ /// Date Time expiry of the payment
+ #[schema(example = "2022-09-10T10:11:12Z")]
+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
+ pub expires_on: Option<PrimitiveDateTime>,
+
/// Payment Fingerprint
pub fingerprint: Option<String>,
}
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index dffcff2359..5ab6bffc8e 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -709,6 +709,7 @@ where
.set_fingerprint(payment_intent.fingerprint_id)
.set_authorization_count(payment_intent.authorization_count)
.set_incremental_authorizations(incremental_authorizations_response)
+ .set_expires_on(payment_intent.session_expiry)
.to_owned(),
headers,
))
@@ -775,6 +776,7 @@ where
incremental_authorization_allowed: payment_intent.incremental_authorization_allowed,
authorization_count: payment_intent.authorization_count,
incremental_authorizations: incremental_authorizations_response,
+ expires_on: payment_intent.session_expiry,
..Default::default()
},
headers,
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index c50f687a18..466489e2f9 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -10948,6 +10948,13 @@
"description": "List of incremental authorizations happened to the payment",
"nullable": true
},
+ "expires_on": {
+ "type": "string",
+ "format": "date-time",
+ "description": "Date Time expiry of the payment",
+ "example": "2022-09-10T10:11:12Z",
+ "nullable": true
+ },
"fingerprint": {
"type": "string",
"description": "Payment Fingerprint",