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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(router): add api models and openapi changes for payments submit eligibility api (#9568)
Sai Harsha Vardhandea34c45c076
diff --git a/api-reference/docs.json b/api-reference/docs.jsonindex 46531c95c3..b6f778eb08 100644--- a/api-reference/docs.json+++ b/api-reference/docs.json@@ -50,7 +50,8 @@"v1/payments/payments--list","v1/payments/payments--external-3ds-authentication","v1/payments/payments--complete-authorize",- "v1/payments/payments--update-metadata"+ "v1/payments/payments--update-metadata",+ "v1/payments/payments--submit-eligibility-data"]},{diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex c9e8b57477..d1a364b438 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -1616,6 +1616,63 @@]}},+ "/payments/{payment_id}/eligibility": {+ "post": {+ "tags": [+ "Payments"+ ],+ "summary": "Payments - Submit Eligibility Data",+ "operationId": "Submit Eligibility data for a Payment",+ "parameters": [+ {+ "name": "payment_id",+ "in": "path",+ "description": "The identifier for payment",+ "required": true,+ "schema": {+ "type": "string"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/PaymentsEligibilityRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "Eligbility submit is successful",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/PaymentsEligibilityResponse"+ }+ }+ }+ },+ "400": {+ "description": "Bad Request",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GenericErrorResponseOpenApi"+ }+ }+ }+ }+ },+ "security": [+ {+ "publishable_key": []+ }+ ]+ }+ },"/relay": {"post": {"tags": [@@ -19418,7 +19475,8 @@"post_session_tokens","confirm","sync",- "complete_authorize"+ "complete_authorize",+ "await_merchant_callback"]},"NextActionData": {@@ -24371,6 +24429,48 @@}}},+ "PaymentsEligibilityRequest": {+ "type": "object",+ "required": [+ "client_secret",+ "payment_method_type",+ "payment_method_data"+ ],+ "properties": {+ "client_secret": {+ "type": "string",+ "description": "Token used for client side verification",+ "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo"+ },+ "payment_method_type": {+ "$ref": "#/components/schemas/PaymentMethod"+ },+ "payment_method_subtype": {+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentMethodType"+ }+ ],+ "nullable": true+ },+ "payment_method_data": {+ "$ref": "#/components/schemas/PaymentMethodDataRequest"+ }+ }+ },+ "PaymentsEligibilityResponse": {+ "type": "object",+ "properties": {+ "sdk_next_action": {+ "allOf": [+ {+ "$ref": "#/components/schemas/SdkNextAction"+ }+ ],+ "nullable": true+ }+ }+ },"PaymentsExternalAuthenticationRequest": {"type": "object","required": [diff --git a/api-reference/v1/payments/payments--submit-eligibility-data.mdx b/api-reference/v1/payments/payments--submit-eligibility-data.mdxnew file mode 100644index 0000000000..27ae9fb05f--- /dev/null+++ b/api-reference/v1/payments/payments--submit-eligibility-data.mdx@@ -0,0 +1,3 @@+---+openapi: post /payments/{payment_id}/eligibility+---\ No newline at end of filediff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 27e70e9ee9..50d307830b 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -15325,7 +15325,8 @@"post_session_tokens","confirm","sync",- "complete_authorize"+ "complete_authorize",+ "await_merchant_callback"]},"NextActionData": {diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 840cdf7a1d..993fa3f077 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -8004,6 +8004,8 @@ pub enum NextActionCall {Sync,/// The next action call is Complete AuthorizeCompleteAuthorize,+ /// The next action is to await for a merchant callback+ AwaitMerchantCallback,}#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]@@ -9272,6 +9274,26 @@ pub struct ClickToPaySessionResponse {pub dpa_client_id: Option<String>,}+#[derive(Debug, serde::Deserialize, Clone, ToSchema)]+pub struct PaymentsEligibilityRequest {+ /// Token used for client side verification+ #[schema(value_type = String, example = "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo")]+ pub client_secret: Secret<String>,+ /// The payment method to be used for the payment+ #[schema(value_type = PaymentMethod, example = "wallet")]+ pub payment_method_type: api_enums::PaymentMethod,+ /// The payment method type to be used for the payment+ #[schema(value_type = Option<PaymentMethodType>)]+ pub payment_method_subtype: Option<api_enums::PaymentMethodType>,+ /// The payment instrument data to be used for the payment+ pub payment_method_data: PaymentMethodDataRequest,+}++#[derive(Debug, serde::Serialize, Clone, ToSchema)]+pub struct PaymentsEligibilityResponse {+ pub sdk_next_action: Option<SdkNextAction>,+}+#[cfg(feature = "v1")]#[cfg(test)]mod payments_request_api_contract {diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex e20f64b6f3..6ef0b64125 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -86,6 +86,7 @@ Never share your secret api keys. Keep them guarded and secure.routes::payments::payments_complete_authorize,routes::payments::payments_post_session_tokens,routes::payments::payments_update_metadata,+ routes::payments::payments_submit_eligibility,// Routes for relayroutes::relay::relay,@@ -490,6 +491,9 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payments::PaymentsConfirmRequest,api_models::payments::PaymentsResponse,api_models::payments::PaymentsCreateResponseOpenApi,+ api_models::payments::PaymentsEligibilityRequest,+ api_models::payments::PaymentsEligibilityResponse,+ api_models::payments::PaymentsCreateResponseOpenApi,api_models::errors::types::GenericErrorResponseOpenApi,api_models::payments::PaymentRetrieveBody,api_models::payments::PaymentsRetrieveRequest,diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rsindex 026f4d6cc0..dfa14ffb7b 100644--- a/crates/openapi/src/routes/payments.rs+++ b/crates/openapi/src/routes/payments.rs@@ -1012,6 +1012,24 @@ pub fn payments_post_session_tokens() {})]pub fn payments_update_metadata() {}+/// Payments - Submit Eligibility Data+#[utoipa::path(+ post,+ path = "/payments/{payment_id}/eligibility",+ params(+ ("payment_id" = String, Path, description = "The identifier for payment")+ ),+ request_body=PaymentsEligibilityRequest,+ responses(+ (status = 200, description = "Eligbility submit is successful", body = PaymentsEligibilityResponse),+ (status = 400, description = "Bad Request", body = GenericErrorResponseOpenApi)+ ),+ tag = "Payments",+ operation_id = "Submit Eligibility data for a Payment",+ security(("publishable_key" = []))+)]+pub fn payments_submit_eligibility() {}+/// Payments - Create Intent////// **Creates a payment intent object when amount_details are passed.**