docs: request and response for payments route (#400)

This commit is contained in:
Sangamesh Kulkarni
2023-01-20 01:43:08 +05:30
committed by GitHub
parent 2ff76f2549
commit 8113a57f84
6 changed files with 659 additions and 25 deletions

View File

@ -559,7 +559,8 @@ pub enum RoutableConnectors {
Worldpay, Worldpay,
} }
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] /// Wallets which support obtaining session object
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum SupportedWallets { pub enum SupportedWallets {
Paypal, Paypal,

View File

@ -399,10 +399,13 @@ pub enum PaymentMethodDataResponse {
Paypal, Paypal,
} }
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, ToSchema)]
pub enum PaymentIdType { pub enum PaymentIdType {
/// The identifier for payment intent
PaymentIntentId(String), PaymentIntentId(String),
/// The identifier for connector transaction
ConnectorTransactionId(String), ConnectorTransactionId(String),
/// The identifier for payment attempt
PaymentAttemptId(String), PaymentAttemptId(String),
} }
@ -515,13 +518,19 @@ pub struct PhoneDetails {
pub country_code: Option<String>, pub country_code: Option<String>,
} }
#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Deserialize)] #[derive(Debug, Clone, Default, Eq, PartialEq, serde::Deserialize, ToSchema)]
pub struct PaymentsCaptureRequest { pub struct PaymentsCaptureRequest {
/// The unique identifier for the payment
pub payment_id: Option<String>, pub payment_id: Option<String>,
/// The unique identifier for the merchant
pub merchant_id: Option<String>, pub merchant_id: Option<String>,
/// The Amount to be captured/ debited from the user's payment method.
pub amount_to_capture: Option<i64>, pub amount_to_capture: Option<i64>,
/// Decider to refund the uncaptured amount
pub refund_uncaptured_amount: Option<bool>, pub refund_uncaptured_amount: Option<bool>,
/// Provides information about a card payment that customers see on their statements.
pub statement_descriptor_suffix: Option<String>, pub statement_descriptor_suffix: Option<String>,
/// Concatenated with the statement descriptor suffix thats set on the account to form the complete statement descriptor.
pub statement_descriptor_prefix: Option<String>, pub statement_descriptor_prefix: Option<String>,
} }
@ -670,33 +679,44 @@ pub struct PaymentsResponse {
pub error_message: Option<String>, pub error_message: Option<String>,
} }
#[derive(Clone, Debug, serde::Deserialize)] #[derive(Clone, Debug, serde::Deserialize, ToSchema)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct PaymentListConstraints { pub struct PaymentListConstraints {
/// The identifier for customer
pub customer_id: Option<String>, pub customer_id: Option<String>,
/// A cursor for use in pagination, fetch the next list after some object
pub starting_after: Option<String>, pub starting_after: Option<String>,
/// A cursor for use in pagination, fetch the previous list before some object
pub ending_before: Option<String>, pub ending_before: Option<String>,
/// limit on the number of objects to return
#[serde(default = "default_limit")] #[serde(default = "default_limit")]
pub limit: i64, pub limit: i64,
/// The time at which payment is created
#[serde(default, with = "common_utils::custom_serde::iso8601::option")] #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<PrimitiveDateTime>, pub created: Option<PrimitiveDateTime>,
/// Time less than the payment created time
#[serde(default, with = "common_utils::custom_serde::iso8601::option")] #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
#[serde(rename = "created.lt")] #[serde(rename = "created.lt")]
pub created_lt: Option<PrimitiveDateTime>, pub created_lt: Option<PrimitiveDateTime>,
/// Time greater than the payment created time
#[serde(default, with = "common_utils::custom_serde::iso8601::option")] #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
#[serde(rename = "created.gt")] #[serde(rename = "created.gt")]
pub created_gt: Option<PrimitiveDateTime>, pub created_gt: Option<PrimitiveDateTime>,
/// Time less than or equals to the payment created time
#[serde(default, with = "common_utils::custom_serde::iso8601::option")] #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
#[serde(rename = "created.lte")] #[serde(rename = "created.lte")]
pub created_lte: Option<PrimitiveDateTime>, pub created_lte: Option<PrimitiveDateTime>,
/// Time greater than or equals to the payment created time
#[serde(default, with = "common_utils::custom_serde::iso8601::option")] #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
#[serde(rename = "created.gte")] #[serde(rename = "created.gte")]
pub created_gte: Option<PrimitiveDateTime>, pub created_gte: Option<PrimitiveDateTime>,
} }
#[derive(Clone, Debug, serde::Serialize)] #[derive(Clone, Debug, serde::Serialize, ToSchema)]
pub struct PaymentListResponse { pub struct PaymentListResponse {
/// The number of payments included in the list
pub size: usize, pub size: usize,
// The list of payments response objects
pub data: Vec<PaymentsResponse>, pub data: Vec<PaymentsResponse>,
} }
@ -949,12 +969,17 @@ pub struct PaymentsResponseForm {
pub order_id: String, pub order_id: String,
} }
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone)] #[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsRetrieveRequest { pub struct PaymentsRetrieveRequest {
/// The type of ID (ex: payment intent id, payment attempt id or connector txn id)
pub resource_id: PaymentIdType, pub resource_id: PaymentIdType,
/// The identifier for the Merchant Account.
pub merchant_id: Option<String>, pub merchant_id: Option<String>,
/// Decider to enable or disable the connector call for retrieve request
pub force_sync: bool, pub force_sync: bool,
/// The parameters passed to a retrieve request
pub param: Option<String>, pub param: Option<String>,
/// The name of the connector
pub connector: Option<String>, pub connector: Option<String>,
} }
@ -978,119 +1003,171 @@ pub struct Metadata {
pub data: serde_json::Value, pub data: serde_json::Value,
} }
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsSessionRequest { pub struct PaymentsSessionRequest {
/// The identifier for the payment
pub payment_id: String, pub payment_id: String,
/// This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
pub client_secret: String, pub client_secret: String,
/// The list of the supported wallets
#[schema(value_type = Vec<SupportedWallets>)]
pub wallets: Vec<api_enums::SupportedWallets>, pub wallets: Vec<api_enums::SupportedWallets>,
} }
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayAllowedMethodsParameters { pub struct GpayAllowedMethodsParameters {
/// The list of allowed auth methods (ex: 3DS, No3DS, PAN_ONLY etc)
pub allowed_auth_methods: Vec<String>, pub allowed_auth_methods: Vec<String>,
/// The list of allowed card networks (ex: AMEX,JCB etc)
pub allowed_card_networks: Vec<String>, pub allowed_card_networks: Vec<String>,
} }
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayTokenParameters { pub struct GpayTokenParameters {
/// The name of the connector
pub gateway: String, pub gateway: String,
/// The merchant ID registered in the connector associated
pub gateway_merchant_id: String, pub gateway_merchant_id: String,
} }
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayTokenizationSpecification { pub struct GpayTokenizationSpecification {
/// The token specification type(ex: PAYMENT_GATEWAY)
#[serde(rename = "type")] #[serde(rename = "type")]
pub token_specification_type: String, pub token_specification_type: String,
/// The parameters for the token specification Google Pay
pub parameters: GpayTokenParameters, pub parameters: GpayTokenParameters,
} }
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayAllowedPaymentMethods { pub struct GpayAllowedPaymentMethods {
/// The type of payment method
#[serde(rename = "type")] #[serde(rename = "type")]
pub payment_method_type: String, pub payment_method_type: String,
/// The parameters Google Pay requires
pub parameters: GpayAllowedMethodsParameters, pub parameters: GpayAllowedMethodsParameters,
/// The tokenization specification for Google Pay
pub tokenization_specification: GpayTokenizationSpecification, pub tokenization_specification: GpayTokenizationSpecification,
} }
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayTransactionInfo { pub struct GpayTransactionInfo {
/// The country code
pub country_code: String, pub country_code: String,
/// The currency code
pub currency_code: String, pub currency_code: String,
/// The total price status (ex: 'FINAL')
pub total_price_status: String, pub total_price_status: String,
/// The total price
pub total_price: i64, pub total_price: i64,
} }
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GpayMerchantInfo { pub struct GpayMerchantInfo {
/// The name of the merchant
pub merchant_name: String, pub merchant_name: String,
} }
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GpayMetadata { pub struct GpayMetaData {
pub merchant_info: GpayMerchantInfo, pub merchant_info: GpayMerchantInfo,
pub allowed_payment_methods: Vec<GpayAllowedPaymentMethods>, pub allowed_payment_methods: Vec<GpayAllowedPaymentMethods>,
} }
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GpaySessionTokenData { pub struct GpaySessionTokenData {
pub data: GpayMetadata, #[serde(rename = "gpay")]
pub data: GpayMetaData,
} }
#[derive(Debug, Clone, serde::Serialize)] #[derive(Debug, Clone, serde::Serialize, ToSchema)]
#[serde(tag = "wallet_name")] #[serde(tag = "wallet_name")]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum SessionToken { pub enum SessionToken {
/// The session response structure for Google Pay
Gpay { Gpay {
#[serde(flatten)] /// The merchant info
data: GpayMetadata, merchant_info: GpayMerchantInfo,
/// List of the allowed payment meythods
allowed_payment_methods: Vec<GpayAllowedPaymentMethods>,
/// The transaction info Google Pay requires
transaction_info: GpayTransactionInfo, transaction_info: GpayTransactionInfo,
}, },
/// The session response structure for Klarna
Klarna { Klarna {
/// The session token for Klarna
session_token: String, session_token: String,
/// The identifier for the session
session_id: String, session_id: String,
}, },
/// The session response structure for PayPal
Paypal { Paypal {
/// The session token for PayPal
session_token: String, session_token: String,
}, },
/// The session response structure for Apple Pay
Applepay { Applepay {
/// Timestamp at which session is requested
epoch_timestamp: u64, epoch_timestamp: u64,
/// Timestamp at which session expires
expires_at: u64, expires_at: u64,
/// The identifier for the merchant session
merchant_session_identifier: String, merchant_session_identifier: String,
/// Applepay generates unique ID (UUID) value
nonce: String, nonce: String,
/// The identifier for the merchant
merchant_identifier: String, merchant_identifier: String,
/// The domain name of the merchant which is registered in Apple Pay
domain_name: String, domain_name: String,
/// The name to be displayed on Apple Pay button
display_name: String, display_name: String,
/// A string which represents the properties of a payment
signature: String, signature: String,
/// The identifier for the operational analytics
operational_analytics_identifier: String, operational_analytics_identifier: String,
/// The number of retries to get the session response
retries: u8, retries: u8,
/// The identifier for the connector transaction
psp_id: String, psp_id: String,
}, },
} }
#[derive(Default, Debug, serde::Serialize, Clone)] #[derive(Default, Debug, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsSessionResponse { pub struct PaymentsSessionResponse {
/// The identifier for the payment
pub payment_id: String, pub payment_id: String,
/// This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
#[schema(value_type = String)]
pub client_secret: Secret<String, pii::ClientSecret>, pub client_secret: Secret<String, pii::ClientSecret>,
/// The list of session token object
pub session_token: Vec<SessionToken>, pub session_token: Vec<SessionToken>,
} }
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone)] #[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentRetrieveBody { pub struct PaymentRetrieveBody {
/// The identifier for the Merchant Account.
pub merchant_id: Option<String>, pub merchant_id: Option<String>,
/// Decider to enable or disable the connector call for retrieve request
pub force_sync: Option<bool>, pub force_sync: Option<bool>,
} }
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone)] #[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentsCancelRequest { pub struct PaymentsCancelRequest {
/// The identifier for the payment
#[serde(skip)] #[serde(skip)]
pub payment_id: String, pub payment_id: String,
/// The reason for the payment cancel
pub cancellation_reason: Option<String>, pub cancellation_reason: Option<String>,
} }
#[derive(Default, Debug, serde::Deserialize, serde::Serialize)] #[derive(Default, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PaymentsStartRequest { pub struct PaymentsStartRequest {
/// Unique identifier for the payment. This ensures impotency for multiple payments
/// that have been done by a single merchant. This field is auto generated and is returned in the API response.
pub payment_id: String, pub payment_id: String,
/// The identifier for the Merchant Account.
pub merchant_id: String, pub merchant_id: String,
pub txn_id: String, /// The identifier for the payment transaction
pub attempt_id: String,
} }
mod payment_id_type { mod payment_id_type {

View File

@ -84,8 +84,9 @@ fn create_gpay_session_token(
let response_router_data = types::PaymentsSessionRouterData { let response_router_data = types::PaymentsSessionRouterData {
response: Ok(types::PaymentsResponseData::SessionResponse { response: Ok(types::PaymentsResponseData::SessionResponse {
session_token: payment_types::SessionToken::Gpay { session_token: payment_types::SessionToken::Gpay {
data: gpay_data.data,
transaction_info, transaction_info,
merchant_info: gpay_data.data.merchant_info,
allowed_payment_methods: gpay_data.data.allowed_payment_methods,
}, },
}), }),
..router_data.clone() ..router_data.clone()

View File

@ -70,6 +70,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::WalletIssuer, api_models::enums::WalletIssuer,
api_models::enums::Connector, api_models::enums::Connector,
api_models::enums::PaymentMethodType, api_models::enums::PaymentMethodType,
api_models::enums::SupportedWallets,
api_models::admin::PaymentConnectorCreate, api_models::admin::PaymentConnectorCreate,
api_models::admin::PaymentMethods, api_models::admin::PaymentMethods,
api_models::payments::AddressDetails, api_models::payments::AddressDetails,
@ -94,6 +95,23 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentsRequest, api_models::payments::PaymentsRequest,
api_models::payments::PaymentsResponse, api_models::payments::PaymentsResponse,
api_models::payment_methods::PaymentExperience, api_models::payment_methods::PaymentExperience,
api_models::payments::PaymentsStartRequest,
api_models::payments::PaymentRetrieveBody,
api_models::payments::PaymentsRetrieveRequest,
api_models::payments::PaymentIdType,
api_models::payments::PaymentsCaptureRequest,
api_models::payments::PaymentsSessionRequest,
api_models::payments::PaymentsSessionResponse,
api_models::payments::SessionToken,
api_models::payments::GpayMerchantInfo,
api_models::payments::GpayAllowedPaymentMethods,
api_models::payments::GpayAllowedMethodsParameters,
api_models::payments::GpayTokenizationSpecification,
api_models::payments::GpayTokenParameters,
api_models::payments::GpayTransactionInfo,
api_models::payments::PaymentsCancelRequest,
api_models::payments::PaymentListConstraints,
api_models::payments::PaymentListResponse,
crate::types::api::admin::MerchantAccountResponse, crate::types::api::admin::MerchantAccountResponse,
crate::types::api::admin::MerchantConnectorId, crate::types::api::admin::MerchantConnectorId,
crate::types::api::admin::MerchantDetails, crate::types::api::admin::MerchantDetails,

View File

@ -62,7 +62,7 @@ pub async fn payments_start(
let payload = payment_types::PaymentsStartRequest { let payload = payment_types::PaymentsStartRequest {
payment_id: payment_id.clone(), payment_id: payment_id.clone(),
merchant_id: merchant_id.clone(), merchant_id: merchant_id.clone(),
txn_id: attempt_id.clone(), attempt_id: attempt_id.clone(),
}; };
api::server_wrap( api::server_wrap(
&state, &state,

View File

@ -698,6 +698,122 @@
"on_session" "on_session"
] ]
}, },
"GpayAllowedMethodsParameters": {
"type": "object",
"required": [
"allowed_auth_methods",
"allowed_card_networks"
],
"properties": {
"allowed_auth_methods": {
"type": "array",
"items": {
"type": "string",
"description": "The list of allowed auth methods (ex: 3DS, No3DS, PAN_ONLY etc)"
}
},
"allowed_card_networks": {
"type": "array",
"items": {
"type": "string",
"description": "The list of allowed card networks (ex: AMEX,JCB etc)"
}
}
}
},
"GpayAllowedPaymentMethods": {
"type": "object",
"required": [
"type",
"parameters",
"tokenization_specification"
],
"properties": {
"type": {
"type": "string",
"description": "The type of payment method"
},
"parameters": {
"$ref": "#/components/schemas/GpayAllowedMethodsParameters"
},
"tokenization_specification": {
"$ref": "#/components/schemas/GpayTokenizationSpecification"
}
}
},
"GpayMerchantInfo": {
"type": "object",
"required": [
"merchant_name"
],
"properties": {
"merchant_name": {
"type": "string",
"description": "The name of the merchant"
}
}
},
"GpayTokenParameters": {
"type": "object",
"required": [
"gateway",
"gateway_merchant_id"
],
"properties": {
"gateway": {
"type": "string",
"description": "The name of the connector"
},
"gateway_merchant_id": {
"type": "string",
"description": "The merchant ID registered in the connector associated"
}
}
},
"GpayTokenizationSpecification": {
"type": "object",
"required": [
"type",
"parameters"
],
"properties": {
"type": {
"type": "string",
"description": "The token specification type(ex: PAYMENT_GATEWAY)"
},
"parameters": {
"$ref": "#/components/schemas/GpayTokenParameters"
}
}
},
"GpayTransactionInfo": {
"type": "object",
"required": [
"country_code",
"currency_code",
"total_price_status",
"total_price"
],
"properties": {
"country_code": {
"type": "string",
"description": "The country code"
},
"currency_code": {
"type": "string",
"description": "The currency code"
},
"total_price_status": {
"type": "string",
"description": "The total price status (ex: 'FINAL')"
},
"total_price": {
"type": "integer",
"format": "int64",
"description": "The total price"
}
}
},
"IntentStatus": { "IntentStatus": {
"type": "string", "type": "string",
"enum": [ "enum": [
@ -1184,6 +1300,112 @@
"invoke_payment_app" "invoke_payment_app"
] ]
}, },
"PaymentIdType": {
"oneOf": [
{
"type": "object",
"required": [
"PaymentIntentId"
],
"properties": {
"PaymentIntentId": {
"type": "string",
"description": "The identifier for payment intent"
}
}
},
{
"type": "object",
"required": [
"ConnectorTransactionId"
],
"properties": {
"ConnectorTransactionId": {
"type": "string",
"description": "The identifier for connector transaction"
}
}
},
{
"type": "object",
"required": [
"PaymentAttemptId"
],
"properties": {
"PaymentAttemptId": {
"type": "string",
"description": "The identifier for payment attempt"
}
}
}
]
},
"PaymentListConstraints": {
"type": "object",
"properties": {
"customer_id": {
"type": "string",
"description": "The identifier for customer"
},
"starting_after": {
"type": "string",
"description": "A cursor for use in pagination, fetch the next list after some object"
},
"ending_before": {
"type": "string",
"description": "A cursor for use in pagination, fetch the previous list before some object"
},
"limit": {
"type": "integer",
"format": "int64",
"description": "limit on the number of objects to return"
},
"created": {
"type": "string",
"format": "date-time",
"description": "The time at which payment is created"
},
"created.lt": {
"type": "string",
"format": "date-time",
"description": "Time less than the payment created time"
},
"created.gt": {
"type": "string",
"format": "date-time",
"description": "Time greater than the payment created time"
},
"created.lte": {
"type": "string",
"format": "date-time",
"description": "Time less than or equals to the payment created time"
},
"created.gte": {
"type": "string",
"format": "date-time",
"description": "Time greater than or equals to the payment created time"
}
}
},
"PaymentListResponse": {
"type": "object",
"required": [
"size",
"data"
],
"properties": {
"size": {
"type": "integer",
"description": "The number of payments included in the list"
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PaymentsResponse"
}
}
}
},
"PaymentMethod": { "PaymentMethod": {
"oneOf": [ "oneOf": [
{ {
@ -1361,6 +1583,58 @@
} }
} }
}, },
"PaymentRetrieveBody": {
"type": "object",
"properties": {
"merchant_id": {
"type": "string",
"description": "The identifier for the Merchant Account."
},
"force_sync": {
"type": "boolean",
"description": "Decider to enable or disable the connector call for retrieve request"
}
}
},
"PaymentsCancelRequest": {
"type": "object",
"properties": {
"cancellation_reason": {
"type": "string",
"description": "The reason for the payment cancel"
}
}
},
"PaymentsCaptureRequest": {
"type": "object",
"properties": {
"payment_id": {
"type": "string",
"description": "The unique identifier for the payment"
},
"merchant_id": {
"type": "string",
"description": "The unique identifier for the merchant"
},
"amount_to_capture": {
"type": "integer",
"format": "int64",
"description": "The Amount to be captured/ debited from the user's payment method."
},
"refund_uncaptured_amount": {
"type": "boolean",
"description": "Decider to refund the uncaptured amount"
},
"statement_descriptor_suffix": {
"type": "string",
"description": "Provides information about a card payment that customers see on their statements."
},
"statement_descriptor_prefix": {
"type": "string",
"description": "Concatenated with the statement descriptor suffix thats set on the account to form the complete statement descriptor."
}
}
},
"PaymentsRequest": { "PaymentsRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -1699,6 +1973,104 @@
} }
} }
}, },
"PaymentsRetrieveRequest": {
"type": "object",
"required": [
"resource_id",
"force_sync"
],
"properties": {
"resource_id": {
"$ref": "#/components/schemas/PaymentIdType"
},
"merchant_id": {
"type": "string",
"description": "The identifier for the Merchant Account."
},
"force_sync": {
"type": "boolean",
"description": "Decider to enable or disable the connector call for retrieve request"
},
"param": {
"type": "string",
"description": "The parameters passed to a retrieve request"
},
"connector": {
"type": "string",
"description": "The name of the connector"
}
}
},
"PaymentsSessionRequest": {
"type": "object",
"required": [
"payment_id",
"client_secret",
"wallets"
],
"properties": {
"payment_id": {
"type": "string",
"description": "The identifier for the payment"
},
"client_secret": {
"type": "string",
"description": "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"
},
"wallets": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SupportedWallets"
}
}
}
},
"PaymentsSessionResponse": {
"type": "object",
"required": [
"payment_id",
"client_secret",
"session_token"
],
"properties": {
"payment_id": {
"type": "string",
"description": "The identifier for the payment"
},
"client_secret": {
"type": "string",
"description": "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"
},
"session_token": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SessionToken"
}
}
}
},
"PaymentsStartRequest": {
"type": "object",
"required": [
"payment_id",
"merchant_id",
"attempt_id"
],
"properties": {
"payment_id": {
"type": "string",
"description": "Unique identifier for the payment. This ensures impotency for multiple payments\nthat have been done by a single merchant. This field is auto generated and is returned in the API response."
},
"merchant_id": {
"type": "string",
"description": "The identifier for the Merchant Account."
},
"attempt_id": {
"type": "string",
"description": "The identifier for the payment transaction"
}
}
},
"PhoneDetails": { "PhoneDetails": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -1833,6 +2205,171 @@
], ],
"example": "custom" "example": "custom"
}, },
"SessionToken": {
"oneOf": [
{
"type": "object",
"description": "The session response structure for Google Pay",
"required": [
"merchant_info",
"allowed_payment_methods",
"transaction_info",
"wallet_name"
],
"properties": {
"merchant_info": {
"$ref": "#/components/schemas/GpayMerchantInfo"
},
"allowed_payment_methods": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GpayAllowedPaymentMethods"
}
},
"transaction_info": {
"$ref": "#/components/schemas/GpayTransactionInfo"
},
"wallet_name": {
"type": "string",
"enum": [
"gpay"
]
}
}
},
{
"type": "object",
"description": "The session response structure for Klarna",
"required": [
"session_token",
"session_id",
"wallet_name"
],
"properties": {
"session_token": {
"type": "string",
"description": "The session token for Klarna"
},
"session_id": {
"type": "string",
"description": "The identifier for the session"
},
"wallet_name": {
"type": "string",
"enum": [
"klarna"
]
}
}
},
{
"type": "object",
"description": "The session response structure for PayPal",
"required": [
"session_token",
"wallet_name"
],
"properties": {
"session_token": {
"type": "string",
"description": "The session token for PayPal"
},
"wallet_name": {
"type": "string",
"enum": [
"paypal"
]
}
}
},
{
"type": "object",
"description": "The session response structure for Apple Pay",
"required": [
"epoch_timestamp",
"expires_at",
"merchant_session_identifier",
"nonce",
"merchant_identifier",
"domain_name",
"display_name",
"signature",
"operational_analytics_identifier",
"retries",
"psp_id",
"wallet_name"
],
"properties": {
"epoch_timestamp": {
"type": "integer",
"format": "int64",
"description": "Timestamp at which session is requested"
},
"expires_at": {
"type": "integer",
"format": "int64",
"description": "Timestamp at which session expires"
},
"merchant_session_identifier": {
"type": "string",
"description": "The identifier for the merchant session"
},
"nonce": {
"type": "string",
"description": "Applepay generates unique ID (UUID) value"
},
"merchant_identifier": {
"type": "string",
"description": "The identifier for the merchant"
},
"domain_name": {
"type": "string",
"description": "The domain name of the merchant which is registered in Apple Pay"
},
"display_name": {
"type": "string",
"description": "The name to be displayed on Apple Pay button"
},
"signature": {
"type": "string",
"description": "A string which represents the properties of a payment"
},
"operational_analytics_identifier": {
"type": "string",
"description": "The identifier for the operational analytics"
},
"retries": {
"type": "integer",
"format": "int32",
"description": "The number of retries to get the session response"
},
"psp_id": {
"type": "string",
"description": "The identifier for the connector transaction"
},
"wallet_name": {
"type": "string",
"enum": [
"applepay"
]
}
}
}
],
"discriminator": {
"propertyName": "wallet_name"
}
},
"SupportedWallets": {
"type": "string",
"description": "Wallets which support obtaining session object",
"enum": [
"paypal",
"apple_pay",
"klarna",
"gpay"
]
},
"WalletData": { "WalletData": {
"type": "object", "type": "object",
"required": [ "required": [