diff --git a/crates/api_models/src/cards.rs b/crates/api_models/src/cards.rs deleted file mode 100644 index 8b13789179..0000000000 --- a/crates/api_models/src/cards.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/api_models/src/cards_info.rs b/crates/api_models/src/cards_info.rs new file mode 100644 index 0000000000..552f7f54b1 --- /dev/null +++ b/crates/api_models/src/cards_info.rs @@ -0,0 +1,31 @@ +use std::fmt::Debug; + +use utoipa::ToSchema; + +#[derive(serde::Deserialize, ToSchema)] +pub struct CardsInfoRequestParams { + #[schema(example = "pay_OSERgeV9qAy7tlK7aKpc_secret_TuDUoh11Msxh12sXn3Yp")] + pub client_secret: Option, +} + +#[derive(serde::Deserialize, Debug)] +pub struct CardsInfoRequest { + pub client_secret: Option, + pub card_iin: String, +} + +#[derive(serde::Serialize, Debug, ToSchema)] +pub struct CardInfoResponse { + #[schema(example = "374431")] + pub card_iin: String, + #[schema(example = "AMEX")] + pub card_issuer: Option, + #[schema(example = "AMEX")] + pub card_network: Option, + #[schema(example = "CREDIT")] + pub card_type: Option, + #[schema(example = "CLASSIC")] + pub card_sub_type: Option, + #[schema(example = "INDIA")] + pub card_issuing_country: Option, +} diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs index 18d607d715..a08b6fd620 100644 --- a/crates/api_models/src/lib.rs +++ b/crates/api_models/src/lib.rs @@ -2,7 +2,7 @@ pub mod admin; pub mod api_keys; pub mod bank_accounts; -pub mod cards; +pub mod cards_info; pub mod customers; pub mod disputes; pub mod enums; diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs index 144c14e273..b91bc6497b 100644 --- a/crates/router/src/compatibility/stripe/errors.rs +++ b/crates/router/src/compatibility/stripe/errors.rs @@ -347,7 +347,9 @@ impl From for StripeErrorCode { | errors::ApiErrorResponse::GenericUnauthorized { .. } | errors::ApiErrorResponse::InvalidEphemeralKey => Self::Unauthorized, errors::ApiErrorResponse::InvalidRequestUrl - | errors::ApiErrorResponse::InvalidHttpMethod => Self::InvalidRequestUrl, + | errors::ApiErrorResponse::InvalidHttpMethod + | errors::ApiErrorResponse::InvalidCardIin + | errors::ApiErrorResponse::InvalidCardIinLength => Self::InvalidRequestUrl, errors::ApiErrorResponse::MissingRequiredField { field_name } => { Self::ParameterMissing { field_name, diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs index 629838deb1..0ae37d567c 100644 --- a/crates/router/src/core.rs +++ b/crates/router/src/core.rs @@ -1,5 +1,6 @@ pub mod admin; pub mod api_keys; +pub mod cards_info; pub mod configs; pub mod customers; pub mod errors; diff --git a/crates/router/src/core/cards_info.rs b/crates/router/src/core/cards_info.rs new file mode 100644 index 0000000000..c7c8cacbe1 --- /dev/null +++ b/crates/router/src/core/cards_info.rs @@ -0,0 +1,49 @@ +use common_utils::fp_utils::when; +use error_stack::{report, ResultExt}; +use router_env::{instrument, tracing}; + +use crate::{ + core::{ + errors::{self, RouterResponse}, + payments::helpers, + }, + routes, + services::ApplicationResponse, + types::{storage, transformers::ForeignFrom}, +}; + +fn verify_iin_length(card_iin: &str) -> Result<(), errors::ApiErrorResponse> { + let is_bin_length_in_range = card_iin.len() == 6 || card_iin.len() == 8; + when(!is_bin_length_in_range, || { + Err(errors::ApiErrorResponse::InvalidCardIinLength) + }) +} + +#[instrument(skip_all)] +pub async fn retrieve_card_info( + state: &routes::AppState, + merchant_account: storage::MerchantAccount, + request: api_models::cards_info::CardsInfoRequest, +) -> RouterResponse { + let db = &*state.store; + + verify_iin_length(&request.card_iin)?; + helpers::verify_client_secret( + db, + merchant_account.storage_scheme, + request.client_secret, + &merchant_account.merchant_id, + ) + .await?; + + let card_info = db + .get_card_info(&request.card_iin) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to retrieve card information")? + .ok_or(report!(errors::ApiErrorResponse::InvalidCardIin))?; + + Ok(ApplicationResponse::Json( + api_models::cards_info::CardInfoResponse::foreign_from(card_info), + )) +} diff --git a/crates/router/src/core/errors/api_error_response.rs b/crates/router/src/core/errors/api_error_response.rs index 9dc761e393..2b11df0954 100644 --- a/crates/router/src/core/errors/api_error_response.rs +++ b/crates/router/src/core/errors/api_error_response.rs @@ -158,6 +158,10 @@ pub enum ApiErrorResponse { IncorrectConnectorNameGiven, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_04", message = "Address does not exist in our records")] AddressNotFound, + #[error(error_type = ErrorType::InvalidRequestError, code = "HE_04", message = "Card with the provided iin does not exist")] + InvalidCardIin, + #[error(error_type = ErrorType::InvalidRequestError, code = "HE_04", message = "The provided card IIN length is invalid, please provide an iin with 6 or 8 digits")] + InvalidCardIinLength, } #[derive(Clone)] @@ -202,9 +206,10 @@ impl actix_web::ResponseError for ApiErrorResponse { } Self::InvalidRequestUrl => StatusCode::NOT_FOUND, // 404 Self::InvalidHttpMethod => StatusCode::METHOD_NOT_ALLOWED, // 405 - Self::MissingRequiredField { .. } | Self::InvalidDataValue { .. } => { - StatusCode::BAD_REQUEST - } // 400 + Self::MissingRequiredField { .. } + | Self::InvalidDataValue { .. } + | Self::InvalidCardIin + | Self::InvalidCardIinLength => StatusCode::BAD_REQUEST, // 400 Self::InvalidDataFormat { .. } | Self::InvalidRequestData { .. } => { StatusCode::UNPROCESSABLE_ENTITY } // 422 @@ -437,9 +442,11 @@ impl common_utils::errors::ErrorSwitch { AER::BadRequest(ApiError::new("HE", 3, "Payment method type not supported", Some(Extra {reason: Some(message.to_owned()), ..Default::default()}))) - } + }, + Self::InvalidCardIin => AER::BadRequest(ApiError::new("HE", 3, "The provided card IIN does not exist", None)), + Self::InvalidCardIinLength => AER::BadRequest(ApiError::new("HE", 3, "The provided card IIN length is invalid, please provide an IIN with 6 digits", None)), Self::FlowNotSupported { flow, connector } => { - AER::BadRequest(ApiError::new("IR", 20, format!("{flow} flow not supported"), Some(Extra {connector: Some(connector.to_owned()), ..Default::default()}))) + AER::BadRequest(ApiError::new("IR", 20, format!("{flow} flow not supported"), Some(Extra {connector: Some(connector.to_owned()), ..Default::default()}))) //FIXME: error message } } } diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index fadb874ec5..f4d784b17a 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -1244,8 +1244,7 @@ pub(crate) async fn verify_client_secret( .await .change_context(errors::ApiErrorResponse::PaymentNotFound)?; - authenticate_client_secret(Some(&cs), payment_intent.client_secret.as_ref()) - .map_err(errors::ApiErrorResponse::from)?; + authenticate_client_secret(Some(&cs), payment_intent.client_secret.as_ref())?; Ok(payment_intent) }) .await diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs index a0a4bb45c2..6653167e44 100644 --- a/crates/router/src/db.rs +++ b/crates/router/src/db.rs @@ -1,6 +1,7 @@ pub mod address; pub mod api_keys; pub mod cache; +pub mod cards_info; pub mod configs; pub mod connector_response; pub mod customers; @@ -55,6 +56,7 @@ pub trait StorageInterface: + queue::QueueInterface + refund::RefundInterface + reverse_lookup::ReverseLookupInterface + + cards_info::CardsInfoInterface + 'static { async fn close(&mut self) {} diff --git a/crates/router/src/db/cards_info.rs b/crates/router/src/db/cards_info.rs new file mode 100644 index 0000000000..d088bd415d --- /dev/null +++ b/crates/router/src/db/cards_info.rs @@ -0,0 +1,41 @@ +use error_stack::IntoReport; + +use crate::{ + connection, + core::errors::{self, CustomResult}, + db::MockDb, + services::Store, + types::storage::cards_info::CardInfo, +}; + +#[async_trait::async_trait] +pub trait CardsInfoInterface { + async fn get_card_info( + &self, + _card_iin: &str, + ) -> CustomResult, errors::StorageError>; +} + +#[async_trait::async_trait] +impl CardsInfoInterface for Store { + async fn get_card_info( + &self, + card_iin: &str, + ) -> CustomResult, errors::StorageError> { + let conn = connection::pg_connection_read(self).await?; + CardInfo::find_by_iin(&conn, card_iin) + .await + .map_err(Into::into) + .into_report() + } +} + +#[async_trait::async_trait] +impl CardsInfoInterface for MockDb { + async fn get_card_info( + &self, + _card_iin: &str, + ) -> CustomResult, errors::StorageError> { + Err(errors::StorageError::MockDbError)? + } +} diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs index d6715a4d96..601d5723c2 100644 --- a/crates/router/src/lib.rs +++ b/crates/router/src/lib.rs @@ -121,6 +121,7 @@ pub fn mk_app( { server_app = server_app.service(routes::StripeApis::server(state.clone())); } + server_app = server_app.service(routes::Cards::server(state.clone())); server_app = server_app.service(routes::Health::server(state)); server_app } diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs index 99cf2fb7a8..915e68a3eb 100644 --- a/crates/router/src/routes.rs +++ b/crates/router/src/routes.rs @@ -1,6 +1,7 @@ pub mod admin; pub mod api_keys; pub mod app; +pub mod cards_info; pub mod configs; pub mod customers; pub mod ephemeral_key; @@ -14,7 +15,7 @@ pub mod refunds; pub mod webhooks; pub use self::app::{ - ApiKeys, AppState, Configs, Customers, EphemeralKey, Health, Mandates, MerchantAccount, + ApiKeys, AppState, Cards, Configs, Customers, EphemeralKey, Health, Mandates, MerchantAccount, MerchantConnectorAccount, PaymentMethods, Payments, Payouts, Refunds, Webhooks, }; #[cfg(feature = "stripe")] diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index 9f0917c0a9..1e9b7fa3e8 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -10,6 +10,7 @@ use super::{ephemeral_key::*, payment_methods::*, webhooks::*}; use crate::{ configs::settings::Settings, db::{MockDb, StorageImpl, StorageInterface}, + routes::cards_info::card_iin_info, services::Store, }; @@ -377,3 +378,13 @@ impl ApiKeys { ) } } + +pub struct Cards; + +impl Cards { + pub fn server(state: AppState) -> Scope { + web::scope("/cards") + .app_data(web::Data::new(state)) + .service(web::resource("/{bin}").route(web::get().to(card_iin_info))) + } +} diff --git a/crates/router/src/routes/cards_info.rs b/crates/router/src/routes/cards_info.rs new file mode 100644 index 0000000000..98645b875d --- /dev/null +++ b/crates/router/src/routes/cards_info.rs @@ -0,0 +1,53 @@ +use actix_web::{web, HttpRequest, Responder}; +use router_env::{instrument, tracing, Flow}; + +use super::app::AppState; +use crate::{ + core::cards_info, + services::{api, authentication as auth}, +}; + +/// Cards Info - Retrieve +/// +/// Retrieve the card information given the card bin +#[utoipa::path( + get, + path = "/cards/{bin}", + params(("bin" = String, Path, description = "The first 6 or 9 digits of card")), + responses( + (status = 200, description = "Card iin data found", body = CardInfoResponse), + (status = 404, description = "Card iin data not found") + ), + operation_id = "Retrieve card information", + security(("api_key" = []), ("publishable_key" = [])) +)] +#[instrument(skip_all, fields(flow = ?Flow::CardsInfo))] +pub async fn card_iin_info( + state: web::Data, + req: HttpRequest, + path: web::Path, + payload: web::Query, +) -> impl Responder { + let card_iin = path.into_inner(); + let request_params = payload.into_inner(); + + let payload = api_models::cards_info::CardsInfoRequest { + client_secret: request_params.client_secret, + card_iin, + }; + + let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload) { + Ok((auth, _auth_flow)) => (auth, _auth_flow), + Err(e) => return api::log_and_return_error_response(e), + }; + + api::server_wrap( + Flow::CardsInfo, + state.as_ref(), + &req, + payload, + cards_info::retrieve_card_info, + &*auth, + ) + .await +} diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs index 066716190e..9ad9de25ae 100644 --- a/crates/router/src/services/authentication.rs +++ b/crates/router/src/services/authentication.rs @@ -33,6 +33,22 @@ where #[derive(Debug)] pub struct ApiKeyAuth; +pub struct NoAuth; + +#[async_trait] +impl AuthenticateAndFetch<(), A> for NoAuth +where + A: AppStateInfo + Sync, +{ + async fn authenticate_and_fetch( + &self, + _request_headers: &HeaderMap, + _state: &A, + ) -> RouterResult<()> { + Ok(()) + } +} + #[async_trait] impl AuthenticateAndFetch for ApiKeyAuth where @@ -243,6 +259,12 @@ impl ClientSecretFetch for PaymentMethodListRequest { } } +impl ClientSecretFetch for api_models::cards_info::CardsInfoRequest { + fn get_client_secret(&self) -> Option<&String> { + self.client_secret.as_ref() + } +} + pub fn jwt_auth_or<'a, T, A: AppStateInfo>( default_auth: &'a dyn AuthenticateAndFetch, headers: &HeaderMap, diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs index 66944a4535..59067cdaec 100644 --- a/crates/router/src/types/storage.rs +++ b/crates/router/src/types/storage.rs @@ -1,5 +1,6 @@ pub mod address; pub mod api_keys; +pub mod cards_info; pub mod configs; pub mod connector_response; pub mod customers; @@ -23,8 +24,8 @@ pub mod refund; pub mod kv; pub use self::{ - address::*, api_keys::*, configs::*, connector_response::*, customers::*, events::*, - locker_mock_up::*, mandate::*, merchant_account::*, merchant_connector_account::*, + address::*, api_keys::*, cards_info::*, configs::*, connector_response::*, customers::*, + events::*, locker_mock_up::*, mandate::*, merchant_account::*, merchant_connector_account::*, payment_attempt::*, payment_intent::*, payment_method::*, process_tracker::*, refund::*, reverse_lookup::*, }; diff --git a/crates/router/src/types/storage/cards_info.rs b/crates/router/src/types/storage/cards_info.rs new file mode 100644 index 0000000000..a25ae539d0 --- /dev/null +++ b/crates/router/src/types/storage/cards_info.rs @@ -0,0 +1 @@ +pub use storage_models::cards_info::CardInfo; diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index 1ad30bd3a6..ea8150b9cd 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -435,3 +435,18 @@ impl ForeignFrom for api_enums::AttemptStatus { frunk::labelled_convert_from(status) } } + +impl ForeignFrom + for api_models::cards_info::CardInfoResponse +{ + fn foreign_from(item: storage_models::cards_info::CardInfo) -> Self { + Self { + card_iin: item.card_iin, + card_type: item.card_type, + card_sub_type: item.card_subtype, + card_network: item.card_network, + card_issuer: item.card_issuer, + card_issuing_country: item.card_issuing_country, + } + } +} diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs index c2563956d8..9438543839 100644 --- a/crates/router_env/src/logger/types.rs +++ b/crates/router_env/src/logger/types.rs @@ -162,6 +162,8 @@ pub enum Flow { ApiKeyRevoke, /// API Key list flow ApiKeyList, + /// Cards Info flow + CardsInfo, } /// diff --git a/crates/storage_models/src/cards_info.rs b/crates/storage_models/src/cards_info.rs new file mode 100644 index 0000000000..b32ce460c1 --- /dev/null +++ b/crates/storage_models/src/cards_info.rs @@ -0,0 +1,17 @@ +use diesel::{Identifiable, Queryable}; + +use crate::schema::cards_info; + +#[derive(Clone, Debug, Queryable, Identifiable, serde::Deserialize, serde::Serialize)] +#[diesel(table_name = cards_info, primary_key(card_iin))] +pub struct CardInfo { + pub card_iin: String, + pub card_issuer: Option, + pub card_network: Option, + pub card_type: Option, + pub card_subtype: Option, + pub card_issuing_country: Option, + pub bank_code_id: Option, + pub bank_code: Option, + pub country_code: Option, +} diff --git a/crates/storage_models/src/lib.rs b/crates/storage_models/src/lib.rs index 5d098b1ebf..a373bcaa2d 100644 --- a/crates/storage_models/src/lib.rs +++ b/crates/storage_models/src/lib.rs @@ -1,5 +1,6 @@ pub mod address; pub mod api_keys; +pub mod cards_info; pub mod configs; pub mod connector_response; pub mod customers; diff --git a/crates/storage_models/src/query.rs b/crates/storage_models/src/query.rs index d234c76237..8f3ea34c81 100644 --- a/crates/storage_models/src/query.rs +++ b/crates/storage_models/src/query.rs @@ -1,5 +1,6 @@ pub mod address; pub mod api_keys; +pub mod cards_info; pub mod configs; pub mod connector_response; pub mod customers; diff --git a/crates/storage_models/src/query/cards_info.rs b/crates/storage_models/src/query/cards_info.rs new file mode 100644 index 0000000000..17b82a7865 --- /dev/null +++ b/crates/storage_models/src/query/cards_info.rs @@ -0,0 +1,13 @@ +use diesel::associations::HasTable; + +use crate::{cards_info::CardInfo, query::generics, PgPooledConn, StorageResult}; + +impl CardInfo { + pub async fn find_by_iin(conn: &PgPooledConn, card_iin: &str) -> StorageResult> { + generics::generic_find_by_id_optional::<::Table, _, _>( + conn, + card_iin.to_owned(), + ) + .await + } +} diff --git a/crates/storage_models/src/schema.rs b/crates/storage_models/src/schema.rs index 404694451c..50f313ec8d 100644 --- a/crates/storage_models/src/schema.rs +++ b/crates/storage_models/src/schema.rs @@ -42,6 +42,23 @@ diesel::table! { } } +diesel::table! { + use diesel::sql_types::*; + use crate::enums::diesel_exports::*; + + cards_info (card_iin) { + card_iin -> Varchar, + card_issuer -> Nullable, + card_network -> Nullable, + card_type -> Nullable, + card_subtype -> Nullable, + card_issuing_country -> Nullable, + bank_code_id -> Nullable, + bank_code -> Nullable, + country_code -> Nullable, + } +} + diesel::table! { use diesel::sql_types::*; use crate::enums::diesel_exports::*; @@ -366,6 +383,7 @@ diesel::table! { diesel::allow_tables_to_appear_in_same_query!( address, api_keys, + cards_info, configs, connector_response, customers, diff --git a/migrations/2023-03-14-123541_add_cards_info_table/down.sql b/migrations/2023-03-14-123541_add_cards_info_table/down.sql new file mode 100644 index 0000000000..bf57658e9a --- /dev/null +++ b/migrations/2023-03-14-123541_add_cards_info_table/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +DROP TABLE IF EXISTS cards_info; diff --git a/migrations/2023-03-14-123541_add_cards_info_table/up.sql b/migrations/2023-03-14-123541_add_cards_info_table/up.sql new file mode 100644 index 0000000000..72ff4c7085 --- /dev/null +++ b/migrations/2023-03-14-123541_add_cards_info_table/up.sql @@ -0,0 +1,15 @@ +-- Your SQL goes here +CREATE TABLE cards_info ( + card_iin VARCHAR(16) PRIMARY KEY, + card_issuer TEXT, + card_network TEXT, + card_type TEXT, + card_subtype TEXT, + card_issuing_country TEXT, + bank_code_id VARCHAR(32), + bank_code VARCHAR(32), + country_code VARCHAR(32), + date_created TIMESTAMP NOT NULL, + last_updated TIMESTAMP, + last_updated_provider TEXT +) diff --git a/openapi/generated.json b/openapi/generated.json index 8f7953c403..603a00dc3f 100644 --- a/openapi/generated.json +++ b/openapi/generated.json @@ -1808,7 +1808,8 @@ "type": "object", "description": "List of enabled and disabled countries, empty in case all countries are enabled", "required": [ - "type" + "type", + "list" ], "properties": { "type": { @@ -1825,7 +1826,8 @@ "FR", "DE", "IN" - ] + ], + "nullable": true } } }, @@ -1833,7 +1835,8 @@ "type": "object", "description": "List of enabled and disabled currencies, empty in case all currencies are enabled", "required": [ - "type" + "type", + "list" ], "properties": { "type": { @@ -1849,34 +1852,62 @@ "example": [ "USD", "EUR" - ] + ], + "nullable": true } } }, "Address": { "type": "object", + "required": [ + "address", + "phone" + ], "properties": { "address": { - "$ref": "#/components/schemas/AddressDetails" + "allOf": [ + { + "$ref": "#/components/schemas/AddressDetails" + } + ], + "nullable": true }, "phone": { - "$ref": "#/components/schemas/PhoneDetails" + "allOf": [ + { + "$ref": "#/components/schemas/PhoneDetails" + } + ], + "nullable": true } } }, "AddressDetails": { "type": "object", + "required": [ + "city", + "country", + "line1", + "line2", + "line3", + "zip", + "state", + "first_name", + "last_name" + ], "properties": { "city": { "type": "string", "description": "The address city", "example": "New York", + "nullable": true, "maxLength": 50 }, "country": { "type": "string", "description": "The two-letter ISO country code for the address", "example": "US", + "nullable": true, "maxLength": 2, "minLength": 2 }, @@ -1884,41 +1915,48 @@ "type": "string", "description": "The first line of the address", "example": "123, King Street", + "nullable": true, "maxLength": 200 }, "line2": { "type": "string", "description": "The second line of the address", "example": "Powelson Avenue", + "nullable": true, "maxLength": 50 }, "line3": { "type": "string", "description": "The third line of the address", "example": "Bridgewater", + "nullable": true, "maxLength": 50 }, "zip": { "type": "string", "description": "The zip/postal code for the address", "example": "08807", + "nullable": true, "maxLength": 50 }, "state": { "type": "string", "description": "The address state", - "example": "New York" + "example": "New York", + "nullable": true }, "first_name": { "type": "string", "description": "The first name for the address", "example": "John", + "nullable": true, "maxLength": 255 }, "last_name": { "type": "string", "description": "The last name for the address", "example": "Doe", + "nullable": true, "maxLength": 255 } } @@ -2312,7 +2350,9 @@ "card_exp_month", "card_exp_year", "card_holder_name", - "card_cvc" + "card_cvc", + "card_issuer", + "card_network" ], "properties": { "card_number": { @@ -2343,10 +2383,16 @@ "card_issuer": { "type": "string", "description": "The name of the issuer of card", - "example": "chase" + "example": "chase", + "nullable": true }, "card_network": { - "$ref": "#/components/schemas/CardNetwork" + "allOf": [ + { + "$ref": "#/components/schemas/CardNetwork" + } + ], + "nullable": true } } }, @@ -2383,30 +2429,48 @@ }, "CardDetailFromLocker": { "type": "object", + "required": [ + "scheme", + "issuer_country", + "last4_digits", + "expiry_month", + "expiry_year", + "card_token", + "card_holder_name", + "card_fingerprint" + ], "properties": { "scheme": { - "type": "string" + "type": "string", + "nullable": true }, "issuer_country": { - "type": "string" + "type": "string", + "nullable": true }, "last4_digits": { - "type": "string" + "type": "string", + "nullable": true }, "expiry_month": { - "type": "string" + "type": "string", + "nullable": true }, "expiry_year": { - "type": "string" + "type": "string", + "nullable": true }, "card_token": { - "type": "string" + "type": "string", + "nullable": true }, "card_holder_name": { - "type": "string" + "type": "string", + "nullable": true }, "card_fingerprint": { - "type": "string" + "type": "string", + "nullable": true } } }, @@ -2451,7 +2515,8 @@ "shift4", "stripe", "worldline", - "worldpay" + "worldpay", + "trustpay" ] }, "ConnectorType": { @@ -2471,6 +2536,7 @@ "description": "The request body for creating an API Key.", "required": [ "name", + "description", "expiration" ], "properties": { @@ -2484,6 +2550,7 @@ "type": "string", "description": "A description to provide more context about the API Key.", "example": "Key used by our developers to integrate with the sandbox environment", + "nullable": true, "maxLength": 256 }, "expiration": { @@ -2498,6 +2565,7 @@ "key_id", "merchant_id", "name", + "description", "api_key", "created", "expiration" @@ -2525,6 +2593,7 @@ "type": "string", "description": "The description to provide more context about the API Key.", "example": "Key used by our developers to integrate with the sandbox environment", + "nullable": true, "maxLength": 256 }, "api_key": { @@ -2655,7 +2724,8 @@ "CustomerAcceptance": { "type": "object", "required": [ - "acceptance_type" + "acceptance_type", + "online" ], "properties": { "acceptance_type": { @@ -2665,10 +2735,16 @@ "type": "string", "format": "date-time", "description": "Specifying when the customer acceptance was provided", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true }, "online": { - "$ref": "#/components/schemas/OnlineMandate" + "allOf": [ + { + "$ref": "#/components/schemas/OnlineMandate" + } + ], + "nullable": true } } }, @@ -2710,8 +2786,14 @@ "payment_token", "customer_id", "payment_method", + "payment_method_type", + "payment_method_issuer", + "payment_method_issuer_code", "recurring_enabled", - "installment_payment_enabled" + "installment_payment_enabled", + "payment_experience", + "card", + "metadata" ], "properties": { "payment_token": { @@ -2728,15 +2810,26 @@ "$ref": "#/components/schemas/PaymentMethodType" }, "payment_method_type": { - "$ref": "#/components/schemas/PaymentMethodType" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodType" + } + ], + "nullable": true }, "payment_method_issuer": { "type": "string", "description": "The name of the bank/ provider issuing the payment method to the end user", - "example": "Citibank" + "example": "Citibank", + "nullable": true }, "payment_method_issuer_code": { - "$ref": "#/components/schemas/PaymentMethodIssuerCode" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodIssuerCode" + } + ], + "nullable": true }, "recurring_enabled": { "type": "boolean", @@ -2756,20 +2849,28 @@ "description": "Type of payment experience enabled with the connector", "example": [ "redirect_to_url" - ] + ], + "nullable": true }, "card": { - "$ref": "#/components/schemas/CardDetailFromLocker" + "allOf": [ + { + "$ref": "#/components/schemas/CardDetailFromLocker" + } + ], + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true }, "created": { "type": "string", "format": "date-time", "description": "A timestamp (ISO 8601 code) that determines when the customer was created", - "example": "2023-01-18T11:04:09.922Z" + "example": "2023-01-18T11:04:09.922Z", + "nullable": true } } }, @@ -2791,58 +2892,14 @@ "CustomerRequest": { "type": "object", "description": "The customer details", - "properties": { - "customer_id": { - "type": "string", - "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.", - "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44", - "maxLength": 255 - }, - "name": { - "type": "string", - "description": "The customer's name", - "example": "Jon Test", - "maxLength": 255 - }, - "email": { - "type": "string", - "description": "The customer's email address", - "example": "JonTest@test.com", - "maxLength": 255 - }, - "phone": { - "type": "string", - "description": "The customer's phone number", - "example": "9999999999", - "maxLength": 255 - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object.", - "example": "First Customer", - "maxLength": 255 - }, - "phone_country_code": { - "type": "string", - "description": "The country code for the customer phone number", - "example": "+65", - "maxLength": 255 - }, - "address": { - "type": "object", - "description": "The address for the customer" - }, - "metadata": { - "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject." - } - } - }, - "CustomerResponse": { - "type": "object", "required": [ - "customer_id", - "created_at" + "name", + "email", + "phone", + "description", + "phone_country_code", + "address", + "metadata" ], "properties": { "customer_id": { @@ -2855,35 +2912,108 @@ "type": "string", "description": "The customer's name", "example": "Jon Test", + "nullable": true, "maxLength": 255 }, "email": { "type": "string", "description": "The customer's email address", "example": "JonTest@test.com", + "nullable": true, "maxLength": 255 }, "phone": { "type": "string", "description": "The customer's phone number", "example": "9999999999", - "maxLength": 255 - }, - "phone_country_code": { - "type": "string", - "description": "The country code for the customer phone number", - "example": "+65", + "nullable": true, "maxLength": 255 }, "description": { "type": "string", "description": "An arbitrary string that you can attach to a customer object.", "example": "First Customer", + "nullable": true, + "maxLength": 255 + }, + "phone_country_code": { + "type": "string", + "description": "The country code for the customer phone number", + "example": "+65", + "nullable": true, "maxLength": 255 }, "address": { "type": "object", - "description": "The address for the customer" + "description": "The address for the customer", + "nullable": true + }, + "metadata": { + "type": "object", + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject.", + "nullable": true + } + } + }, + "CustomerResponse": { + "type": "object", + "required": [ + "customer_id", + "name", + "email", + "phone", + "phone_country_code", + "description", + "address", + "created_at", + "metadata" + ], + "properties": { + "customer_id": { + "type": "string", + "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.", + "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44", + "maxLength": 255 + }, + "name": { + "type": "string", + "description": "The customer's name", + "example": "Jon Test", + "nullable": true, + "maxLength": 255 + }, + "email": { + "type": "string", + "description": "The customer's email address", + "example": "JonTest@test.com", + "nullable": true, + "maxLength": 255 + }, + "phone": { + "type": "string", + "description": "The customer's phone number", + "example": "9999999999", + "nullable": true, + "maxLength": 255 + }, + "phone_country_code": { + "type": "string", + "description": "The country code for the customer phone number", + "example": "+65", + "nullable": true, + "maxLength": 255 + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object.", + "example": "First Customer", + "nullable": true, + "maxLength": 255 + }, + "address": { + "type": "object", + "description": "The address for the customer", + "nullable": true }, "created_at": { "type": "string", @@ -2893,7 +3023,8 @@ }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject.", + "nullable": true } } }, @@ -3152,38 +3283,56 @@ }, "MandateCardDetails": { "type": "object", + "required": [ + "last4_digits", + "card_exp_month", + "card_exp_year", + "card_holder_name", + "card_token", + "scheme", + "issuer_country", + "card_fingerprint" + ], "properties": { "last4_digits": { "type": "string", - "description": "The last 4 digits of card" + "description": "The last 4 digits of card", + "nullable": true }, "card_exp_month": { "type": "string", - "description": "The expiry month of card" + "description": "The expiry month of card", + "nullable": true }, "card_exp_year": { "type": "string", - "description": "The expiry year of card" + "description": "The expiry year of card", + "nullable": true }, "card_holder_name": { "type": "string", - "description": "The card holder name" + "description": "The card holder name", + "nullable": true }, "card_token": { "type": "string", - "description": "The token from card locker" + "description": "The token from card locker", + "nullable": true }, "scheme": { "type": "string", - "description": "The card scheme network for the particular card" + "description": "The card scheme network for the particular card", + "nullable": true }, "issuer_country": { "type": "string", - "description": "The country code in in which the card was issued" + "description": "The country code in in which the card was issued", + "nullable": true }, "card_fingerprint": { "type": "string", - "description": "A unique identifier alias to identify a particular card" + "description": "A unique identifier alias to identify a particular card", + "nullable": true } } }, @@ -3208,7 +3357,9 @@ "mandate_id", "status", "payment_method_id", - "payment_method" + "payment_method", + "card", + "customer_acceptance" ], "properties": { "mandate_id": { @@ -3227,10 +3378,20 @@ "description": "The payment method" }, "card": { - "$ref": "#/components/schemas/MandateCardDetails" + "allOf": [ + { + "$ref": "#/components/schemas/MandateCardDetails" + } + ], + "nullable": true }, "customer_acceptance": { - "$ref": "#/components/schemas/CustomerAcceptance" + "allOf": [ + { + "$ref": "#/components/schemas/CustomerAcceptance" + } + ], + "nullable": true } } }, @@ -3280,7 +3441,12 @@ ], "properties": { "multi_use": { - "$ref": "#/components/schemas/MandateAmountData" + "allOf": [ + { + "$ref": "#/components/schemas/MandateAmountData" + } + ], + "nullable": true } } } @@ -3289,7 +3455,20 @@ "MerchantAccountCreate": { "type": "object", "required": [ - "merchant_id" + "merchant_id", + "merchant_name", + "merchant_details", + "return_url", + "webhook_details", + "routing_algorithm", + "sub_merchants_enabled", + "parent_merchant_id", + "enable_payment_response_hash", + "payment_response_hash_key", + "redirect_to_merchant_with_http_post", + "metadata", + "publishable_key", + "locker_id" ], "properties": { "merchant_id": { @@ -3301,65 +3480,86 @@ "merchant_name": { "type": "string", "description": "Name of the Merchant Account", - "example": "NewAge Retailer" + "example": "NewAge Retailer", + "nullable": true }, "merchant_details": { - "$ref": "#/components/schemas/MerchantDetails" + "allOf": [ + { + "$ref": "#/components/schemas/MerchantDetails" + } + ], + "nullable": true }, "return_url": { "type": "string", "description": "The URL to redirect after the completion of the operation", "example": "https://www.example.com/success", + "nullable": true, "maxLength": 255 }, "webhook_details": { - "$ref": "#/components/schemas/WebhookDetails" + "allOf": [ + { + "$ref": "#/components/schemas/WebhookDetails" + } + ], + "nullable": true }, "routing_algorithm": { "type": "object", - "description": "The routing algorithm to be used for routing payments to desired connectors" + "description": "The routing algorithm to be used for routing payments to desired connectors", + "nullable": true }, "sub_merchants_enabled": { "type": "boolean", "description": "A boolean value to indicate if the merchant is a sub-merchant under a master or a parent merchant. By default, its value is false.", "default": false, - "example": false + "example": false, + "nullable": true }, "parent_merchant_id": { "type": "string", "description": "Refers to the Parent Merchant ID if the merchant being created is a sub-merchant", "example": "xkkdf909012sdjki2dkh5sdf", + "nullable": true, "maxLength": 255 }, "enable_payment_response_hash": { "type": "boolean", "description": "A boolean value to indicate if payment response hash needs to be enabled", "default": false, - "example": true + "example": true, + "nullable": true }, "payment_response_hash_key": { "type": "string", - "description": "Refers to the hash key used for payment response" + "description": "Refers to the hash key used for payment response", + "nullable": true }, "redirect_to_merchant_with_http_post": { "type": "boolean", "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", "default": false, - "example": true + "example": true, + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true }, "publishable_key": { "type": "string", "description": "API key that will be used for server side API access", - "example": "AH3423bkjbkjdsfbkj" + "example": "AH3423bkjbkjdsfbkj", + "nullable": true }, "locker_id": { "type": "string", "description": "An identifier for the vault used to store payment method information.", - "example": "locker_abc123" + "example": "locker_abc123", + "nullable": true } } }, @@ -3387,8 +3587,19 @@ "type": "object", "required": [ "merchant_id", + "merchant_name", + "return_url", "enable_payment_response_hash", - "redirect_to_merchant_with_http_post" + "payment_response_hash_key", + "redirect_to_merchant_with_http_post", + "merchant_details", + "webhook_details", + "routing_algorithm", + "sub_merchants_enabled", + "parent_merchant_id", + "publishable_key", + "metadata", + "locker_id" ], "properties": { "merchant_id": { @@ -3400,12 +3611,14 @@ "merchant_name": { "type": "string", "description": "Name of the Merchant Account", - "example": "NewAge Retailer" + "example": "NewAge Retailer", + "nullable": true }, "return_url": { "type": "string", "description": "The URL to redirect after the completion of the operation", "example": "https://www.example.com/success", + "nullable": true, "maxLength": 255 }, "enable_payment_response_hash": { @@ -3418,6 +3631,7 @@ "type": "string", "description": "Refers to the Parent Merchant ID if the merchant being created is a sub-merchant", "example": "xkkdf909012sdjki2dkh5sdf", + "nullable": true, "maxLength": 255 }, "redirect_to_merchant_with_http_post": { @@ -3427,46 +3641,79 @@ "example": true }, "merchant_details": { - "$ref": "#/components/schemas/MerchantDetails" + "allOf": [ + { + "$ref": "#/components/schemas/MerchantDetails" + } + ], + "nullable": true }, "webhook_details": { - "$ref": "#/components/schemas/WebhookDetails" + "allOf": [ + { + "$ref": "#/components/schemas/WebhookDetails" + } + ], + "nullable": true }, "routing_algorithm": { - "$ref": "#/components/schemas/RoutingAlgorithm" + "allOf": [ + { + "$ref": "#/components/schemas/RoutingAlgorithm" + } + ], + "nullable": true }, "sub_merchants_enabled": { "type": "boolean", "description": "A boolean value to indicate if the merchant is a sub-merchant under a master or a parent merchant. By default, its value is false.", "default": false, - "example": false + "example": false, + "nullable": true }, "parent_merchant_id": { "type": "string", "description": "Refers to the Parent Merchant ID if the merchant being created is a sub-merchant", "example": "xkkdf909012sdjki2dkh5sdf", + "nullable": true, "maxLength": 255 }, "publishable_key": { "type": "string", "description": "API key that will be used for server side API access", - "example": "AH3423bkjbkjdsfbkj" + "example": "AH3423bkjbkjdsfbkj", + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true }, "locker_id": { "type": "string", "description": "An identifier for the vault used to store payment method information.", - "example": "locker_abc123" + "example": "locker_abc123", + "nullable": true } } }, "MerchantAccountUpdate": { "type": "object", "required": [ - "merchant_id" + "merchant_id", + "merchant_name", + "merchant_details", + "return_url", + "webhook_details", + "routing_algorithm", + "sub_merchants_enabled", + "parent_merchant_id", + "enable_payment_response_hash", + "payment_response_hash_key", + "redirect_to_merchant_with_http_post", + "metadata", + "publishable_key", + "locker_id" ], "properties": { "merchant_id": { @@ -3478,65 +3725,86 @@ "merchant_name": { "type": "string", "description": "Name of the Merchant Account", - "example": "NewAge Retailer" + "example": "NewAge Retailer", + "nullable": true }, "merchant_details": { - "$ref": "#/components/schemas/MerchantDetails" + "allOf": [ + { + "$ref": "#/components/schemas/MerchantDetails" + } + ], + "nullable": true }, "return_url": { "type": "string", "description": "The URL to redirect after the completion of the operation", "example": "https://www.example.com/success", + "nullable": true, "maxLength": 255 }, "webhook_details": { - "$ref": "#/components/schemas/WebhookDetails" + "allOf": [ + { + "$ref": "#/components/schemas/WebhookDetails" + } + ], + "nullable": true }, "routing_algorithm": { "type": "object", - "description": "The routing algorithm to be used for routing payments to desired connectors" + "description": "The routing algorithm to be used for routing payments to desired connectors", + "nullable": true }, "sub_merchants_enabled": { "type": "boolean", "description": "A boolean value to indicate if the merchant is a sub-merchant under a master or a parent merchant. By default, its value is false.", "default": false, - "example": false + "example": false, + "nullable": true }, "parent_merchant_id": { "type": "string", "description": "Refers to the Parent Merchant ID if the merchant being created is a sub-merchant", "example": "xkkdf909012sdjki2dkh5sdf", + "nullable": true, "maxLength": 255 }, "enable_payment_response_hash": { "type": "boolean", "description": "A boolean value to indicate if payment response hash needs to be enabled", "default": false, - "example": true + "example": true, + "nullable": true }, "payment_response_hash_key": { "type": "string", - "description": "Refers to the hash key used for payment response" + "description": "Refers to the hash key used for payment response", + "nullable": true }, "redirect_to_merchant_with_http_post": { "type": "boolean", "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", "default": false, - "example": true + "example": true, + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true }, "publishable_key": { "type": "string", "description": "API key that will be used for server side API access", - "example": "AH3423bkjbkjdsfbkj" + "example": "AH3423bkjbkjdsfbkj", + "nullable": true }, "locker_id": { "type": "string", "description": "An identifier for the vault used to store payment method information.", - "example": "locker_abc123" + "example": "locker_abc123", + "nullable": true } } }, @@ -3545,7 +3813,13 @@ "description": "Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc.\"", "required": [ "connector_type", - "connector_name" + "connector_name", + "merchant_connector_id", + "connector_account_details", + "test_mode", + "disabled", + "payment_methods_enabled", + "metadata" ], "properties": { "connector_type": { @@ -3559,23 +3833,27 @@ "merchant_connector_id": { "type": "string", "description": "Unique ID of the connector", - "example": "mca_5apGeP94tMts6rg3U3kR" + "example": "mca_5apGeP94tMts6rg3U3kR", + "nullable": true }, "connector_account_details": { "type": "object", - "description": "Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object." + "description": "Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.", + "nullable": true }, "test_mode": { "type": "boolean", "description": "A boolean value to indicate if the connector is in Test mode. By default, its value is false.", "default": false, - "example": false + "example": false, + "nullable": true }, "disabled": { "type": "boolean", "description": "A boolean value to indicate if the connector is disabled. By default, its value is false.", "default": false, - "example": false + "example": false, + "nullable": true }, "payment_methods_enabled": { "type": "array", @@ -3585,44 +3863,46 @@ "description": "Refers to the Parent Merchant ID if the merchant being created is a sub-merchant", "example": [ { - "accepted_countries": { - "list": [ - "FR", - "DE", - "IN" - ], - "type": "disable_only" - }, - "accepted_currencies": { - "list": [ - "USD", - "EUR" - ], - "type": "enable_only" - }, - "installment_payment_enabled": true, - "maximum_amount": 68607706, - "minimum_amount": 1, "payment_method": "wallet", - "payment_method_issuers": [ - "labore magna ipsum", - "aute" - ], "payment_method_types": [ "upi_collect", "upi_intent" ], + "payment_method_issuers": [ + "labore magna ipsum", + "aute" + ], "payment_schemes": [ "Discover", "Discover" ], - "recurring_enabled": true + "accepted_currencies": { + "type": "enable_only", + "list": [ + "USD", + "EUR" + ] + }, + "accepted_countries": { + "type": "disable_only", + "list": [ + "FR", + "DE", + "IN" + ] + }, + "minimum_amount": 1, + "maximum_amount": 68607706, + "recurring_enabled": true, + "installment_payment_enabled": true } - ] + ], + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true } } }, @@ -3669,57 +3949,81 @@ }, "MerchantDetails": { "type": "object", + "required": [ + "primary_contact_person", + "primary_phone", + "primary_email", + "secondary_contact_person", + "secondary_phone", + "secondary_email", + "website", + "about_business", + "address" + ], "properties": { "primary_contact_person": { "type": "string", "description": "The merchant's primary contact name", "example": "John Doe", + "nullable": true, "maxLength": 255 }, "primary_phone": { "type": "string", "description": "The merchant's primary phone number", "example": "999999999", + "nullable": true, "maxLength": 255 }, "primary_email": { "type": "string", "description": "The merchant's primary email address", "example": "johndoe@test.com", + "nullable": true, "maxLength": 255 }, "secondary_contact_person": { "type": "string", "description": "The merchant's secondary contact name", "example": "John Doe2", + "nullable": true, "maxLength": 255 }, "secondary_phone": { "type": "string", "description": "The merchant's secondary phone number", "example": "999999988", + "nullable": true, "maxLength": 255 }, "secondary_email": { "type": "string", "description": "The merchant's secondary email address", "example": "johndoe2@test.com", + "nullable": true, "maxLength": 255 }, "website": { "type": "string", "description": "The business website of the merchant", "example": "www.example.com", + "nullable": true, "maxLength": 255 }, "about_business": { "type": "string", "description": "A brief description about merchant's business", "example": "Online Retail with a wide selection of organic products for North America", + "nullable": true, "maxLength": 255 }, "address": { - "$ref": "#/components/schemas/AddressDetails" + "allOf": [ + { + "$ref": "#/components/schemas/AddressDetails" + } + ], + "nullable": true } } }, @@ -3731,9 +4035,17 @@ }, { "type": "object", + "required": [ + "order_details" + ], "properties": { "order_details": { - "$ref": "#/components/schemas/OrderDetails" + "allOf": [ + { + "$ref": "#/components/schemas/OrderDetails" + } + ], + "nullable": true } } } @@ -3742,7 +4054,8 @@ "NextAction": { "type": "object", "required": [ - "type" + "type", + "redirect_to_url" ], "properties": { "type": { @@ -3751,7 +4064,8 @@ "redirect_to_url": { "type": "string", "description": "Contains the url for redirection flow", - "example": "https://router.juspay.io/redirect/fakushdfjlksdfasklhdfj" + "example": "https://router.juspay.io/redirect/fakushdfjlksdfasklhdfj", + "nullable": true } } }, @@ -3956,21 +4270,29 @@ }, "PaymentListConstraints": { "type": "object", + "required": [ + "customer_id", + "starting_after", + "ending_before" + ], "properties": { "customer_id": { "type": "string", "description": "The identifier for customer", - "example": "cus_meowuwunwiuwiwqw" + "example": "cus_meowuwunwiuwiwqw", + "nullable": true }, "starting_after": { "type": "string", "description": "A cursor for use in pagination, fetch the next list after some object", - "example": "pay_fafa124123" + "example": "pay_fafa124123", + "nullable": true }, "ending_before": { "type": "string", "description": "A cursor for use in pagination, fetch the previous list before some object", - "example": "pay_fafa124123" + "example": "pay_fafa124123", + "nullable": true }, "limit": { "type": "integer", @@ -3982,31 +4304,36 @@ "type": "string", "format": "date-time", "description": "The time at which payment is created", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true }, "created.lt": { "type": "string", "format": "date-time", "description": "Time less than the payment created time", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true }, "created.gt": { "type": "string", "format": "date-time", "description": "Time greater than the payment created time", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true }, "created.lte": { "type": "string", "format": "date-time", "description": "Time less than or equals to the payment created time", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true }, "created.gte": { "type": "string", "format": "date-time", "description": "Time greater than or equals to the payment created time", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true } } }, @@ -4041,39 +4368,65 @@ "PaymentMethodCreate": { "type": "object", "required": [ - "payment_method" + "payment_method", + "payment_method_type", + "payment_method_issuer", + "payment_method_issuer_code", + "card", + "metadata", + "customer_id", + "card_network" ], "properties": { "payment_method": { "$ref": "#/components/schemas/PaymentMethodType" }, "payment_method_type": { - "$ref": "#/components/schemas/PaymentMethodType" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodType" + } + ], + "nullable": true }, "payment_method_issuer": { "type": "string", "description": "The name of the bank/ provider issuing the payment method to the end user", - "example": "Citibank" + "example": "Citibank", + "nullable": true }, "payment_method_issuer_code": { - "$ref": "#/components/schemas/PaymentMethodIssuerCode" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodIssuerCode" + } + ], + "nullable": true }, "card": { - "$ref": "#/components/schemas/CardDetail" + "allOf": [ + { + "$ref": "#/components/schemas/CardDetail" + } + ], + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true }, "customer_id": { "type": "string", "description": "The unique identifier of the customer.", - "example": "cus_meowerunwiuwiwqw" + "example": "cus_meowerunwiuwiwqw", + "nullable": true }, "card_network": { "type": "string", "description": "The card network", - "example": "Visa" + "example": "Visa", + "nullable": true } } }, @@ -4162,7 +4515,8 @@ "PaymentMethodList": { "type": "object", "required": [ - "payment_method" + "payment_method", + "payment_method_types" ], "properties": { "payment_method": { @@ -4176,20 +4530,23 @@ "description": "This is a sub-category of payment method.", "example": [ "credit" - ] + ], + "nullable": true } } }, "PaymentMethodListResponse": { "type": "object", "required": [ + "redirect_url", "payment_methods" ], "properties": { "redirect_url": { "type": "string", "description": "Redirect URL of the merchant", - "example": "https://www.google.com" + "example": "https://www.google.com", + "nullable": true }, "payment_methods": { "type": "array", @@ -4199,8 +4556,8 @@ "description": "Information about the payment method", "example": [ { - "payment_experience": null, "payment_method": "wallet", + "payment_experience": null, "payment_method_issuers": [ "labore magna ipsum", "aute" @@ -4214,10 +4571,15 @@ "type": "object", "required": [ "merchant_id", + "customer_id", "payment_method_id", "payment_method", + "payment_method_type", + "card", "recurring_enabled", - "installment_payment_enabled" + "installment_payment_enabled", + "payment_experience", + "metadata" ], "properties": { "merchant_id": { @@ -4228,7 +4590,8 @@ "customer_id": { "type": "string", "description": "The unique identifier of the customer.", - "example": "cus_meowerunwiuwiwqw" + "example": "cus_meowerunwiuwiwqw", + "nullable": true }, "payment_method_id": { "type": "string", @@ -4239,10 +4602,20 @@ "$ref": "#/components/schemas/PaymentMethodType" }, "payment_method_type": { - "$ref": "#/components/schemas/PaymentMethodType" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodType" + } + ], + "nullable": true }, "card": { - "$ref": "#/components/schemas/CardDetailFromLocker" + "allOf": [ + { + "$ref": "#/components/schemas/CardDetailFromLocker" + } + ], + "nullable": true }, "recurring_enabled": { "type": "boolean", @@ -4262,17 +4635,20 @@ "description": "Type of payment experience enabled with the connector", "example": [ "redirect_to_url" - ] + ], + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true }, "created": { "type": "string", "format": "date-time", "description": "A timestamp (ISO 8601 code) that determines when the customer was created", - "example": "2023-01-18T11:04:09.922Z" + "example": "2023-01-18T11:04:09.922Z", + "nullable": true } } }, @@ -4295,16 +4671,32 @@ }, "PaymentMethodUpdate": { "type": "object", + "required": [ + "card", + "card_network", + "metadata" + ], "properties": { "card": { - "$ref": "#/components/schemas/CardDetail" + "allOf": [ + { + "$ref": "#/components/schemas/CardDetail" + } + ], + "nullable": true }, "card_network": { - "$ref": "#/components/schemas/CardNetwork" + "allOf": [ + { + "$ref": "#/components/schemas/CardNetwork" + } + ], + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true } } }, @@ -4312,7 +4704,8 @@ "type": "object", "description": "Details of all the payment methods enabled for the connector for the given merchant account", "required": [ - "payment_method" + "payment_method", + "payment_method_types" ], "properties": { "payment_method": { @@ -4326,69 +4719,128 @@ "description": "Subtype of payment method", "example": [ "credit" - ] + ], + "nullable": true } } }, "PaymentRetrieveBody": { "type": "object", + "required": [ + "merchant_id", + "force_sync" + ], "properties": { "merchant_id": { "type": "string", - "description": "The identifier for the Merchant Account." + "description": "The identifier for the Merchant Account.", + "nullable": true }, "force_sync": { "type": "boolean", - "description": "Decider to enable or disable the connector call for retrieve request" + "description": "Decider to enable or disable the connector call for retrieve request", + "nullable": true } } }, "PaymentsCancelRequest": { "type": "object", + "required": [ + "cancellation_reason" + ], "properties": { "cancellation_reason": { "type": "string", - "description": "The reason for the payment cancel" + "description": "The reason for the payment cancel", + "nullable": true } } }, "PaymentsCaptureRequest": { "type": "object", + "required": [ + "payment_id", + "merchant_id", + "amount_to_capture", + "refund_uncaptured_amount", + "statement_descriptor_suffix", + "statement_descriptor_prefix" + ], "properties": { "payment_id": { "type": "string", - "description": "The unique identifier for the payment" + "description": "The unique identifier for the payment", + "nullable": true }, "merchant_id": { "type": "string", - "description": "The unique identifier for the merchant" + "description": "The unique identifier for the merchant", + "nullable": true }, "amount_to_capture": { "type": "integer", "format": "int64", - "description": "The Amount to be captured/ debited from the user's payment method." + "description": "The Amount to be captured/ debited from the user's payment method.", + "nullable": true }, "refund_uncaptured_amount": { "type": "boolean", - "description": "Decider to refund the uncaptured amount" + "description": "Decider to refund the uncaptured amount", + "nullable": true }, "statement_descriptor_suffix": { "type": "string", - "description": "Provides information about a card payment that customers see on their statements." + "description": "Provides information about a card payment that customers see on their statements.", + "nullable": true }, "statement_descriptor_prefix": { "type": "string", - "description": "Concatenated with the statement descriptor suffix that’s set on the account to form the complete statement descriptor." + "description": "Concatenated with the statement descriptor suffix that’s set on the account to form the complete statement descriptor.", + "nullable": true } } }, "PaymentsRequest": { "type": "object", + "required": [ + "merchant_id", + "connector", + "currency", + "capture_method", + "amount_to_capture", + "confirm", + "customer_id", + "email", + "name", + "phone", + "phone_country_code", + "off_session", + "description", + "return_url", + "setup_future_usage", + "authentication_type", + "payment_method_data", + "payment_method", + "payment_token", + "card_cvc", + "shipping", + "billing", + "statement_descriptor_name", + "statement_descriptor_suffix", + "metadata", + "client_secret", + "mandate_data", + "mandate_id", + "browser_info", + "payment_experience", + "payment_method_type" + ], "properties": { "payment_id": { "type": "string", "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant. This field is auto generated and is returned in the API response.", "example": "pay_mbabizu24mvu3mela5njyhpit4", + "nullable": true, "maxLength": 30, "minLength": 30 }, @@ -4396,167 +4848,287 @@ "type": "string", "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request", "example": "merchant_1668273825", + "nullable": true, "maxLength": 255 }, "amount": { "type": "integer", "format": "int64", "description": "The payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,", - "example": 6540 + "example": 6540, + "nullable": true }, "connector": { - "$ref": "#/components/schemas/Connector" + "allOf": [ + { + "$ref": "#/components/schemas/Connector" + } + ], + "nullable": true }, "currency": { - "$ref": "#/components/schemas/Currency" + "allOf": [ + { + "$ref": "#/components/schemas/Currency" + } + ], + "nullable": true }, "capture_method": { - "$ref": "#/components/schemas/CaptureMethod" + "allOf": [ + { + "$ref": "#/components/schemas/CaptureMethod" + } + ], + "nullable": true }, "amount_to_capture": { "type": "integer", "format": "int64", "description": "The Amount to be captured/ debited from the users payment method. It shall be in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,\nIf not provided, the default amount_to_capture will be the payment amount.", - "example": 6540 + "example": 6540, + "nullable": true }, "capture_on": { "type": "string", "format": "date-time", "description": "A timestamp (ISO 8601 code) that determines when the payment should be captured.\nProviding this field will automatically set `capture` to true", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true }, "confirm": { "type": "boolean", "description": "Whether to confirm the payment (if applicable)", "default": false, - "example": true + "example": true, + "nullable": true }, "customer_id": { "type": "string", "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.", "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44", + "nullable": true, "maxLength": 255 }, "email": { "type": "string", "description": "description: The customer's email address", "example": "johntest@test.com", + "nullable": true, "maxLength": 255 }, "name": { "type": "string", "description": "description: The customer's name", "example": "John Test", + "nullable": true, "maxLength": 255 }, "phone": { "type": "string", "description": "The customer's phone number", "example": "3141592653", + "nullable": true, "maxLength": 255 }, "phone_country_code": { "type": "string", "description": "The country code for the customer phone number", "example": "+1", + "nullable": true, "maxLength": 255 }, "off_session": { "type": "boolean", "description": "Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with `confirm: true`.", - "example": true + "example": true, + "nullable": true }, "description": { "type": "string", "description": "A description of the payment", - "example": "It's my first payment request" + "example": "It's my first payment request", + "nullable": true }, "return_url": { "type": "string", "description": "The URL to redirect after the completion of the operation", - "example": "https://hyperswitch.io" + "example": "https://hyperswitch.io", + "nullable": true }, "setup_future_usage": { - "$ref": "#/components/schemas/FutureUsage" + "allOf": [ + { + "$ref": "#/components/schemas/FutureUsage" + } + ], + "nullable": true }, "authentication_type": { - "$ref": "#/components/schemas/AuthenticationType" + "allOf": [ + { + "$ref": "#/components/schemas/AuthenticationType" + } + ], + "nullable": true }, "payment_method_data": { - "$ref": "#/components/schemas/PaymentMethodData" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodData" + } + ], + "nullable": true }, "payment_method": { - "$ref": "#/components/schemas/PaymentMethod" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethod" + } + ], + "nullable": true }, "payment_token": { "type": "string", "description": "Provide a reference to a stored payment method", - "example": "187282ab-40ef-47a9-9206-5099ba31e432" + "example": "187282ab-40ef-47a9-9206-5099ba31e432", + "nullable": true }, "card_cvc": { "type": "string", - "description": "This is used when payment is to be confirmed and the card is not saved" + "description": "This is used when payment is to be confirmed and the card is not saved", + "nullable": true }, "shipping": { - "$ref": "#/components/schemas/Address" + "allOf": [ + { + "$ref": "#/components/schemas/Address" + } + ], + "nullable": true }, "billing": { - "$ref": "#/components/schemas/Address" + "allOf": [ + { + "$ref": "#/components/schemas/Address" + } + ], + "nullable": true }, "statement_descriptor_name": { "type": "string", "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.", "example": "Hyperswitch Router", + "nullable": true, "maxLength": 255 }, "statement_descriptor_suffix": { "type": "string", "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.", "example": "Payment for shoes purchase", + "nullable": true, "maxLength": 255 }, "metadata": { - "$ref": "#/components/schemas/Metadata" + "allOf": [ + { + "$ref": "#/components/schemas/Metadata" + } + ], + "nullable": true }, "client_secret": { "type": "string", "description": "It's a token used for client side verification.", - "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo" + "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo", + "nullable": true }, "mandate_data": { - "$ref": "#/components/schemas/MandateData" + "allOf": [ + { + "$ref": "#/components/schemas/MandateData" + } + ], + "nullable": true }, "mandate_id": { "type": "string", "description": "A unique identifier to link the payment to a mandate, can be use instead of payment_method_data", "example": "mandate_iwer89rnjef349dni3", + "nullable": true, "maxLength": 255 }, "browser_info": { "type": "object", - "description": "Additional details required by 3DS 2.0" + "description": "Additional details required by 3DS 2.0", + "nullable": true }, "payment_experience": { - "$ref": "#/components/schemas/PaymentExperience" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentExperience" + } + ], + "nullable": true }, "payment_method_type": { - "$ref": "#/components/schemas/PaymentMethodType" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodType" + } + ], + "nullable": true } } }, "PaymentsResponse": { "type": "object", "required": [ + "payment_id", + "merchant_id", "status", "amount", + "amount_capturable", + "amount_received", + "connector", + "client_secret", + "created", "currency", - "payment_method" + "customer_id", + "description", + "refunds", + "mandate_id", + "mandate_data", + "setup_future_usage", + "off_session", + "capture_on", + "capture_method", + "payment_method", + "payment_method_data", + "payment_token", + "shipping", + "billing", + "metadata", + "email", + "name", + "phone", + "return_url", + "authentication_type", + "statement_descriptor_name", + "statement_descriptor_suffix", + "next_action", + "cancellation_reason", + "error_code", + "error_message", + "payment_experience", + "payment_method_type" ], "properties": { "payment_id": { "type": "string", "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant.", "example": "pay_mbabizu24mvu3mela5njyhpit4", + "nullable": true, "maxLength": 30, "minLength": 30 }, @@ -4564,6 +5136,7 @@ "type": "string", "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request", "example": "merchant_1668273825", + "nullable": true, "maxLength": 255 }, "status": { @@ -4580,6 +5153,7 @@ "format": "int64", "description": "The maximum amount that could be captured from the payment", "example": 6540, + "nullable": true, "minimum": 100.0 }, "amount_received": { @@ -4587,23 +5161,27 @@ "format": "int64", "description": "The amount which is already captured from the payment", "example": 6540, + "nullable": true, "minimum": 100.0 }, "connector": { "type": "string", "description": "The connector used for the payment", - "example": "stripe" + "example": "stripe", + "nullable": true }, "client_secret": { "type": "string", "description": "It's a token used for client side verification.", - "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo" + "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo", + "nullable": true }, "created": { "type": "string", "format": "date-time", "description": "Time when the payment was created", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true }, "currency": { "$ref": "#/components/schemas/Currency" @@ -4612,127 +5190,194 @@ "type": "string", "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.", "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44", + "nullable": true, "maxLength": 255 }, "description": { "type": "string", "description": "A description of the payment", - "example": "It's my first payment request" + "example": "It's my first payment request", + "nullable": true }, "refunds": { "type": "array", "items": { "$ref": "#/components/schemas/RefundResponse" }, - "description": "List of refund that happened on this intent" + "description": "List of refund that happened on this intent", + "nullable": true }, "mandate_id": { "type": "string", "description": "A unique identifier to link the payment to a mandate, can be use instead of payment_method_data", "example": "mandate_iwer89rnjef349dni3", + "nullable": true, "maxLength": 255 }, "mandate_data": { - "$ref": "#/components/schemas/MandateData" + "allOf": [ + { + "$ref": "#/components/schemas/MandateData" + } + ], + "nullable": true }, "setup_future_usage": { - "$ref": "#/components/schemas/FutureUsage" + "allOf": [ + { + "$ref": "#/components/schemas/FutureUsage" + } + ], + "nullable": true }, "off_session": { "type": "boolean", "description": "Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with confirm=true.", - "example": true + "example": true, + "nullable": true }, "capture_on": { "type": "string", "format": "date-time", "description": "A timestamp (ISO 8601 code) that determines when the payment should be captured.\nProviding this field will automatically set `capture` to true", - "example": "2022-09-10T10:11:12Z" + "example": "2022-09-10T10:11:12Z", + "nullable": true }, "capture_method": { - "$ref": "#/components/schemas/CaptureMethod" + "allOf": [ + { + "$ref": "#/components/schemas/CaptureMethod" + } + ], + "nullable": true }, "payment_method": { "$ref": "#/components/schemas/PaymentMethodType" }, "payment_method_data": { - "$ref": "#/components/schemas/PaymentMethod" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethod" + } + ], + "nullable": true }, "payment_token": { "type": "string", "description": "Provide a reference to a stored payment method", - "example": "187282ab-40ef-47a9-9206-5099ba31e432" + "example": "187282ab-40ef-47a9-9206-5099ba31e432", + "nullable": true }, "shipping": { - "$ref": "#/components/schemas/Address" + "allOf": [ + { + "$ref": "#/components/schemas/Address" + } + ], + "nullable": true }, "billing": { - "$ref": "#/components/schemas/Address" + "allOf": [ + { + "$ref": "#/components/schemas/Address" + } + ], + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true }, "email": { "type": "string", "description": "description: The customer's email address", "example": "johntest@test.com", + "nullable": true, "maxLength": 255 }, "name": { "type": "string", "description": "description: The customer's name", "example": "John Test", + "nullable": true, "maxLength": 255 }, "phone": { "type": "string", "description": "The customer's phone number", "example": "3141592653", + "nullable": true, "maxLength": 255 }, "return_url": { "type": "string", "description": "The URL to redirect after the completion of the operation", - "example": "https://hyperswitch.io" + "example": "https://hyperswitch.io", + "nullable": true }, "authentication_type": { - "$ref": "#/components/schemas/AuthenticationType" + "allOf": [ + { + "$ref": "#/components/schemas/AuthenticationType" + } + ], + "nullable": true }, "statement_descriptor_name": { "type": "string", "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.", "example": "Hyperswitch Router", + "nullable": true, "maxLength": 255 }, "statement_descriptor_suffix": { "type": "string", "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 255 characters for the concatenated descriptor.", "example": "Payment for shoes purchase", + "nullable": true, "maxLength": 255 }, "next_action": { - "$ref": "#/components/schemas/NextAction" + "allOf": [ + { + "$ref": "#/components/schemas/NextAction" + } + ], + "nullable": true }, "cancellation_reason": { "type": "string", - "description": "If the payment was cancelled the reason provided here" + "description": "If the payment was cancelled the reason provided here", + "nullable": true }, "error_code": { "type": "string", "description": "If there was an error while calling the connectors the code is received here", - "example": "E0001" + "example": "E0001", + "nullable": true }, "error_message": { "type": "string", "description": "If there was an error while calling the connector the error message is received here", - "example": "Failed while verifying the card" + "example": "Failed while verifying the card", + "nullable": true }, "payment_experience": { - "$ref": "#/components/schemas/PaymentExperience" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentExperience" + } + ], + "nullable": true }, "payment_method_type": { - "$ref": "#/components/schemas/PaymentMethodType" + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodType" + } + ], + "nullable": true } } }, @@ -4740,7 +5385,10 @@ "type": "object", "required": [ "resource_id", - "force_sync" + "merchant_id", + "force_sync", + "param", + "connector" ], "properties": { "resource_id": { @@ -4748,7 +5396,8 @@ }, "merchant_id": { "type": "string", - "description": "The identifier for the Merchant Account." + "description": "The identifier for the Merchant Account.", + "nullable": true }, "force_sync": { "type": "boolean", @@ -4756,11 +5405,13 @@ }, "param": { "type": "string", - "description": "The parameters passed to a retrieve request" + "description": "The parameters passed to a retrieve request", + "nullable": true }, "connector": { "type": "string", - "description": "The name of the connector" + "description": "The name of the connector", + "nullable": true } } }, @@ -4853,55 +5504,72 @@ }, "PhoneDetails": { "type": "object", + "required": [ + "number", + "country_code" + ], "properties": { "number": { "type": "string", "description": "The contact number", - "example": "9999999999" + "example": "9999999999", + "nullable": true }, "country_code": { "type": "string", "description": "The country code attached to the number", - "example": "+1" + "example": "+1", + "nullable": true } } }, "RefundListRequest": { "type": "object", + "required": [ + "payment_id", + "limit" + ], "properties": { "payment_id": { "type": "string", - "description": "The identifier for the payment" + "description": "The identifier for the payment", + "nullable": true }, "limit": { "type": "integer", "format": "int64", - "description": "Limit on the number of objects to return" + "description": "Limit on the number of objects to return", + "nullable": true }, "created": { "type": "string", "format": "date-time", - "description": "The time at which refund is created" + "description": "The time at which refund is created", + "nullable": true }, "created.lt": { "type": "string", "format": "date-time", - "description": "Time less than the refund created time" + "description": "Time less than the refund created time", + "nullable": true }, "created.gt": { "type": "string", "format": "date-time", - "description": "Time greater than the refund created time" + "description": "Time greater than the refund created time", + "nullable": true }, "created.lte": { "type": "string", "format": "date-time", - "description": "Time less than or equals to the refund created time" + "description": "Time less than or equals to the refund created time", + "nullable": true }, "created.gte": { "type": "string", "format": "date-time", - "description": "Time greater than or equals to the refund created time" + "description": "Time greater than or equals to the refund created time", + "nullable": true } } }, @@ -4923,13 +5591,20 @@ "RefundRequest": { "type": "object", "required": [ - "payment_id" + "refund_id", + "payment_id", + "merchant_id", + "amount", + "reason", + "refund_type", + "metadata" ], "properties": { "refund_id": { "type": "string", "description": "Unique Identifier for the Refund. This is to ensure idempotency for multiple partial refund initiated against the same payment. If the identifiers is not defined by the merchant, this filed shall be auto generated and provide in the API response. It is recommended to generate uuid(v4) as the refund_id.", "example": "ref_mbabizu24mvu3mela5njyhpit4", + "nullable": true, "maxLength": 30, "minLength": 30 }, @@ -4944,6 +5619,7 @@ "type": "string", "description": "The identifier for the Merchant Account", "example": "y3oqhf46pyzuxjbcn2giaqnb44", + "nullable": true, "maxLength": 255 }, "amount": { @@ -4951,20 +5627,28 @@ "format": "int64", "description": "Total amount for which the refund is to be initiated. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc., If not provided, this will default to the full payment amount", "example": 6540, + "nullable": true, "minimum": 100.0 }, "reason": { "type": "string", "description": "An arbitrary string attached to the object. Often useful for displaying to users and your customer support executive", "example": "Customer returned the product", + "nullable": true, "maxLength": 255 }, "refund_type": { - "$ref": "#/components/schemas/RefundType" + "allOf": [ + { + "$ref": "#/components/schemas/RefundType" + } + ], + "nullable": true }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true } } }, @@ -4975,7 +5659,13 @@ "payment_id", "amount", "currency", - "status" + "reason", + "status", + "metadata", + "error_message", + "error_code", + "created_at", + "updated_at" ], "properties": { "refund_id": { @@ -4997,32 +5687,38 @@ }, "reason": { "type": "string", - "description": "An arbitrary string attached to the object. Often useful for displaying to users and your customer support executive" + "description": "An arbitrary string attached to the object. Often useful for displaying to users and your customer support executive", + "nullable": true }, "status": { "$ref": "#/components/schemas/RefundStatus" }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object" + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object", + "nullable": true }, "error_message": { "type": "string", - "description": "The error message" + "description": "The error message", + "nullable": true }, "error_code": { "type": "string", - "description": "The code for the error" + "description": "The code for the error", + "nullable": true }, "created_at": { "type": "string", "format": "date-time", - "description": "The timestamp at which refund is created" + "description": "The timestamp at which refund is created", + "nullable": true }, "updated_at": { "type": "string", "format": "date-time", - "description": "The timestamp at which refund is updated" + "description": "The timestamp at which refund is updated", + "nullable": true } } }, @@ -5045,16 +5741,22 @@ }, "RefundUpdateRequest": { "type": "object", + "required": [ + "reason", + "metadata" + ], "properties": { "reason": { "type": "string", "description": "An arbitrary string attached to the object. Often useful for displaying to users and your customer support executive", "example": "Customer returned the product", + "nullable": true, "maxLength": 255 }, "metadata": { "type": "object", - "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object." + "description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.", + "nullable": true } } }, @@ -5065,6 +5767,7 @@ "key_id", "merchant_id", "name", + "description", "prefix", "created", "expiration" @@ -5092,6 +5795,7 @@ "type": "string", "description": "The description to provide more context about the API Key.", "example": "Key used by our developers to integrate with the sandbox environment", + "nullable": true, "maxLength": 256 }, "prefix": { @@ -5246,21 +5950,33 @@ "UpdateApiKeyRequest": { "type": "object", "description": "The request body for updating an API Key.", + "required": [ + "name", + "description", + "expiration" + ], "properties": { "name": { "type": "string", "description": "A unique name for the API Key to help you identify it.", "example": "Sandbox integration key", + "nullable": true, "maxLength": 64 }, "description": { "type": "string", "description": "A description to provide more context about the API Key.", "example": "Key used by our developers to integrate with the sandbox environment", + "nullable": true, "maxLength": 256 }, "expiration": { - "$ref": "#/components/schemas/ApiKeyExpiration" + "allOf": [ + { + "$ref": "#/components/schemas/ApiKeyExpiration" + } + ], + "nullable": true } } }, @@ -5314,44 +6030,60 @@ }, "WebhookDetails": { "type": "object", + "required": [ + "webhook_version", + "webhook_username", + "webhook_password", + "webhook_url", + "payment_created_enabled", + "payment_succeeded_enabled", + "payment_failed_enabled" + ], "properties": { "webhook_version": { "type": "string", "description": "The version for Webhook", "example": "1.0.2", + "nullable": true, "maxLength": 255 }, "webhook_username": { "type": "string", "description": "The user name for Webhook login", "example": "ekart_retail", + "nullable": true, "maxLength": 255 }, "webhook_password": { "type": "string", "description": "The password for Webhook login", "example": "ekart@123", + "nullable": true, "maxLength": 255 }, "webhook_url": { "type": "string", "description": "The url for the webhook endpoint", - "example": "www.ekart.com/webhooks" + "example": "www.ekart.com/webhooks", + "nullable": true }, "payment_created_enabled": { "type": "boolean", "description": "If this property is true, a webhook message is posted whenever a new payment is created", - "example": true + "example": true, + "nullable": true }, "payment_succeeded_enabled": { "type": "boolean", "description": "If this property is true, a webhook message is posted whenever a payment is successful", - "example": true + "example": true, + "nullable": true }, "payment_failed_enabled": { "type": "boolean", "description": "If this property is true, a webhook message is posted whenever a payment fails", - "example": true + "example": true, + "nullable": true } } }