From e7af4d5f88625b9fc1314f75dda23c831740d295 Mon Sep 17 00:00:00 2001 From: Sarthak Soni Date: Wed, 29 Nov 2023 17:53:36 +0530 Subject: [PATCH] feat(routing): Updated openapi spec to include routing APIs --- crates/api_models/src/routing.rs | 15 +- crates/router/src/openapi.rs | 38 +- crates/router/src/routes/routing.rs | 144 ++ openapi/openapi_spec.json | 2732 ++++++++++++++++++--------- 4 files changed, 2063 insertions(+), 866 deletions(-) diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index 47a44ea7443e..479b1d2dffa1 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -11,6 +11,7 @@ use euclid::{ }, }; use serde::{Deserialize, Serialize}; +use utoipa::ToSchema; use crate::enums::{self, RoutableConnectors}; @@ -32,7 +33,7 @@ impl ConnectorSelection { } } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] pub struct RoutingConfigRequest { pub name: Option, pub description: Option, @@ -40,7 +41,7 @@ pub struct RoutingConfigRequest { pub profile_id: Option, } -#[derive(Debug, serde::Serialize)] +#[derive(Debug, serde::Serialize, ToSchema)] pub struct ProfileDefaultRoutingConfig { pub profile_id: String, pub connectors: Vec, @@ -66,14 +67,14 @@ pub struct RoutingRetrieveResponse { pub algorithm: Option, } -#[derive(Debug, serde::Serialize)] +#[derive(Debug, serde::Serialize, ToSchema)] #[serde(untagged)] pub enum LinkedRoutingConfigRetrieveResponse { MerchantAccountBased(RoutingRetrieveResponse), ProfileBased(Vec), } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] pub struct MerchantRoutingAlgorithm { pub id: String, #[cfg(feature = "business_profile_routing")] @@ -181,7 +182,7 @@ pub enum RoutableChoiceSerde { }, } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] #[cfg_attr( feature = "connector_choice_bcompat", serde(from = "RoutableChoiceSerde"), @@ -581,7 +582,7 @@ impl RoutingAlgorithmRef { } } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] pub struct RoutingDictionaryRecord { pub id: String, @@ -601,7 +602,7 @@ pub struct RoutingDictionary { pub records: Vec, } -#[derive(serde::Serialize, serde::Deserialize, Debug)] +#[derive(serde::Serialize, serde::Deserialize, Debug, ToSchema)] #[serde(untagged)] pub enum RoutingKind { Config(RoutingDictionary), diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs index ec38389cdc42..fcac3fad779c 100644 --- a/crates/router/src/openapi.rs +++ b/crates/router/src/openapi.rs @@ -62,6 +62,7 @@ Never share your secret api keys. Keep them guarded and secure. // (name = "API Key", description = "Create and manage API Keys"), (name = "Payouts", description = "Create and manage payouts"), (name = "payment link", description = "Create payment link"), + (name = "Routing", description = "Create and manage routing configurations"), ), paths( crate::routes::refunds::refunds_create, @@ -69,15 +70,15 @@ Never share your secret api keys. Keep them guarded and secure. crate::routes::refunds::refunds_update, crate::routes::refunds::refunds_list, // Commenting this out as these are admin apis and not to be used by the merchant - // crate::routes::admin::merchant_account_create, - // crate::routes::admin::retrieve_merchant_account, - // crate::routes::admin::update_merchant_account, - // crate::routes::admin::delete_merchant_account, - // crate::routes::admin::payment_connector_create, - // crate::routes::admin::payment_connector_retrieve, - // crate::routes::admin::payment_connector_list, - // crate::routes::admin::payment_connector_update, - // crate::routes::admin::payment_connector_delete, + crate::routes::admin::merchant_account_create, + crate::routes::admin::retrieve_merchant_account, + crate::routes::admin::update_merchant_account, + crate::routes::admin::delete_merchant_account, + crate::routes::admin::payment_connector_create, + crate::routes::admin::payment_connector_retrieve, + crate::routes::admin::payment_connector_list, + crate::routes::admin::payment_connector_update, + crate::routes::admin::payment_connector_delete, crate::routes::mandates::get_mandate, crate::routes::mandates::revoke_mandate, crate::routes::payments::payments_create, @@ -119,6 +120,16 @@ Never share your secret api keys. Keep them guarded and secure. crate::routes::gsm::get_gsm_rule, crate::routes::gsm::update_gsm_rule, crate::routes::gsm::delete_gsm_rule, + crate::routes::routing::routing_create_config, + crate::routes::routing::routing_link_config, + crate::routes::routing::routing_retrieve_config, + crate::routes::routing::routing_retrieve_dictionary, + crate::routes::routing::routing_unlink_config, + crate::routes::routing::routing_update_default_config, + crate::routes::routing::routing_retrieve_default_config, + crate::routes::routing::routing_retrieve_linked_config, + crate::routes::routing::routing_retrieve_default_config_for_profiles, + crate::routes::routing::routing_update_default_config_for_profile, ), components(schemas( crate::types::api::refunds::RefundRequest, @@ -361,7 +372,14 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::PaymentLinkResponse, api_models::payments::RetrievePaymentLinkResponse, api_models::payments::PaymentLinkInitiateRequest, - api_models::payments::PaymentLinkObject + api_models::payments::PaymentLinkObject, + api_models::routing::RoutingConfigRequest, + api_models::routing::RoutingDictionaryRecord, + api_models::routing::RoutingKind, + api_models::routing::RoutableConnectorChoice, + api_models::routing::LinkedRoutingConfigRetrieveResponse, + api_models::routing::ProfileDefaultRoutingConfig, + api_models::routing::MerchantRoutingAlgorithm, )), modifiers(&SecurityAddon) )] diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs index e7e31cb36aeb..4408df71206b 100644 --- a/crates/router/src/routes/routing.rs +++ b/crates/router/src/routes/routing.rs @@ -17,6 +17,22 @@ use crate::{ services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; +#[utoipa::path( + post, + path = "/routing", + request_body = RoutingConfigRequest, + responses( + (status = 200, description = "Routing config created", body = RoutingDictionaryRecord), + (status = 400, description = "Request body is malformed"), + (status = 500, description = "Internal server error"), + (status = 404, description = "Resource missing"), + (status = 422, description = "Unprocessable request"), + (status = 403, description = "Forbidden"), + ), + tag = "Routing", + operation_id = "Create a routing config", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_create_config( @@ -46,6 +62,22 @@ pub async fn routing_create_config( .await } +#[utoipa::path( + post, + path = "/routing/{algorithm_id}/activate", + params( + ("algorithm_id" = String, Path, description = "The unique identifier for an algorithm"), + ), + responses( + (status = 200, description = "Routing config activated", body = RoutingDictionaryRecord), + (status = 500, description = "Internal server error"), + (status = 404, description = "Resource missing"), + (status = 400, description = "Bad request") + ), + tag = "Routing", + operation_id = "Activate a routing config", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_link_config( @@ -81,6 +113,22 @@ pub async fn routing_link_config( .await } +#[utoipa::path( + get, + path = "/routing/{algorithm_id}", + params( + ("algorithm_id" = String, Path, description = "The unique identifier for an algorithm"), + ), + responses( + (status = 200, description = "Successfully fetched routing algorithm", body = MerchantRoutingAlgorithm), + (status = 500, description = "Internal server error"), + (status = 404, description = "Resource missing"), + (status = 403, description = "Forbidden") + ), + tag = "Routing", + operation_id = "Retrieve a routing algorithm", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_retrieve_config( @@ -111,6 +159,18 @@ pub async fn routing_retrieve_config( .await } +#[utoipa::path( + get, + path = "/routing", + responses( + (status = 200, description = "Successfully fetched routing dictionary", body = RoutingKind), + (status = 500, description = "Internal server error"), + (status = 404, description = "Resource missing") + ), + tag = "Routing", + operation_id = "Retrieve routing dictionary", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_retrieve_dictionary( @@ -171,6 +231,21 @@ pub async fn routing_retrieve_dictionary( } } +#[utoipa::path( + post, + path = "/routing/deactivate", + request_body = RoutingConfigRequest, + responses( + (status = 200, description = "Successfully deactivated routing config", body = RoutingDictionaryRecord), + (status = 500, description = "Internal server error"), + (status = 400, description = "Malformed request"), + (status = 403, description = "Malformed request"), + (status = 422, description = "Unprocessable request") + ), + tag = "Routing", + operation_id = "Deactivate a routing config", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_unlink_config( @@ -229,6 +304,20 @@ pub async fn routing_unlink_config( } } +#[utoipa::path( + post, + path = "/routing/default", + request_body = Vec, + responses( + (status = 200, description = "Successfully updated default config", body = Vec), + (status = 500, description = "Internal server error"), + (status = 400, description = "Malformed request"), + (status = 422, description = "Unprocessable request") + ), + tag = "Routing", + operation_id = "Update default config", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_update_default_config( @@ -257,6 +346,17 @@ pub async fn routing_update_default_config( .await } +#[utoipa::path( + get, + path = "/routing/default", + responses( + (status = 200, description = "Successfully retrieved default config", body = Vec), + (status = 500, description = "Internal server error") + ), + tag = "Routing", + operation_id = "Retrieve default config", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_retrieve_default_config( @@ -474,6 +574,19 @@ pub async fn retrieve_decision_manager_config( .await } +#[utoipa::path( + get, + path = "/routing/active", + responses( + (status = 200, description = "Successfully retrieved active config", body = LinkedRoutingConfigRetrieveResponse), + (status = 500, description = "Internal server error"), + (status = 404, description = "Resource missing"), + (status = 403, description = "Forbidden") + ), + tag = "Routing", + operation_id = "Retrieve active config", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_retrieve_linked_config( @@ -531,6 +644,18 @@ pub async fn routing_retrieve_linked_config( } } +#[utoipa::path( + get, + path = "/routing/default/profile", + responses( + (status = 200, description = "Successfully retrieved default config", body = ProfileDefaultRoutingConfig), + (status = 500, description = "Internal server error"), + (status = 404, description = "Resource missing") + ), + tag = "Routing", + operation_id = "Retrieve default config for profiles", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_retrieve_default_config_for_profiles( @@ -562,6 +687,25 @@ pub async fn routing_retrieve_default_config_for_profiles( .await } +#[utoipa::path( + post, + path = "/routing/default/profile/{profile_id}", + request_body = Vec, + params( + ("profile_id" = String, Path, description = "The unique identifier for a profile"), + ), + responses( + (status = 200, description = "Successfully updated default config for profile", body = ProfileDefaultRoutingConfig), + (status = 500, description = "Internal server error"), + (status = 404, description = "Resource missing"), + (status = 400, description = "Malformed request"), + (status = 422, description = "Unprocessable request"), + (status = 403, description = "Forbidden"), + ), + tag = "Routing", + operation_id = "Update default config for profile", + security(("api_key" = []), ("jwt_key" = [])) +)] #[cfg(feature = "olap")] #[instrument(skip_all)] pub async fn routing_update_default_config_for_profile( diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index 08f415782963..dc52bb8896b6 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -129,19 +129,19 @@ ] } }, - "/customers": { + "/accounts": { "post": { "tags": [ - "Customers" + "Merchant Account" ], - "summary": "Create Customer", - "description": "Create Customer\n\nCreate a customer object and store the customer details to be reused for future payments. Incase the customer already exists in the system, this API will respond with the customer details.", - "operationId": "Create a Customer", + "summary": "Merchant Account - Create", + "description": "Merchant Account - Create\n\nCreate a new account for a merchant and the merchant could be a seller or retailer or client who likes to receive and send payments.", + "operationId": "Create a Merchant Account", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerRequest" + "$ref": "#/components/schemas/MerchantAccountCreate" } } }, @@ -149,11 +149,11 @@ }, "responses": { "200": { - "description": "Customer Created", + "description": "Merchant Account Created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/MerchantAccountResponse" } } } @@ -164,172 +164,153 @@ }, "security": [ { - "api_key": [] + "admin_api_key": [] } ] } }, - "/customers/list": { - "post": { + "/accounts/{account_id}": { + "get": { "tags": [ - "Customers List" + "Merchant Account" + ], + "summary": "Merchant Account - Retrieve", + "description": "Merchant Account - Retrieve\n\nRetrieve a merchant account details.", + "operationId": "Retrieve a Merchant Account", + "parameters": [ + { + "name": "account_id", + "in": "path", + "description": "The unique identifier for the merchant account", + "required": true, + "schema": { + "type": "string" + } + } ], - "summary": "List customers for a merchant", - "description": "List customers for a merchant\n\nTo filter and list the customers for a particular merchant id", - "operationId": "List all Customers for a Merchant", "responses": { "200": { - "description": "Customers retrieved", + "description": "Merchant Account Retrieved", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CustomerResponse" - } + "$ref": "#/components/schemas/MerchantAccountResponse" } } } }, - "400": { - "description": "Invalid Data" + "404": { + "description": "Merchant account not found" } }, "security": [ { - "api_key": [] + "admin_api_key": [] } ] - } - }, - "/customers/payment_methods": { - "get": { + }, + "post": { "tags": [ - "Payment Methods" + "Merchant Account" ], - "summary": "List payment methods for a Customer", - "description": "List payment methods for a Customer\n\nTo filter and list the applicable payment methods for a particular Customer ID", - "operationId": "List all Payment Methods for a Customer", + "summary": "Merchant Account - Update", + "description": "Merchant Account - Update\n\nTo update an existing merchant account. Helpful in updating merchant details such as email, contact details, or other configuration details like webhook, routing algorithm etc", + "operationId": "Update a Merchant Account", "parameters": [ { - "name": "client-secret", - "in": "path", - "description": "A secret known only to your application and the authorization server", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "customer_id", + "name": "account_id", "in": "path", - "description": "The unique identifier for the customer account", + "description": "The unique identifier for the merchant account", "required": true, "schema": { "type": "string" } - }, - { - "name": "accepted_country", - "in": "query", - "description": "The two-letter ISO currency code", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchantAccountUpdate" } } }, - { - "name": "accepted_currency", - "in": "path", - "description": "The three-letter ISO currency code", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Currency" + "required": true + }, + "responses": { + "200": { + "description": "Merchant Account Updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchantAccountResponse" + } } } }, + "404": { + "description": "Merchant account not found" + } + }, + "security": [ { - "name": "minimum_amount", - "in": "query", - "description": "The minimum amount accepted for processing by the particular payment method.", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - }, - { - "name": "maximum_amount", - "in": "query", - "description": "The maximum amount amount accepted for processing by the particular payment method.", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - }, - { - "name": "recurring_payment_enabled", - "in": "query", - "description": "Indicates whether the payment method is eligible for recurring payments", - "required": true, - "schema": { - "type": "boolean" - } - }, + "admin_api_key": [] + } + ] + }, + "delete": { + "tags": [ + "Merchant Account" + ], + "summary": "Merchant Account - Delete", + "description": "Merchant Account - Delete\n\nTo delete a merchant account", + "operationId": "Delete a Merchant Account", + "parameters": [ { - "name": "installment_payment_enabled", - "in": "query", - "description": "Indicates whether the payment method is eligible for installment payments", + "name": "account_id", + "in": "path", + "description": "The unique identifier for the merchant account", "required": true, "schema": { - "type": "boolean" + "type": "string" } } ], "responses": { "200": { - "description": "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", + "description": "Merchant Account Deleted", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse" + "$ref": "#/components/schemas/MerchantAccountDeleteResponse" } } } }, - "400": { - "description": "Invalid Data" - }, "404": { - "description": "Payment Methods does not exist in records" + "description": "Merchant account not found" } }, "security": [ { - "publishable_key": [] + "admin_api_key": [] } ] } }, - "/customers/{customer_id}": { + "/accounts/{account_id}/connectors": { "get": { "tags": [ - "Customers" + "Merchant Connector Account" ], - "summary": "Retrieve Customer", - "description": "Retrieve Customer\n\nRetrieve a customer's details.", - "operationId": "Retrieve a Customer", + "summary": "Merchant Connector - List", + "description": "Merchant Connector - List\n\nList Merchant Connector Details for the merchant", + "operationId": "List all Merchant Connectors", "parameters": [ { - "name": "customer_id", + "name": "account_id", "in": "path", - "description": "The unique identifier for the Customer", + "description": "The unique identifier for the merchant account", "required": true, "schema": { "type": "string" @@ -338,51 +319,43 @@ ], "responses": { "200": { - "description": "Customer Retrieved", + "description": "Merchant Connector list retrieved successfully", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/MerchantConnectorResponse" + } } } } }, + "401": { + "description": "Unauthorized request" + }, "404": { - "description": "Customer was not found" + "description": "Merchant Connector does not exist in records" } }, "security": [ { - "api_key": [] - }, - { - "ephemeral_key": [] + "admin_api_key": [] } ] }, "post": { "tags": [ - "Customers" - ], - "summary": "Update Customer", - "description": "Update Customer\n\nUpdates the customer's details in a customer object.", - "operationId": "Update a Customer", - "parameters": [ - { - "name": "customer_id", - "in": "path", - "description": "The unique identifier for the Customer", - "required": true, - "schema": { - "type": "string" - } - } + "Merchant Connector Account" ], + "summary": "PaymentsConnectors - Create", + "description": "PaymentsConnectors - Create\n\nCreate a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc.\"", + "operationId": "Create a Merchant Connector", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerRequest" + "$ref": "#/components/schemas/MerchantConnectorCreate" } } }, @@ -390,97 +363,308 @@ }, "responses": { "200": { - "description": "Customer was Updated", + "description": "Merchant Connector Created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/MerchantConnectorResponse" } } } }, - "404": { - "description": "Customer was not found" + "400": { + "description": "Missing Mandatory fields" } }, "security": [ { - "api_key": [] + "admin_api_key": [] } ] - }, - "delete": { + } + }, + "/accounts/{account_id}/connectors/{connector_id}": { + "get": { "tags": [ - "Customers" + "Merchant Connector Account" ], - "summary": "Delete Customer", - "description": "Delete Customer\n\nDelete a customer record.", - "operationId": "Delete a Customer", + "summary": "Merchant Connector - Retrieve", + "description": "Merchant Connector - Retrieve\n\nRetrieve Merchant Connector Details", + "operationId": "Retrieve a Merchant Connector", "parameters": [ { - "name": "customer_id", + "name": "account_id", "in": "path", - "description": "The unique identifier for the Customer", + "description": "The unique identifier for the merchant account", "required": true, "schema": { "type": "string" } + }, + { + "name": "connector_id", + "in": "path", + "description": "The unique identifier for the Merchant Connector", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } } ], "responses": { "200": { - "description": "Customer was Deleted", + "description": "Merchant Connector retrieved successfully", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerDeleteResponse" + "$ref": "#/components/schemas/MerchantConnectorResponse" } } } }, + "401": { + "description": "Unauthorized request" + }, "404": { - "description": "Customer was not found" + "description": "Merchant Connector does not exist in records" } }, "security": [ { - "api_key": [] + "admin_api_key": [] } ] - } - }, - "/customers/{customer_id}/payment_methods": { - "get": { + }, + "post": { "tags": [ - "Payment Methods" + "Merchant Connector Account" ], - "summary": "List payment methods for a Customer", - "description": "List payment methods for a Customer\n\nTo filter and list the applicable payment methods for a particular Customer ID", - "operationId": "List all Payment Methods for a Customer", + "summary": "Merchant Connector - Update", + "description": "Merchant Connector - Update\n\nTo update an existing Merchant Connector. Helpful in enabling / disabling different payment methods and other settings for the connector etc.", + "operationId": "Update a Merchant Connector", "parameters": [ { - "name": "customer_id", + "name": "account_id", "in": "path", - "description": "The unique identifier for the customer account", + "description": "The unique identifier for the merchant account", "required": true, "schema": { "type": "string" } }, { - "name": "accepted_country", - "in": "query", - "description": "The two-letter ISO currency code", + "name": "connector_id", + "in": "path", + "description": "The unique identifier for the Merchant Connector", "required": true, "schema": { - "type": "array", - "items": { - "type": "string" + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchantConnectorUpdate" } } }, - { - "name": "accepted_currency", + "required": true + }, + "responses": { + "200": { + "description": "Merchant Connector Updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchantConnectorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized request" + }, + "404": { + "description": "Merchant Connector does not exist in records" + } + }, + "security": [ + { + "admin_api_key": [] + } + ] + }, + "delete": { + "tags": [ + "Merchant Connector Account" + ], + "summary": "Merchant Connector - Delete", + "description": "Merchant Connector - Delete\n\nDelete or Detach a Merchant Connector from Merchant Account", + "operationId": "Delete a Merchant Connector", + "parameters": [ + { + "name": "account_id", + "in": "path", + "description": "The unique identifier for the merchant account", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "connector_id", + "in": "path", + "description": "The unique identifier for the Merchant Connector", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Merchant Connector Deleted", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchantConnectorDeleteResponse" + } + } + } + }, + "401": { + "description": "Unauthorized request" + }, + "404": { + "description": "Merchant Connector does not exist in records" + } + }, + "security": [ + { + "admin_api_key": [] + } + ] + } + }, + "/customers": { + "post": { + "tags": [ + "Customers" + ], + "summary": "Create Customer", + "description": "Create Customer\n\nCreate a customer object and store the customer details to be reused for future payments. Incase the customer already exists in the system, this API will respond with the customer details.", + "operationId": "Create a Customer", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Customer Created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerResponse" + } + } + } + }, + "400": { + "description": "Invalid data" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/customers/list": { + "post": { + "tags": [ + "Customers List" + ], + "summary": "List customers for a merchant", + "description": "List customers for a merchant\n\nTo filter and list the customers for a particular merchant id", + "operationId": "List all Customers for a Merchant", + "responses": { + "200": { + "description": "Customers retrieved", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerResponse" + } + } + } + } + }, + "400": { + "description": "Invalid Data" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/customers/payment_methods": { + "get": { + "tags": [ + "Payment Methods" + ], + "summary": "List payment methods for a Customer", + "description": "List payment methods for a Customer\n\nTo filter and list the applicable payment methods for a particular Customer ID", + "operationId": "List all Payment Methods for a Customer", + "parameters": [ + { + "name": "client-secret", + "in": "path", + "description": "A secret known only to your application and the authorization server", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "customer_id", + "in": "path", + "description": "The unique identifier for the customer account", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "accepted_country", + "in": "query", + "description": "The two-letter ISO currency code", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "accepted_currency", "in": "path", "description": "The three-letter ISO currency code", "required": true, @@ -532,7 +716,7 @@ ], "responses": { "200": { - "description": "Payment Methods retrieved", + "description": "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", "content": { "application/json": { "schema": { @@ -550,151 +734,240 @@ }, "security": [ { - "api_key": [] + "publishable_key": [] } ] } }, - "/disputes/list": { + "/customers/{customer_id}": { "get": { "tags": [ - "Disputes" + "Customers" ], - "summary": "Disputes - List Disputes", - "description": "Disputes - List Disputes", - "operationId": "List Disputes", + "summary": "Retrieve Customer", + "description": "Retrieve Customer\n\nRetrieve a customer's details.", + "operationId": "Retrieve a Customer", "parameters": [ { - "name": "limit", - "in": "query", - "description": "The maximum number of Dispute Objects to include in the response", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "nullable": true - } - }, - { - "name": "dispute_status", - "in": "query", - "description": "The status of dispute", - "required": false, + "name": "customer_id", + "in": "path", + "description": "The unique identifier for the Customer", + "required": true, "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/DisputeStatus" - } - ], - "nullable": true + "type": "string" } - }, - { - "name": "dispute_stage", - "in": "query", - "description": "The stage of dispute", - "required": false, - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/DisputeStage" + } + ], + "responses": { + "200": { + "description": "Customer Retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerResponse" } - ], - "nullable": true + } } }, + "404": { + "description": "Customer was not found" + } + }, + "security": [ { - "name": "reason", - "in": "query", - "description": "The reason for dispute", - "required": false, - "schema": { - "type": "string", - "nullable": true - } + "api_key": [] }, { - "name": "connector", - "in": "query", - "description": "The connector linked to dispute", - "required": false, + "ephemeral_key": [] + } + ] + }, + "post": { + "tags": [ + "Customers" + ], + "summary": "Update Customer", + "description": "Update Customer\n\nUpdates the customer's details in a customer object.", + "operationId": "Update a Customer", + "parameters": [ + { + "name": "customer_id", + "in": "path", + "description": "The unique identifier for the Customer", + "required": true, "schema": { - "type": "string", - "nullable": true + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Customer was Updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerResponse" + } + } } }, + "404": { + "description": "Customer was not found" + } + }, + "security": [ { - "name": "received_time", + "api_key": [] + } + ] + }, + "delete": { + "tags": [ + "Customers" + ], + "summary": "Delete Customer", + "description": "Delete Customer\n\nDelete a customer record.", + "operationId": "Delete a Customer", + "parameters": [ + { + "name": "customer_id", + "in": "path", + "description": "The unique identifier for the Customer", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Customer was Deleted", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerDeleteResponse" + } + } + } + }, + "404": { + "description": "Customer was not found" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/customers/{customer_id}/payment_methods": { + "get": { + "tags": [ + "Payment Methods" + ], + "summary": "List payment methods for a Customer", + "description": "List payment methods for a Customer\n\nTo filter and list the applicable payment methods for a particular Customer ID", + "operationId": "List all Payment Methods for a Customer", + "parameters": [ + { + "name": "customer_id", + "in": "path", + "description": "The unique identifier for the customer account", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "accepted_country", "in": "query", - "description": "The time at which dispute is received", - "required": false, + "description": "The two-letter ISO currency code", + "required": true, "schema": { - "type": "string", - "format": "date-time", - "nullable": true + "type": "array", + "items": { + "type": "string" + } } }, { - "name": "received_time.lt", + "name": "accepted_currency", + "in": "path", + "description": "The three-letter ISO currency code", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Currency" + } + } + }, + { + "name": "minimum_amount", "in": "query", - "description": "Time less than the dispute received time", - "required": false, + "description": "The minimum amount accepted for processing by the particular payment method.", + "required": true, "schema": { - "type": "string", - "format": "date-time", - "nullable": true + "type": "integer", + "format": "int64" } }, { - "name": "received_time.gt", + "name": "maximum_amount", "in": "query", - "description": "Time greater than the dispute received time", - "required": false, + "description": "The maximum amount amount accepted for processing by the particular payment method.", + "required": true, "schema": { - "type": "string", - "format": "date-time", - "nullable": true + "type": "integer", + "format": "int64" } }, { - "name": "received_time.lte", + "name": "recurring_payment_enabled", "in": "query", - "description": "Time less than or equals to the dispute received time", - "required": false, + "description": "Indicates whether the payment method is eligible for recurring payments", + "required": true, "schema": { - "type": "string", - "format": "date-time", - "nullable": true + "type": "boolean" } }, { - "name": "received_time.gte", + "name": "installment_payment_enabled", "in": "query", - "description": "Time greater than or equals to the dispute received time", - "required": false, + "description": "Indicates whether the payment method is eligible for installment payments", + "required": true, "schema": { - "type": "string", - "format": "date-time", - "nullable": true + "type": "boolean" } } ], "responses": { "200": { - "description": "The dispute list was retrieved successfully", + "description": "Payment Methods retrieved", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DisputeResponse" - } + "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse" } } } }, - "401": { - "description": "Unauthorized request" + "400": { + "description": "Invalid Data" + }, + "404": { + "description": "Payment Methods does not exist in records" } }, "security": [ @@ -704,38 +977,804 @@ ] } }, - "/disputes/{dispute_id}": { + "/disputes/list": { "get": { "tags": [ "Disputes" ], - "summary": "Disputes - Retrieve Dispute", - "description": "Disputes - Retrieve Dispute", - "operationId": "Retrieve a Dispute", + "summary": "Disputes - List Disputes", + "description": "Disputes - List Disputes", + "operationId": "List Disputes", "parameters": [ { - "name": "dispute_id", - "in": "path", - "description": "The identifier for dispute", + "name": "limit", + "in": "query", + "description": "The maximum number of Dispute Objects to include in the response", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + { + "name": "dispute_status", + "in": "query", + "description": "The status of dispute", + "required": false, + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/DisputeStatus" + } + ], + "nullable": true + } + }, + { + "name": "dispute_stage", + "in": "query", + "description": "The stage of dispute", + "required": false, + "schema": { + "allOf": [ + { + "$ref": "#/components/schemas/DisputeStage" + } + ], + "nullable": true + } + }, + { + "name": "reason", + "in": "query", + "description": "The reason for dispute", + "required": false, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "connector", + "in": "query", + "description": "The connector linked to dispute", + "required": false, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "received_time", + "in": "query", + "description": "The time at which dispute is received", + "required": false, + "schema": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + { + "name": "received_time.lt", + "in": "query", + "description": "Time less than the dispute received time", + "required": false, + "schema": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + { + "name": "received_time.gt", + "in": "query", + "description": "Time greater than the dispute received time", + "required": false, + "schema": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + { + "name": "received_time.lte", + "in": "query", + "description": "Time less than or equals to the dispute received time", + "required": false, + "schema": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + { + "name": "received_time.gte", + "in": "query", + "description": "Time greater than or equals to the dispute received time", + "required": false, + "schema": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + ], + "responses": { + "200": { + "description": "The dispute list was retrieved successfully", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DisputeResponse" + } + } + } + } + }, + "401": { + "description": "Unauthorized request" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/disputes/{dispute_id}": { + "get": { + "tags": [ + "Disputes" + ], + "summary": "Disputes - Retrieve Dispute", + "description": "Disputes - Retrieve Dispute", + "operationId": "Retrieve a Dispute", + "parameters": [ + { + "name": "dispute_id", + "in": "path", + "description": "The identifier for dispute", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The dispute was retrieved successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DisputeResponse" + } + } + } + }, + "404": { + "description": "Dispute does not exist in our records" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/gsm": { + "post": { + "tags": [ + "Gsm" + ], + "summary": "Gsm - Create", + "description": "Gsm - Create\n\nTo create a Gsm Rule", + "operationId": "Create Gsm Rule", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GsmCreateRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Gsm created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GsmResponse" + } + } + } + }, + "400": { + "description": "Missing Mandatory fields" + } + }, + "security": [ + { + "admin_api_key": [] + } + ] + } + }, + "/gsm/delete": { + "post": { + "tags": [ + "Gsm" + ], + "summary": "Gsm - Delete", + "description": "Gsm - Delete\n\nTo delete a Gsm Rule", + "operationId": "Delete Gsm Rule", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GsmDeleteRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Gsm deleted", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GsmDeleteResponse" + } + } + } + }, + "400": { + "description": "Missing Mandatory fields" + } + }, + "security": [ + { + "admin_api_key": [] + } + ] + } + }, + "/gsm/get": { + "post": { + "tags": [ + "Gsm" + ], + "summary": "Gsm - Get", + "description": "Gsm - Get\n\nTo get a Gsm Rule", + "operationId": "Retrieve Gsm Rule", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GsmRetrieveRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Gsm retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GsmResponse" + } + } + } + }, + "400": { + "description": "Missing Mandatory fields" + } + }, + "security": [ + { + "admin_api_key": [] + } + ] + } + }, + "/gsm/update": { + "post": { + "tags": [ + "Gsm" + ], + "summary": "Gsm - Update", + "description": "Gsm - Update\n\nTo update a Gsm Rule", + "operationId": "Update Gsm Rule", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GsmUpdateRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Gsm updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GsmResponse" + } + } + } + }, + "400": { + "description": "Missing Mandatory fields" + } + }, + "security": [ + { + "admin_api_key": [] + } + ] + } + }, + "/mandates/revoke/{mandate_id}": { + "post": { + "tags": [ + "Mandates" + ], + "summary": "Mandates - Revoke Mandate", + "description": "Mandates - Revoke Mandate\n\nRevoke a mandate", + "operationId": "Revoke a Mandate", + "parameters": [ + { + "name": "mandate_id", + "in": "path", + "description": "The identifier for mandate", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The mandate was revoked successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MandateRevokedResponse" + } + } + } + }, + "400": { + "description": "Mandate does not exist in our records" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/mandates/{mandate_id}": { + "get": { + "tags": [ + "Mandates" + ], + "summary": "Mandates - Retrieve Mandate", + "description": "Mandates - Retrieve Mandate\n\nRetrieve a mandate", + "operationId": "Retrieve a Mandate", + "parameters": [ + { + "name": "mandate_id", + "in": "path", + "description": "The identifier for mandate", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The mandate was retrieved successfully", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MandateResponse" + } + } + } + }, + "404": { + "description": "Mandate does not exist in our records" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/payment_link/{payment_link_id}": { + "get": { + "tags": [ + "Payments" + ], + "summary": "Payments Link - Retrieve", + "description": "Payments Link - Retrieve\n\nTo retrieve the properties of a Payment Link. This may be used to get the status of a previously initiated payment or next action for an ongoing payment", + "operationId": "Retrieve a Payment Link", + "parameters": [ + { + "name": "payment_link_id", + "in": "path", + "description": "The identifier for payment link", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrievePaymentLinkRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Gets details regarding payment link", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrievePaymentLinkResponse" + } + } + } + }, + "404": { + "description": "No payment link found" + } + }, + "security": [ + { + "api_key": [] + }, + { + "publishable_key": [] + } + ] + } + }, + "/payment_methods": { + "post": { + "tags": [ + "Payment Methods" + ], + "summary": "PaymentMethods - Create", + "description": "PaymentMethods - Create\n\nTo create a payment method against a customer object. In case of cards, this API could be used only by PCI compliant merchants", + "operationId": "Create a Payment Method", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodCreate" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Payment Method Created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodResponse" + } + } + } + }, + "400": { + "description": "Invalid Data" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/payment_methods/{method_id}": { + "get": { + "tags": [ + "Payment Methods" + ], + "summary": "Payment Method - Retrieve", + "description": "Payment Method - Retrieve\n\nTo retrieve a payment method", + "operationId": "Retrieve a Payment method", + "parameters": [ + { + "name": "method_id", + "in": "path", + "description": "The unique identifier for the Payment Method", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Payment Method retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodResponse" + } + } + } + }, + "404": { + "description": "Payment Method does not exist in records" + } + }, + "security": [ + { + "api_key": [] + } + ] + }, + "post": { + "tags": [ + "Payment Methods" + ], + "summary": "Payment Method - Update", + "description": "Payment Method - Update\n\nTo update an existing payment method attached to a customer object. This API is useful for use cases such as updating the card number for expired cards to prevent discontinuity in recurring payments", + "operationId": "Update a Payment method", + "parameters": [ + { + "name": "method_id", + "in": "path", + "description": "The unique identifier for the Payment Method", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodUpdate" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Payment Method updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodResponse" + } + } + } + }, + "404": { + "description": "Payment Method does not exist in records" + } + }, + "security": [ + { + "api_key": [] + } + ] + }, + "delete": { + "tags": [ + "Payment Methods" + ], + "summary": "Payment Method - Delete", + "description": "Payment Method - Delete\n\nDelete payment method", + "operationId": "Delete a Payment method", + "parameters": [ + { + "name": "method_id", + "in": "path", + "description": "The unique identifier for the Payment Method", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Payment Method deleted", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodDeleteResponse" + } + } + } + }, + "404": { + "description": "Payment Method does not exist in records" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/payments": { + "post": { + "tags": [ + "Payments" + ], + "summary": "Payments - Create", + "description": "Payments - Create\n\nTo process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture", + "operationId": "Create a Payment", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentsCreateRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Payment created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentsResponse" + } + } + } + }, + "400": { + "description": "Missing Mandatory fields" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, + "/payments/list": { + "get": { + "tags": [ + "Payments" + ], + "summary": "Payments - List", + "description": "Payments - List\n\nTo list the payments", + "operationId": "List all Payments", + "parameters": [ + { + "name": "customer_id", + "in": "query", + "description": "The identifier for the customer", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "starting_after", + "in": "query", + "description": "A cursor for use in pagination, fetch the next list after some object", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "ending_before", + "in": "query", + "description": "A cursor for use in pagination, fetch the previous list before some object", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Limit on the number of objects to return", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "created", + "in": "query", + "description": "The time at which payment is created", + "required": true, + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_lt", + "in": "query", + "description": "Time less than the payment created time", + "required": true, + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_gt", + "in": "query", + "description": "Time greater than the payment created time", + "required": true, + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_lte", + "in": "query", + "description": "Time less than or equals to the payment created time", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_gte", + "in": "query", + "description": "Time greater than or equals to the payment created time", + "required": true, + "schema": { + "type": "string", + "format": "date-time" } } ], "responses": { "200": { - "description": "The dispute was retrieved successfully", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DisputeResponse" - } - } - } + "description": "Received payment list" }, "404": { - "description": "Dispute does not exist in our records" + "description": "No payments found" } }, "security": [ @@ -745,19 +1784,19 @@ ] } }, - "/gsm": { + "/payments/session_tokens": { "post": { "tags": [ - "Gsm" + "Payments" ], - "summary": "Gsm - Create", - "description": "Gsm - Create\n\nTo create a Gsm Rule", - "operationId": "Create Gsm Rule", + "summary": "Payments - Session token", + "description": "Payments - Session token\n\nTo create the session object or to get session token for wallets", + "operationId": "Create Session tokens for a Payment", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GsmCreateRequest" + "$ref": "#/components/schemas/PaymentsSessionRequest" } } }, @@ -765,39 +1804,50 @@ }, "responses": { "200": { - "description": "Gsm created", + "description": "Payment session object created or session token was retrieved from wallets", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GsmResponse" + "$ref": "#/components/schemas/PaymentsSessionResponse" } } } }, "400": { - "description": "Missing Mandatory fields" + "description": "Missing mandatory fields" } }, "security": [ { - "admin_api_key": [] + "publishable_key": [] } ] } }, - "/gsm/delete": { - "post": { + "/payments/{payment_id}": { + "get": { "tags": [ - "Gsm" + "Payments" + ], + "summary": "Payments - Retrieve", + "description": "Payments - Retrieve\n\nTo retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment", + "operationId": "Retrieve a Payment", + "parameters": [ + { + "name": "payment_id", + "in": "path", + "description": "The identifier for payment", + "required": true, + "schema": { + "type": "string" + } + } ], - "summary": "Gsm - Delete", - "description": "Gsm - Delete\n\nTo delete a Gsm Rule", - "operationId": "Delete Gsm Rule", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GsmDeleteRequest" + "$ref": "#/components/schemas/PaymentRetrieveBody" } } }, @@ -805,39 +1855,51 @@ }, "responses": { "200": { - "description": "Gsm deleted", + "description": "Gets the payment with final status", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GsmDeleteResponse" + "$ref": "#/components/schemas/PaymentsResponse" } } } }, - "400": { - "description": "Missing Mandatory fields" + "404": { + "description": "No payment found" } }, "security": [ { - "admin_api_key": [] + "api_key": [] + }, + { + "publishable_key": [] } ] - } - }, - "/gsm/get": { + }, "post": { "tags": [ - "Gsm" + "Payments" + ], + "summary": "Payments - Update", + "description": "Payments - Update\n\nTo update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created", + "operationId": "Update a Payment", + "parameters": [ + { + "name": "payment_id", + "in": "path", + "description": "The identifier for payment", + "required": true, + "schema": { + "type": "string" + } + } ], - "summary": "Gsm - Get", - "description": "Gsm - Get\n\nTo get a Gsm Rule", - "operationId": "Retrieve Gsm Rule", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GsmRetrieveRequest" + "$ref": "#/components/schemas/PaymentsRequest" } } }, @@ -845,39 +1907,53 @@ }, "responses": { "200": { - "description": "Gsm retrieved", + "description": "Payment updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GsmResponse" + "$ref": "#/components/schemas/PaymentsResponse" } } } }, "400": { - "description": "Missing Mandatory fields" + "description": "Missing mandatory fields" } }, "security": [ { - "admin_api_key": [] + "api_key": [] + }, + { + "publishable_key": [] } ] } }, - "/gsm/update": { + "/payments/{payment_id}/cancel": { "post": { "tags": [ - "Gsm" + "Payments" + ], + "summary": "Payments - Cancel", + "description": "Payments - Cancel\n\nA Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action", + "operationId": "Cancel a Payment", + "parameters": [ + { + "name": "payment_id", + "in": "path", + "description": "The identifier for payment", + "required": true, + "schema": { + "type": "string" + } + } ], - "summary": "Gsm - Update", - "description": "Gsm - Update\n\nTo update a Gsm Rule", - "operationId": "Update Gsm Rule", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GsmUpdateRequest" + "$ref": "#/components/schemas/PaymentsCancelRequest" } } }, @@ -885,99 +1961,61 @@ }, "responses": { "200": { - "description": "Gsm updated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GsmResponse" - } - } - } + "description": "Payment canceled" }, "400": { - "description": "Missing Mandatory fields" + "description": "Missing mandatory fields" } }, "security": [ { - "admin_api_key": [] + "api_key": [] } ] } }, - "/mandates/revoke/{mandate_id}": { + "/payments/{payment_id}/capture": { "post": { "tags": [ - "Mandates" + "Payments" ], - "summary": "Mandates - Revoke Mandate", - "description": "Mandates - Revoke Mandate\n\nRevoke a mandate", - "operationId": "Revoke a Mandate", + "summary": "Payments - Capture", + "description": "Payments - Capture\n\nTo capture the funds for an uncaptured payment", + "operationId": "Capture a Payment", "parameters": [ { - "name": "mandate_id", + "name": "payment_id", "in": "path", - "description": "The identifier for mandate", + "description": "The identifier for payment", "required": true, "schema": { "type": "string" } } ], - "responses": { - "200": { - "description": "The mandate was revoked successfully", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MandateRevokedResponse" - } + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentsCaptureRequest" } } }, - "400": { - "description": "Mandate does not exist in our records" - } + "required": true }, - "security": [ - { - "api_key": [] - } - ] - } - }, - "/mandates/{mandate_id}": { - "get": { - "tags": [ - "Mandates" - ], - "summary": "Mandates - Retrieve Mandate", - "description": "Mandates - Retrieve Mandate\n\nRetrieve a mandate", - "operationId": "Retrieve a Mandate", - "parameters": [ - { - "name": "mandate_id", - "in": "path", - "description": "The identifier for mandate", - "required": true, - "schema": { - "type": "string" - } - } - ], "responses": { "200": { - "description": "The mandate was retrieved successfully", + "description": "Payment captured", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MandateResponse" + "$ref": "#/components/schemas/PaymentsResponse" } } } }, - "404": { - "description": "Mandate does not exist in our records" + "400": { + "description": "Missing mandatory fields" } }, "security": [ @@ -987,19 +2025,19 @@ ] } }, - "/payment_link/{payment_link_id}": { - "get": { + "/payments/{payment_id}/confirm": { + "post": { "tags": [ "Payments" ], - "summary": "Payments Link - Retrieve", - "description": "Payments Link - Retrieve\n\nTo retrieve the properties of a Payment Link. This may be used to get the status of a previously initiated payment or next action for an ongoing payment", - "operationId": "Retrieve a Payment Link", + "summary": "Payments - Confirm", + "description": "Payments - Confirm\n\nThis API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments Create API", + "operationId": "Confirm a Payment", "parameters": [ { - "name": "payment_link_id", + "name": "payment_id", "in": "path", - "description": "The identifier for payment link", + "description": "The identifier for payment", "required": true, "schema": { "type": "string" @@ -1010,7 +2048,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RetrievePaymentLinkRequest" + "$ref": "#/components/schemas/PaymentsRequest" } } }, @@ -1018,17 +2056,17 @@ }, "responses": { "200": { - "description": "Gets details regarding payment link", + "description": "Payment confirmed", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RetrievePaymentLinkResponse" + "$ref": "#/components/schemas/PaymentsResponse" } } } }, - "404": { - "description": "No payment link found" + "400": { + "description": "Missing mandatory fields" } }, "security": [ @@ -1041,19 +2079,19 @@ ] } }, - "/payment_methods": { + "/payouts/create": { "post": { "tags": [ - "Payment Methods" + "Payouts" ], - "summary": "PaymentMethods - Create", - "description": "PaymentMethods - Create\n\nTo create a payment method against a customer object. In case of cards, this API could be used only by PCI compliant merchants", - "operationId": "Create a Payment Method", + "summary": "Payouts - Create", + "description": "Payouts - Create", + "operationId": "Create a Payout", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentMethodCreate" + "$ref": "#/components/schemas/PayoutCreateRequest" } } }, @@ -1061,17 +2099,17 @@ }, "responses": { "200": { - "description": "Payment Method Created", + "description": "Payout created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentMethodResponse" + "$ref": "#/components/schemas/PayoutCreateResponse" } } } }, "400": { - "description": "Invalid Data" + "description": "Missing Mandatory fields" } }, "security": [ @@ -1081,19 +2119,19 @@ ] } }, - "/payment_methods/{method_id}": { + "/payouts/{payout_id}": { "get": { "tags": [ - "Payment Methods" + "Payouts" ], - "summary": "Payment Method - Retrieve", - "description": "Payment Method - Retrieve\n\nTo retrieve a payment method", - "operationId": "Retrieve a Payment method", + "summary": "Payouts - Retrieve", + "description": "Payouts - Retrieve", + "operationId": "Retrieve a Payout", "parameters": [ { - "name": "method_id", + "name": "payout_id", "in": "path", - "description": "The unique identifier for the Payment Method", + "description": "The identifier for payout]", "required": true, "schema": { "type": "string" @@ -1102,17 +2140,17 @@ ], "responses": { "200": { - "description": "Payment Method retrieved", + "description": "Payout retrieved", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentMethodResponse" + "$ref": "#/components/schemas/PayoutCreateResponse" } } } }, "404": { - "description": "Payment Method does not exist in records" + "description": "Payout does not exist in our records" } }, "security": [ @@ -1123,16 +2161,16 @@ }, "post": { "tags": [ - "Payment Methods" + "Payouts" ], - "summary": "Payment Method - Update", - "description": "Payment Method - Update\n\nTo update an existing payment method attached to a customer object. This API is useful for use cases such as updating the card number for expired cards to prevent discontinuity in recurring payments", - "operationId": "Update a Payment method", + "summary": "Payouts - Update", + "description": "Payouts - Update", + "operationId": "Update a Payout", "parameters": [ { - "name": "method_id", + "name": "payout_id", "in": "path", - "description": "The unique identifier for the Payment Method", + "description": "The identifier for payout]", "required": true, "schema": { "type": "string" @@ -1143,7 +2181,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentMethodUpdate" + "$ref": "#/components/schemas/PayoutCreateRequest" } } }, @@ -1151,17 +2189,17 @@ }, "responses": { "200": { - "description": "Payment Method updated", + "description": "Payout updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentMethodResponse" + "$ref": "#/components/schemas/PayoutCreateResponse" } } } }, - "404": { - "description": "Payment Method does not exist in records" + "400": { + "description": "Missing Mandatory fields" } }, "security": [ @@ -1169,60 +2207,32 @@ "api_key": [] } ] - }, - "delete": { + } + }, + "/payouts/{payout_id}/cancel": { + "post": { "tags": [ - "Payment Methods" + "Payouts" ], - "summary": "Payment Method - Delete", - "description": "Payment Method - Delete\n\nDelete payment method", - "operationId": "Delete a Payment method", + "summary": "Payouts - Cancel", + "description": "Payouts - Cancel", + "operationId": "Cancel a Payout", "parameters": [ { - "name": "method_id", + "name": "payout_id", "in": "path", - "description": "The unique identifier for the Payment Method", + "description": "The identifier for payout", "required": true, "schema": { "type": "string" } } ], - "responses": { - "200": { - "description": "Payment Method deleted", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethodDeleteResponse" - } - } - } - }, - "404": { - "description": "Payment Method does not exist in records" - } - }, - "security": [ - { - "api_key": [] - } - ] - } - }, - "/payments": { - "post": { - "tags": [ - "Payments" - ], - "summary": "Payments - Create", - "description": "Payments - Create\n\nTo process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture", - "operationId": "Create a Payment", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsCreateRequest" + "$ref": "#/components/schemas/PayoutActionRequest" } } }, @@ -1230,11 +2240,11 @@ }, "responses": { "200": { - "description": "Payment created", + "description": "Payout cancelled", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsResponse" + "$ref": "#/components/schemas/PayoutCreateResponse" } } } @@ -1250,131 +2260,30 @@ ] } }, - "/payments/list": { - "get": { + "/payouts/{payout_id}/fulfill": { + "post": { "tags": [ - "Payments" + "Payouts" ], - "summary": "Payments - List", - "description": "Payments - List\n\nTo list the payments", - "operationId": "List all Payments", + "summary": "Payouts - Fulfill", + "description": "Payouts - Fulfill", + "operationId": "Fulfill a Payout", "parameters": [ { - "name": "customer_id", - "in": "query", - "description": "The identifier for the customer", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "starting_after", - "in": "query", - "description": "A cursor for use in pagination, fetch the next list after some object", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "ending_before", - "in": "query", - "description": "A cursor for use in pagination, fetch the previous list before some object", + "name": "payout_id", + "in": "path", + "description": "The identifier for payout", "required": true, "schema": { "type": "string" } - }, - { - "name": "limit", - "in": "query", - "description": "Limit on the number of objects to return", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - }, - { - "name": "created", - "in": "query", - "description": "The time at which payment is created", - "required": true, - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "created_lt", - "in": "query", - "description": "Time less than the payment created time", - "required": true, - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "created_gt", - "in": "query", - "description": "Time greater than the payment created time", - "required": true, - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "created_lte", - "in": "query", - "description": "Time less than or equals to the payment created time", - "required": true, - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "created_gte", - "in": "query", - "description": "Time greater than or equals to the payment created time", - "required": true, - "schema": { - "type": "string", - "format": "date-time" - } - } - ], - "responses": { - "200": { - "description": "Received payment list" - }, - "404": { - "description": "No payments found" - } - }, - "security": [ - { - "api_key": [] } - ] - } - }, - "/payments/session_tokens": { - "post": { - "tags": [ - "Payments" ], - "summary": "Payments - Session token", - "description": "Payments - Session token\n\nTo create the session object or to get session token for wallets", - "operationId": "Create Session tokens for a Payment", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsSessionRequest" + "$ref": "#/components/schemas/PayoutActionRequest" } } }, @@ -1382,50 +2291,39 @@ }, "responses": { "200": { - "description": "Payment session object created or session token was retrieved from wallets", + "description": "Payout fulfilled", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsSessionResponse" + "$ref": "#/components/schemas/PayoutCreateResponse" } } } }, "400": { - "description": "Missing mandatory fields" + "description": "Missing Mandatory fields" } }, "security": [ { - "publishable_key": [] + "api_key": [] } ] - } - }, - "/payments/{payment_id}": { - "get": { - "tags": [ - "Payments" - ], - "summary": "Payments - Retrieve", - "description": "Payments - Retrieve\n\nTo retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment", - "operationId": "Retrieve a Payment", - "parameters": [ - { - "name": "payment_id", - "in": "path", - "description": "The identifier for payment", - "required": true, - "schema": { - "type": "string" - } - } + } + }, + "/refunds": { + "post": { + "tags": [ + "Refunds" ], + "summary": "Refunds - Create", + "description": "Refunds - Create\n\nTo create a refund against an already processed payment", + "operationId": "Create a Refund", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentRetrieveBody" + "$ref": "#/components/schemas/RefundRequest" } } }, @@ -1433,51 +2331,39 @@ }, "responses": { "200": { - "description": "Gets the payment with final status", + "description": "Refund created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsResponse" + "$ref": "#/components/schemas/RefundResponse" } } } }, - "404": { - "description": "No payment found" + "400": { + "description": "Missing Mandatory fields" } }, "security": [ { "api_key": [] - }, - { - "publishable_key": [] } ] - }, + } + }, + "/refunds/list": { "post": { "tags": [ - "Payments" - ], - "summary": "Payments - Update", - "description": "Payments - Update\n\nTo update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created", - "operationId": "Update a Payment", - "parameters": [ - { - "name": "payment_id", - "in": "path", - "description": "The identifier for payment", - "required": true, - "schema": { - "type": "string" - } - } + "Refunds" ], + "summary": "Refunds - List", + "description": "Refunds - List\n\nTo list the refunds associated with a payment_id or with the merchant, if payment_id is not provided", + "operationId": "List all Refunds", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsRequest" + "$ref": "#/components/schemas/RefundListRequest" } } }, @@ -1485,64 +2371,55 @@ }, "responses": { "200": { - "description": "Payment updated", + "description": "List of refunds", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsResponse" + "$ref": "#/components/schemas/RefundListResponse" } } } - }, - "400": { - "description": "Missing mandatory fields" } }, "security": [ { "api_key": [] - }, - { - "publishable_key": [] } ] } }, - "/payments/{payment_id}/cancel": { - "post": { + "/refunds/{refund_id}": { + "get": { "tags": [ - "Payments" + "Refunds" ], - "summary": "Payments - Cancel", - "description": "Payments - Cancel\n\nA Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action", - "operationId": "Cancel a Payment", + "summary": "Refunds - Retrieve (GET)", + "description": "Refunds - Retrieve (GET)\n\nTo retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment", + "operationId": "Retrieve a Refund", "parameters": [ { - "name": "payment_id", + "name": "refund_id", "in": "path", - "description": "The identifier for payment", + "description": "The identifier for refund", "required": true, "schema": { "type": "string" } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentsCancelRequest" - } - } - }, - "required": true - }, "responses": { "200": { - "description": "Payment canceled" + "description": "Refund retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RefundResponse" + } + } + } }, - "400": { - "description": "Missing mandatory fields" + "404": { + "description": "Refund does not exist in our records" } }, "security": [ @@ -1550,21 +2427,19 @@ "api_key": [] } ] - } - }, - "/payments/{payment_id}/capture": { + }, "post": { "tags": [ - "Payments" + "Refunds" ], - "summary": "Payments - Capture", - "description": "Payments - Capture\n\nTo capture the funds for an uncaptured payment", - "operationId": "Capture a Payment", + "summary": "Refunds - Update", + "description": "Refunds - Update\n\nTo update the properties of a Refund object. This may include attaching a reason for the refund or metadata fields", + "operationId": "Update a Refund", "parameters": [ { - "name": "payment_id", + "name": "refund_id", "in": "path", - "description": "The identifier for payment", + "description": "The identifier for refund", "required": true, "schema": { "type": "string" @@ -1575,7 +2450,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsCaptureRequest" + "$ref": "#/components/schemas/RefundUpdateRequest" } } }, @@ -1583,17 +2458,17 @@ }, "responses": { "200": { - "description": "Payment captured", + "description": "Refund updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsResponse" + "$ref": "#/components/schemas/RefundResponse" } } } }, "400": { - "description": "Missing mandatory fields" + "description": "Missing Mandatory fields" } }, "security": [ @@ -1603,48 +2478,28 @@ ] } }, - "/payments/{payment_id}/confirm": { - "post": { + "/routing": { + "get": { "tags": [ - "Payments" - ], - "summary": "Payments - Confirm", - "description": "Payments - Confirm\n\nThis API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments Create API", - "operationId": "Confirm a Payment", - "parameters": [ - { - "name": "payment_id", - "in": "path", - "description": "The identifier for payment", - "required": true, - "schema": { - "type": "string" - } - } + "Routing" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentsRequest" - } - } - }, - "required": true - }, + "operationId": "Retrieve routing dictionary", "responses": { "200": { - "description": "Payment confirmed", + "description": "Successfully fetched routing dictionary", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentsResponse" + "$ref": "#/components/schemas/RoutingKind" } } } }, - "400": { - "description": "Missing mandatory fields" + "404": { + "description": "Resource missing" + }, + "500": { + "description": "Internal server error" } }, "security": [ @@ -1652,24 +2507,20 @@ "api_key": [] }, { - "publishable_key": [] + "jwt_key": [] } ] - } - }, - "/payouts/create": { + }, "post": { "tags": [ - "Payouts" + "Routing" ], - "summary": "Payouts - Create", - "description": "Payouts - Create", - "operationId": "Create a Payout", + "operationId": "Create a routing config", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PayoutCreateRequest" + "$ref": "#/components/schemas/RoutingConfigRequest" } } }, @@ -1677,89 +2528,89 @@ }, "responses": { "200": { - "description": "Payout created", + "description": "Routing config created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PayoutCreateResponse" + "$ref": "#/components/schemas/RoutingDictionaryRecord" } } } }, "400": { - "description": "Missing Mandatory fields" + "description": "Request body is malformed" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Resource missing" + }, + "422": { + "description": "Unprocessable request" + }, + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] } }, - "/payouts/{payout_id}": { + "/routing/active": { "get": { "tags": [ - "Payouts" - ], - "summary": "Payouts - Retrieve", - "description": "Payouts - Retrieve", - "operationId": "Retrieve a Payout", - "parameters": [ - { - "name": "payout_id", - "in": "path", - "description": "The identifier for payout]", - "required": true, - "schema": { - "type": "string" - } - } + "Routing" ], + "operationId": "Retrieve active config", "responses": { "200": { - "description": "Payout retrieved", + "description": "Successfully retrieved active config", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PayoutCreateResponse" + "$ref": "#/components/schemas/LinkedRoutingConfigRetrieveResponse" } } } }, + "403": { + "description": "Forbidden" + }, "404": { - "description": "Payout does not exist in our records" + "description": "Resource missing" + }, + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] - }, + } + }, + "/routing/deactivate": { "post": { "tags": [ - "Payouts" - ], - "summary": "Payouts - Update", - "description": "Payouts - Update", - "operationId": "Update a Payout", - "parameters": [ - { - "name": "payout_id", - "in": "path", - "description": "The identifier for payout]", - "required": true, - "schema": { - "type": "string" - } - } + "Routing" ], + "operationId": "Deactivate a routing config", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PayoutCreateRequest" + "$ref": "#/components/schemas/RoutingConfigRequest" } } }, @@ -1767,101 +2618,84 @@ }, "responses": { "200": { - "description": "Payout updated", + "description": "Successfully deactivated routing config", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PayoutCreateResponse" + "$ref": "#/components/schemas/RoutingDictionaryRecord" } } } }, "400": { - "description": "Missing Mandatory fields" + "description": "Malformed request" + }, + "403": { + "description": "Malformed request" + }, + "422": { + "description": "Unprocessable request" + }, + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] } }, - "/payouts/{payout_id}/cancel": { - "post": { + "/routing/default": { + "get": { "tags": [ - "Payouts" - ], - "summary": "Payouts - Cancel", - "description": "Payouts - Cancel", - "operationId": "Cancel a Payout", - "parameters": [ - { - "name": "payout_id", - "in": "path", - "description": "The identifier for payout", - "required": true, - "schema": { - "type": "string" - } - } + "Routing" ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PayoutActionRequest" - } - } - }, - "required": true - }, + "operationId": "Retrieve default config", "responses": { "200": { - "description": "Payout cancelled", + "description": "Successfully retrieved default config", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PayoutCreateResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RoutableConnectorChoice" + } } } } }, - "400": { - "description": "Missing Mandatory fields" + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] - } - }, - "/payouts/{payout_id}/fulfill": { + }, "post": { "tags": [ - "Payouts" - ], - "summary": "Payouts - Fulfill", - "description": "Payouts - Fulfill", - "operationId": "Fulfill a Payout", - "parameters": [ - { - "name": "payout_id", - "in": "path", - "description": "The identifier for payout", - "required": true, - "schema": { - "type": "string" - } - } + "Routing" ], + "operationId": "Update default config", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PayoutActionRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/RoutableConnectorChoice" + } } } }, @@ -1869,79 +2703,97 @@ }, "responses": { "200": { - "description": "Payout fulfilled", + "description": "Successfully updated default config", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PayoutCreateResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RoutableConnectorChoice" + } } } } }, "400": { - "description": "Missing Mandatory fields" + "description": "Malformed request" + }, + "422": { + "description": "Unprocessable request" + }, + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] } }, - "/refunds": { - "post": { + "/routing/default/profile": { + "get": { "tags": [ - "Refunds" + "Routing" ], - "summary": "Refunds - Create", - "description": "Refunds - Create\n\nTo create a refund against an already processed payment", - "operationId": "Create a Refund", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RefundRequest" - } - } - }, - "required": true - }, + "operationId": "Retrieve default config for profiles", "responses": { "200": { - "description": "Refund created", + "description": "Successfully retrieved default config", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RefundResponse" + "$ref": "#/components/schemas/ProfileDefaultRoutingConfig" } } } }, - "400": { - "description": "Missing Mandatory fields" + "404": { + "description": "Resource missing" + }, + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] } }, - "/refunds/list": { + "/routing/default/profile/{profile_id}": { "post": { "tags": [ - "Refunds" + "Routing" + ], + "operationId": "Update default config for profile", + "parameters": [ + { + "name": "profile_id", + "in": "path", + "description": "The unique identifier for a profile", + "required": true, + "schema": { + "type": "string" + } + } ], - "summary": "Refunds - List", - "description": "Refunds - List\n\nTo list the refunds associated with a payment_id or with the merchant, if payment_id is not provided", - "operationId": "List all Refunds", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RefundListRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/RoutableConnectorChoice" + } } } }, @@ -1949,36 +2801,52 @@ }, "responses": { "200": { - "description": "List of refunds", + "description": "Successfully updated default config for profile", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RefundListResponse" + "$ref": "#/components/schemas/ProfileDefaultRoutingConfig" } } } + }, + "400": { + "description": "Malformed request" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Resource missing" + }, + "422": { + "description": "Unprocessable request" + }, + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] } }, - "/refunds/{refund_id}": { + "/routing/{algorithm_id}": { "get": { "tags": [ - "Refunds" + "Routing" ], - "summary": "Refunds - Retrieve (GET)", - "description": "Refunds - Retrieve (GET)\n\nTo retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment", - "operationId": "Retrieve a Refund", + "operationId": "Retrieve a routing algorithm", "parameters": [ { - "name": "refund_id", + "name": "algorithm_id", "in": "path", - "description": "The identifier for refund", + "description": "The unique identifier for an algorithm", "required": true, "schema": { "type": "string" @@ -1987,71 +2855,79 @@ ], "responses": { "200": { - "description": "Refund retrieved", + "description": "Successfully fetched routing algorithm", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RefundResponse" + "$ref": "#/components/schemas/MerchantRoutingAlgorithm" } } } }, + "403": { + "description": "Forbidden" + }, "404": { - "description": "Refund does not exist in our records" + "description": "Resource missing" + }, + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] - }, + } + }, + "/routing/{algorithm_id}/activate": { "post": { "tags": [ - "Refunds" + "Routing" ], - "summary": "Refunds - Update", - "description": "Refunds - Update\n\nTo update the properties of a Refund object. This may include attaching a reason for the refund or metadata fields", - "operationId": "Update a Refund", + "operationId": "Activate a routing config", "parameters": [ { - "name": "refund_id", + "name": "algorithm_id", "in": "path", - "description": "The identifier for refund", + "description": "The unique identifier for an algorithm", "required": true, "schema": { "type": "string" } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RefundUpdateRequest" - } - } - }, - "required": true - }, "responses": { "200": { - "description": "Refund updated", + "description": "Routing config activated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RefundResponse" + "$ref": "#/components/schemas/RoutingDictionaryRecord" } } } }, "400": { - "description": "Missing Mandatory fields" + "description": "Bad request" + }, + "404": { + "description": "Resource missing" + }, + "500": { + "description": "Internal server error" } }, "security": [ { "api_key": [] + }, + { + "jwt_key": [] } ] } @@ -6253,6 +7129,19 @@ } } }, + "LinkedRoutingConfigRetrieveResponse": { + "oneOf": [ + { + "$ref": "#/components/schemas/RoutingRetrieveResponse" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/RoutingDictionaryRecord" + } + } + ] + }, "MandateAmountData": { "type": "object", "required": [ @@ -7499,6 +8388,39 @@ } } }, + "MerchantRoutingAlgorithm": { + "type": "object", + "required": [ + "id", + "name", + "description", + "algorithm", + "created_at", + "modified_at" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "algorithm": { + "$ref": "#/components/schemas/RoutingAlgorithm" + }, + "created_at": { + "type": "integer", + "format": "int64" + }, + "modified_at": { + "type": "integer", + "format": "int64" + } + } + }, "MobilePayRedirection": { "type": "object" }, @@ -10923,6 +11845,24 @@ } } }, + "ProfileDefaultRoutingConfig": { + "type": "object", + "required": [ + "profile_id", + "connectors" + ], + "properties": { + "profile_id": { + "type": "string" + }, + "connectors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RoutableConnectorChoice" + } + } + } + }, "ReceiverDetails": { "type": "object", "required": [ @@ -11442,6 +12382,25 @@ } } }, + "RoutableConnectorChoice": { + "type": "object", + "required": [ + "choice_kind", + "connector" + ], + "properties": { + "choice_kind": { + "$ref": "#/components/schemas/RoutableChoiceKind" + }, + "connector": { + "$ref": "#/components/schemas/RoutableConnectors" + }, + "sub_label": { + "type": "string", + "nullable": true + } + } + }, "RoutingAlgorithm": { "type": "string", "description": "The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'", @@ -11453,6 +12412,77 @@ ], "example": "custom" }, + "RoutingConfigRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "algorithm": { + "allOf": [ + { + "$ref": "#/components/schemas/RoutingAlgorithm" + } + ], + "nullable": true + }, + "profile_id": { + "type": "string", + "nullable": true + } + } + }, + "RoutingDictionaryRecord": { + "type": "object", + "required": [ + "id", + "name", + "kind", + "description", + "created_at", + "modified_at" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "kind": { + "$ref": "#/components/schemas/RoutingAlgorithmKind" + }, + "description": { + "type": "string" + }, + "created_at": { + "type": "integer", + "format": "int64" + }, + "modified_at": { + "type": "integer", + "format": "int64" + } + } + }, + "RoutingKind": { + "oneOf": [ + { + "$ref": "#/components/schemas/RoutingDictionary" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/RoutingDictionaryRecord" + } + } + ] + }, "SamsungPayWalletData": { "type": "object", "required": [ @@ -12334,6 +13364,10 @@ { "name": "payment link", "description": "Create payment link" + }, + { + "name": "Routing", + "description": "Create and manage routing configurations" } ] } \ No newline at end of file