Skip to content

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

feat: add `merchant_name` field in the response body (#1280)

Amisha Prabhatdd4ba63cc494
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 30232c705f..4dcaad09fb 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -1,5 +1,5 @@
use cards::CardNumber;
-use common_utils::pii;
+use common_utils::{crypto::OptionalEncryptableName, pii};
use serde::de;
use utoipa::ToSchema;
@@ -441,6 +441,9 @@ pub struct PaymentMethodListResponse {
/// Value indicating if the current payment is a mandate payment
#[schema(value_type = MandateType)]
pub mandate_payment: Option<payments::MandateType>,
+
+ #[schema(value_type = Option<String>)]
+ pub merchant_name: OptionalEncryptableName,
}
#[derive(Eq, PartialEq, Hash, Debug, serde::Deserialize, ToSchema)]
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index c4be0ea81c..57091a3be6 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1110,6 +1110,7 @@ pub async fn list_payment_methods(
.unwrap_or(Ok(services::ApplicationResponse::Json(
api::PaymentMethodListResponse {
redirect_url: merchant_account.return_url,
+ merchant_name: merchant_account.merchant_name,
payment_methods: payment_method_responses,
mandate_payment: payment_attempt
.and_then(|inner| inner.mandate_details)
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 68a7128e4b..3e28ae8e72 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -1339,84 +1339,23 @@
}
},
"/refunds/list": {
- "get": {
+ "post": {
"tags": [
"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",
- "parameters": [
- {
- "name": "payment_id",
- "in": "query",
- "description": "The identifier for the payment",
- "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 refund is created",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "created_lt",
- "in": "query",
- "description": "Time less than the refund created time",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "created_gt",
- "in": "query",
- "description": "Time greater than the refund created time",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- },
- {
- "name": "created_lte",
- "in": "query",
- "description": "Time less than or equals to the refund created time",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RefundListRequest"
+ }
}
},
- {
- "name": "created_gte",
- "in": "query",
- "description": "Time greater than or equals to the refund created time",
- "required": true,
- "schema": {
- "type": "string",
- "format": "date-time"
- }
- }
- ],
+ "required": true
+ },
"responses": {
"200": {
"description": "List of refunds",
@@ -1790,10 +1729,10 @@
}
}
},
- "AliPayRedirection": {
+ "AliPayHkRedirection": {
"type": "object"
},
- "AliPayHkRedirection": {
+ "AliPayRedirection": {
"type": "object"
},
"AmountInfo": {
@@ -6093,6 +6032,10 @@
},
"mandate_payment": {
"$ref": "#/components/schemas/MandateType"
+ },
+ "merchant_name": {
+ "type": "string",
+ "nullable": true
}
}
},
@@ -6183,6 +6126,7 @@
"affirm",
"afterpay_clearpay",
"ali_pay",
+ "ali_pay_hk",
"apple_pay",
"bacs",
"bancontact_card",
@@ -6345,52 +6289,23 @@
"PaymentsCreateRequest": {
"type": "object",
"required": [
- "amount",
"manual_retry",
+ "amount",
"currency"
],
"properties": {
- "browser_info": {
- "type": "object",
- "description": "Additional details required by 3DS 2.0",
- "nullable": true
- },
- "billing": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
- "nullable": true
- },
- "merchant_connector_details": {
- "allOf": [
- {
- "$ref": "#/components/schemas/MerchantConnectorDetailsWrap"
- }
- ],
- "nullable": true
- },
- "capture_method": {
- "allOf": [
- {
- "$ref": "#/components/schemas/CaptureMethod"
- }
- ],
- "nullable": true
- },
- "shipping": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
+ "allowed_payment_method_types": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ },
+ "description": "Allowed Payment Method Types for a given PaymentIntent",
"nullable": true
},
- "routing": {
+ "payment_experience": {
"allOf": [
{
- "$ref": "#/components/schemas/RoutingAlgorithm"
+ "$ref": "#/components/schemas/PaymentExperience"
}
],
"nullable": true
@@ -6401,19 +6316,32 @@
"example": true,
"nullable": true
},
- "return_url": {
+ "customer_id": {
"type": "string",
- "description": "The URL to redirect after the completion of the operation",
- "example": "https://hyperswitch.io",
- "nullable": true
+ "description": "The identifier for the customer object.\nThis field will be deprecated soon, use the customer object instead",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "nullable": true,
+ "maxLength": 255
},
- "statement_descriptor_name": {
+ "phone_country_code": {
"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",
+ "description": "The country code for the customer phone number\nThis field will be deprecated soon, use the customer object instead",
+ "example": "+1",
"nullable": true,
"maxLength": 255
},
+ "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,
+ "nullable": true
+ },
+ "udf": {
+ "type": "object",
+ "description": "Any user defined fields can be passed here.",
+ "nullable": true
+ },
"setup_future_usage": {
"allOf": [
{
@@ -6422,43 +6350,32 @@
],
"nullable": true
},
- "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,
- "nullable": true,
- "minimum": 0.0
- },
- "merchant_id": {
- "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_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,
+ "connector": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Connector"
+ },
+ "description": "This allows the merchant to manually select a connector with which the payment can go through",
+ "example": [
+ "stripe",
+ "adyen"
+ ],
"nullable": true
},
- "customer": {
+ "shipping": {
"allOf": [
{
- "$ref": "#/components/schemas/CustomerDetails"
+ "$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
- "payment_id": {
+ "phone": {
"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",
+ "description": "The customer's phone number\nThis field will be deprecated soon, use the customer object instead",
+ "example": "3141592653",
"nullable": true,
- "maxLength": 30,
- "minLength": 30
+ "maxLength": 255
},
"confirm": {
"type": "boolean",
@@ -6467,135 +6384,156 @@
"example": true,
"nullable": true
},
- "authentication_type": {
+ "mandate_data": {
"allOf": [
{
- "$ref": "#/components/schemas/AuthenticationType"
+ "$ref": "#/components/schemas/MandateData"
}
],
"nullable": true
},
- "metadata": {
+ "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
+ },
+ "business_country": {
"allOf": [
{
- "$ref": "#/components/schemas/Metadata"
+ "$ref": "#/components/schemas/CountryAlpha2"
}
],
"nullable": true
},
- "mandate_data": {
+ "business_label": {
+ "type": "string",
+ "description": "Business label of the merchant for this payment",
+ "example": "food",
+ "nullable": true
+ },
+ "description": {
+ "type": "string",
+ "description": "A description of the payment",
+ "example": "It's my first payment request",
+ "nullable": true
+ },
+ "client_secret": {
+ "type": "string",
+ "description": "It's a token used for client side verification.",
+ "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
+ "nullable": true
+ },
+ "payment_method_type": {
"allOf": [
{
- "$ref": "#/components/schemas/MandateData"
+ "$ref": "#/components/schemas/PaymentMethodType"
}
],
"nullable": true
},
- "payment_experience": {
+ "customer": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentExperience"
+ "$ref": "#/components/schemas/CustomerDetails"
}
],
"nullable": true
},
- "payment_token": {
+ "browser_info": {
+ "type": "object",
+ "description": "Additional details required by 3DS 2.0",
+ "nullable": true
+ },
+ "manual_retry": {
+ "type": "boolean",
+ "description": "If enabled payment can be retried from the client side until the payment is successful or payment expires or the attempts(configured by the merchant) for payment are exhausted."
+ },
+ "return_url": {
"type": "string",
- "description": "Provide a reference to a stored payment method",
- "example": "187282ab-40ef-47a9-9206-5099ba31e432",
+ "description": "The URL to redirect after the completion of the operation",
+ "example": "https://hyperswitch.io",
"nullable": true
},
- "phone": {
+ "mandate_id": {
"type": "string",
- "description": "The customer's phone number\nThis field will be deprecated soon, use the customer object instead",
- "example": "3141592653",
+ "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
},
- "business_country": {
+ "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
+ },
+ "metadata": {
"allOf": [
{
- "$ref": "#/components/schemas/CountryAlpha2"
+ "$ref": "#/components/schemas/Metadata"
}
],
"nullable": true
},
- "phone_country_code": {
- "type": "string",
- "description": "The country code for the customer phone number\nThis field will be deprecated soon, use the customer object instead",
- "example": "+1",
- "nullable": true,
- "maxLength": 255
- },
- "client_secret": {
- "type": "string",
- "description": "It's a token used for client side verification.",
- "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
- "nullable": true
- },
- "udf": {
- "type": "object",
- "description": "Any user defined fields can be passed here.",
+ "capture_method": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CaptureMethod"
+ }
+ ],
"nullable": true
},
- "customer_id": {
+ "name": {
"type": "string",
- "description": "The identifier for the customer object.\nThis field will be deprecated soon, use the customer object instead",
- "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
+ "description": "description: The customer's name\nThis field will be deprecated soon, use the customer object instead",
+ "example": "John Test",
"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,
+ "nullable": true,
+ "minimum": 0.0
+ },
"card_cvc": {
"type": "string",
"description": "This is used when payment is to be confirmed and the card is not saved",
"nullable": true
},
- "name": {
+ "merchant_connector_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MerchantConnectorDetailsWrap"
+ }
+ ],
+ "nullable": true
+ },
+ "merchant_id": {
"type": "string",
- "description": "description: The customer's name\nThis field will be deprecated soon, use the customer object instead",
- "example": "John Test",
+ "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
},
- "allowed_payment_method_types": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/PaymentMethodType"
- },
- "description": "Allowed Payment Method Types for a given PaymentIntent",
- "nullable": true
- },
- "payment_method_data": {
+ "currency": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodData"
+ "$ref": "#/components/schemas/Currency"
}
],
"nullable": true
},
- "manual_retry": {
- "type": "boolean",
- "description": "If enabled payment can be retried from the client side until the payment is successful or payment expires or the attempts(configured by the merchant) for payment are exhausted."
- },
- "order_details": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/OrderDetailsWithAmount"
- },
- "description": "Information about the product , quantity and amount for connectors. (e.g. Klarna)",
- "example": "[{\n \"product_name\": \"gillete creme\",\n \"quantity\": 15,\n \"amount\" : 900\n }]",
- "nullable": true
- },
- "connector": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Connector"
- },
- "description": "This allows the merchant to manually select a connector with which the payment can go through",
- "example": [
- "stripe",
- "adyen"
- ],
+ "payment_token": {
+ "type": "string",
+ "description": "Provide a reference to a stored payment method",
+ "example": "187282ab-40ef-47a9-9206-5099ba31e432",
"nullable": true
},
"capture_on": {
@@ -6605,27 +6543,14 @@
"example": "2022-09-10T10:11:12Z",
"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
- },
- "payment_method_type": {
+ "authentication_type": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodType"
+ "$ref": "#/components/schemas/AuthenticationType"
}
],
"nullable": true
},
- "business_label": {
- "type": "string",
- "description": "Business label of the merchant for this payment",
- "example": "food",
- "nullable": true
- },
"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.",
@@ -6633,39 +6558,58 @@
"nullable": true,
"maxLength": 255
},
+ "order_details": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/OrderDetailsWithAmount"
+ },
+ "description": "Information about the product , quantity and amount for connectors. (e.g. Klarna)",
+ "example": "[{\n \"product_name\": \"gillete creme\",\n \"quantity\": 15,\n \"amount\" : 900\n }]",
+ "nullable": true
+ },
"business_sub_label": {
"type": "string",
"description": "Business sub label for the payment",
"nullable": true
},
- "currency": {
+ "email": {
+ "type": "string",
+ "description": "The customer's email address\nThis field will be deprecated soon, use the customer object instead",
+ "example": "[email protected]",
+ "nullable": true,
+ "maxLength": 255
+ },
+ "payment_method": {
"allOf": [
{
- "$ref": "#/components/schemas/Currency"
+ "$ref": "#/components/schemas/PaymentMethod"
}
],
"nullable": true
},
- "payment_method": {
+ "routing": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethod"
+ "$ref": "#/components/schemas/RoutingAlgorithm"
}
],
"nullable": true
},
- "description": {
- "type": "string",
- "description": "A description of the payment",
- "example": "It's my first payment request",
+ "billing": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Address"
+ }
+ ],
"nullable": true
},
- "email": {
- "type": "string",
- "description": "The customer's email address\nThis field will be deprecated soon, use the customer object instead",
- "example": "[email protected]",
- "nullable": true,
- "maxLength": 255
+ "payment_method_data": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethodData"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -7540,34 +7484,42 @@
"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",
+ "offset": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The starting point within a list of objects",
"nullable": true
},
- "created.lt": {
- "type": "string",
- "format": "date-time",
- "description": "Time less than the refund created time",
+ "time_range": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/TimeRange"
+ }
+ ],
"nullable": true
},
- "created.gt": {
- "type": "string",
- "format": "date-time",
- "description": "Time greater than the refund created time",
+ "connector": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "The list of connectors to filter refunds list",
"nullable": true
},
- "created.lte": {
- "type": "string",
- "format": "date-time",
- "description": "Time less than or equals to the refund created time",
+ "currency": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Currency"
+ },
+ "description": "The list of currencies to filter refunds list",
"nullable": true
},
- "created.gte": {
- "type": "string",
- "format": "date-time",
- "description": "Time greater than or equals to the refund created time",
+ "refund_status": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/RefundStatus"
+ },
+ "description": "The list of refund statuses to filter refunds list",
"nullable": true
}
}
@@ -8066,6 +8018,25 @@
}
}
},
+ "TimeRange": {
+ "type": "object",
+ "required": [
+ "start_time"
+ ],
+ "properties": {
+ "start_time": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The start time to filter refunds list or to get list of filters. To get list of filters start time is needed to be passed"
+ },
+ "end_time": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The end time to filter refunds list or to get list of filters. If not passed the default time is now",
+ "nullable": true
+ }
+ }
+ },
"UpdateApiKeyRequest": {
"type": "object",
"description": "The request body for updating an API Key.",
@@ -8120,10 +8091,10 @@
{
"type": "object",
"required": [
- "ali_pay_hk"
+ "ali_pay_hk_redirect"
],
"properties": {
- "ali_pay_hk": {
+ "ali_pay_hk_redirect": {
"$ref": "#/components/schemas/AliPayHkRedirection"
}
}