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

docs(openapi): Fix v2 authentication headers docs (#10888)

Anurag Thakuraa022b8617e4
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 60131275d5..f237435660 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -1633,9 +1633,6 @@
"security": [
{
"api_key": []
- },
- {
- "ephemeral_key": []
}
]
},
@@ -2018,7 +2015,7 @@
},
"security": [
{
- "publishable_key": []
+ "publishable_key__client_secret": []
}
]
}
@@ -2206,7 +2203,7 @@
},
"security": [
{
- "publishable_key": []
+ "publishable_key__client_secret": []
}
]
}
@@ -2257,7 +2254,7 @@
},
"security": [
{
- "publishable_key": []
+ "publishable_key__client_secret": []
}
]
}
@@ -2646,7 +2643,7 @@
},
"security": [
{
- "publishable_key": []
+ "publishable_key__client_secret": []
}
]
}
@@ -29371,26 +29368,25 @@
"admin_api_key": {
"type": "apiKey",
"in": "header",
- "name": "api-key",
- "description": "Admin API keys allow you to perform some privileged actions such as creating a merchant account and Connector account."
+ "name": "Authorization",
+ "description": "Format: `admin-api-key=<admin-api-key>`\n\nAdmin API keys allow you to perform some privileged actions such as creating a merchant account and Connector account. This is only used during development."
},
"api_key": {
"type": "apiKey",
"in": "header",
- "name": "api-key",
- "description": "Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application."
+ "name": "Authorization",
+ "description": "Format: `api-key=<api_key>`\n\nUse the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application."
},
- "ephemeral_key": {
- "type": "apiKey",
- "in": "header",
- "name": "api-key",
- "description": "Ephemeral keys provide temporary access to singular data, such as access to a single customer object for a short period of time."
+ "jwt_key": {
+ "type": "http",
+ "scheme": "bearer",
+ "bearerFormat": "JWT"
},
- "publishable_key": {
+ "publishable_key__client_secret": {
"type": "apiKey",
"in": "header",
- "name": "api-key",
- "description": "Publishable keys are a type of keys that can be public and have limited scope of usage."
+ "name": "Authorization",
+ "description": "Format: `publishable-key=<publishable-key>,client-secret=<client-secret>`\n\nPublishable keys are a type of keys that can be public and have limited scope of usage. Client Secret provide temporary access to singular data, such as access to a single customer object for a short period of time. This authentication scheme is used by the SDK."
}
}
},
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index d673cf8ae6..56f4e19775 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -1,3 +1,5 @@
+use utoipa::openapi::security::{HttpAuthScheme, HttpBuilder};
+
use crate::routes;
#[derive(utoipa::OpenApi)]
@@ -887,34 +889,31 @@ impl utoipa::Modify for SecurityAddon {
(
"api_key",
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
- "api-key",
- "Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application."
+ "Authorization",
+ "Format: `api-key=<api_key>`\n\nUse the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application."
))),
),
(
"admin_api_key",
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
- "api-key",
- "Admin API keys allow you to perform some privileged actions such as \
- creating a merchant account and Connector account."
+ "Authorization",
+ "Format: `admin-api-key=<admin-api-key>`\n\nAdmin API keys allow you to perform some privileged actions such as \
+ creating a merchant account and Connector account. This is only used during development."
))),
),
(
- "publishable_key",
+ "publishable_key__client_secret",
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
- "api-key",
- "Publishable keys are a type of keys that can be public and have limited \
- scope of usage."
+ "Authorization",
+ "Format: `publishable-key=<publishable-key>,client-secret=<client-secret>`\n\nPublishable keys are a type of keys that can be public and have limited \
+ scope of usage. Client Secret provide temporary access to singular data, such as access to a single customer object for a short period of time. This authentication \
+ scheme is used by the SDK."
))),
),
(
- "ephemeral_key",
- SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
- "api-key",
- "Ephemeral keys provide temporary access to singular data, such as access \
- to a single customer object for a short period of time."
- ))),
- ),
+ "jwt_key",
+ SecurityScheme::Http(HttpBuilder::new().scheme(HttpAuthScheme::Bearer).bearer_format("JWT").build())
+ )
]);
}
}
diff --git a/crates/openapi/src/routes/customers.rs b/crates/openapi/src/routes/customers.rs
index b1451abc4d..e96f6b7b48 100644
--- a/crates/openapi/src/routes/customers.rs
+++ b/crates/openapi/src/routes/customers.rs
@@ -149,7 +149,7 @@ pub async fn customers_create() {}
),
tag = "Customers",
operation_id = "Retrieve a Customer",
- security(("api_key" = []), ("ephemeral_key" = []))
+ security(("api_key" = []))
)]
#[cfg(feature = "v2")]
pub async fn customers_retrieve() {}
diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs
index 6c7d9add9b..1a9a2370ca 100644
--- a/crates/openapi/src/routes/payments.rs
+++ b/crates/openapi/src/routes/payments.rs
@@ -774,7 +774,7 @@ pub fn payments_connector_session() {}
),
tag = "Payments",
operation_id = "Create V2 Session tokens for a Payment",
- security(("publishable_key" = []))
+ security(("publishable_key__client_secret" = []))
)]
pub fn payments_connector_session() {}
@@ -1178,7 +1178,7 @@ pub fn payments_update_intent() {}
),
tag = "Payments",
operation_id = "Confirm Payment Intent",
- security(("publishable_key" = [])),
+ security(("publishable_key__client_secret" = [])),
)]
#[cfg(feature = "v2")]
pub fn payments_confirm_intent() {}
@@ -1285,7 +1285,7 @@ pub(crate) enum ForceSync {
),
tag = "Payments",
operation_id = "Retrieve Payment methods for a Payment",
- security(("publishable_key" = []))
+ security(("publishable_key__client_secret" = []))
)]
pub fn list_payment_methods() {}
@@ -1330,6 +1330,6 @@ pub fn payments_list() {}
),
tag = "Payments",
operation_id = "Apply Payment Method Data",
- security(("publishable_key" = []))
+ security(("publishable_key__client_secret" = []))
)]
pub fn payments_apply_pm_data() {}