From 33309daf5ced2197c030d2c51b02a9d9d1878b9f Mon Sep 17 00:00:00 2001 From: Sangamesh Kulkarni <59434228+Sangamesh26@users.noreply.github.com> Date: Wed, 28 Jun 2023 14:34:49 +0530 Subject: [PATCH] feat(connector): [Adyen] Add support for Samsung Pay (#1525) --- crates/api_models/src/enums.rs | 1 + crates/api_models/src/payments.rs | 10 + .../src/connector/adyen/transformers.rs | 17 + crates/router/src/openapi.rs | 1 + crates/storage_models/src/enums.rs | 1 + openapi/openapi_spec.json | 889 +++++++++++------- 6 files changed, 577 insertions(+), 342 deletions(-) diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs index 5af51bc6ec5..be50be7db92 100644 --- a/crates/api_models/src/enums.rs +++ b/crates/api_models/src/enums.rs @@ -442,6 +442,7 @@ pub enum PaymentMethodType { PayBright, Paypal, Przelewy24, + SamsungPay, Sepa, Sofort, Swish, diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index fac19491438..9d8fe927663 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -845,10 +845,20 @@ pub enum WalletData { PaypalRedirect(PaypalRedirection), /// The wallet data for Paypal PaypalSdk(PayPalWalletData), + /// The wallet data for Samsung Pay + SamsungPay(Box), /// The wallet data for WeChat Pay Redirection WeChatPayRedirect(Box), } +#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] +#[serde(rename_all = "snake_case")] +pub struct SamsungPayWalletData { + /// The encrypted payment token from Samsung + #[schema(value_type = String)] + pub token: Secret, +} + #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] #[serde(rename_all = "snake_case")] pub struct GooglePayWalletData { diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index eff4809ccbc..bf0379eca5a 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -284,6 +284,7 @@ pub enum AdyenPaymentMethod<'a> { #[serde(rename = "sepadirectdebit")] SepaDirectDebit(Box), BacsDirectDebit(Box), + SamsungPay(Box), } #[derive(Debug, Clone, Serialize)] @@ -360,6 +361,14 @@ pub struct WalleyData { payment_type: PaymentType, } +#[derive(Debug, Clone, Serialize)] +pub struct SamsungPayPmData { + #[serde(rename = "type")] + payment_type: PaymentType, + #[serde(rename = "samsungPayToken")] + samsung_pay_token: Secret, +} + #[derive(Debug, Clone, Serialize)] pub struct PayBrightData { #[serde(rename = "type")] @@ -690,6 +699,7 @@ pub enum PaymentType { SepaDirectDebit, #[serde(rename = "directdebit_GB")] BacsDirectDebit, + Samsungpay, } pub struct AdyenTestBankNames<'a>(&'a str); @@ -1097,6 +1107,13 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> { }; Ok(AdyenPaymentMethod::WeChatPayWeb(Box::new(data))) } + api_models::payments::WalletData::SamsungPay(samsung_data) => { + let data = SamsungPayPmData { + payment_type: PaymentType::Samsungpay, + samsung_pay_token: samsung_data.token.to_owned(), + }; + Ok(AdyenPaymentMethod::SamsungPay(Box::new(data))) + } _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), } } diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs index f4170be30de..144b6ba6ee0 100644 --- a/crates/router/src/openapi.rs +++ b/crates/router/src/openapi.rs @@ -222,6 +222,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::ApplepaySessionTokenResponse, api_models::payments::SdkNextAction, api_models::payments::NextActionCall, + api_models::payments::SamsungPayWalletData, api_models::payments::GpayTokenizationData, api_models::payments::GooglePayPaymentMethodInfo, api_models::payments::ApplePayWalletData, diff --git a/crates/storage_models/src/enums.rs b/crates/storage_models/src/enums.rs index 9e0531a187e..4578c72959e 100644 --- a/crates/storage_models/src/enums.rs +++ b/crates/storage_models/src/enums.rs @@ -701,6 +701,7 @@ pub enum PaymentMethodType { PayBright, Paypal, Przelewy24, + SamsungPay, Sepa, Sofort, Swish, diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index 59cdc11ae41..cd1cf109ba0 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -1797,7 +1797,6 @@ "type": "object", "required": [ "label", - "type", "amount" ], "properties": { @@ -1807,7 +1806,8 @@ }, "type": { "type": "string", - "description": "A value that indicates whether the line item(Ex: total, tax, discount, or grand total) is final or pending." + "description": "A value that indicates whether the line item(Ex: total, tax, discount, or grand total) is final or pending.", + "nullable": true }, "amount": { "type": "string", @@ -1836,8 +1836,7 @@ "currency_code", "total", "merchant_capabilities", - "supported_networks", - "merchant_identifier" + "supported_networks" ], "properties": { "country_code": { @@ -1865,7 +1864,8 @@ "description": "The list of supported networks" }, "merchant_identifier": { - "type": "string" + "type": "string", + "nullable": true } } }, @@ -1873,72 +1873,22 @@ "type": "object" }, "ApplePaySessionResponse": { - "type": "object", - "required": [ - "epoch_timestamp", - "expires_at", - "merchant_session_identifier", - "nonce", - "merchant_identifier", - "domain_name", - "display_name", - "signature", - "operational_analytics_identifier", - "retries", - "psp_id" - ], - "properties": { - "epoch_timestamp": { - "type": "integer", - "format": "int64", - "description": "Timestamp at which session is requested", - "minimum": 0.0 - }, - "expires_at": { - "type": "integer", - "format": "int64", - "description": "Timestamp at which session expires", - "minimum": 0.0 - }, - "merchant_session_identifier": { - "type": "string", - "description": "The identifier for the merchant session" - }, - "nonce": { - "type": "string", - "description": "Apple pay generated 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" + "oneOf": [ + { + "$ref": "#/components/schemas/ThirdPartySdkSessionResponse" }, - "retries": { - "type": "integer", - "format": "int32", - "description": "The number of retries to get the session response", - "minimum": 0.0 + { + "$ref": "#/components/schemas/NoThirdPartySdkSessionResponse" }, - "psp_id": { - "type": "string", - "description": "The identifier for the connector transaction" + { + "type": "object", + "default": null, + "nullable": true } - } + ] + }, + "ApplePayThirdPartySdkData": { + "type": "object" }, "ApplePayWalletData": { "type": "object", @@ -1987,18 +1937,32 @@ "type": "object", "required": [ "session_token_data", - "payment_request_data", - "connector" + "connector", + "delayed_session_token", + "sdk_next_action" ], "properties": { "session_token_data": { "$ref": "#/components/schemas/ApplePaySessionResponse" }, "payment_request_data": { - "$ref": "#/components/schemas/ApplePayPaymentRequest" + "allOf": [ + { + "$ref": "#/components/schemas/ApplePayPaymentRequest" + } + ], + "nullable": true }, "connector": { - "type": "string" + "type": "string", + "description": "The session token is w.r.t this connector" + }, + "delayed_session_token": { + "type": "boolean", + "description": "Identifier for the delayed session response" + }, + "sdk_next_action": { + "$ref": "#/components/schemas/SdkNextAction" } } }, @@ -2210,7 +2174,7 @@ "american_express", "bank_of_america", "barclays", - "BLIK - PSP", + "blik_p_s_p", "capital_one", "chase", "citi", @@ -2238,17 +2202,17 @@ "bank99_ag", "bankhaus_carl_spangler", "bankhaus_schelhammer_und_schattera_ag", - "Bank Millennium", - "Bank PEKAO S.A.", + "bank_millennium", + "bank_p_e_k_a_o_s_a", "bawag_psk_ag", "bks_bank_ag", "brull_kallmus_bank_ag", "btv_vier_lander_bank", "capital_bank_grawe_gruppe_ag", - "Česká spořitelna", + "ceska_sporitelna", "dolomitenbank", "easybank_ag", - "ePlatby VÚB", + "e_platby_v_u_b", "erste_bank_und_sparkassen", "friesland_bank", "hypo_alpeadriabank_international_ag", @@ -2257,39 +2221,39 @@ "hypo_tirol_bank_ag", "hypo_vorarlberg_bank_ag", "hypo_bank_burgenland_aktiengesellschaft", - "Komercní banka", - "mBank - mTransfer", + "komercni_banka", + "m_bank", "marchfelder_bank", "oberbank_ag", "osterreichische_arzte_und_apothekerbank", - "Pay with ING", - "Płacę z iPKO", - "Płatność online kartą płatniczą", + "pay_with_i_n_g", + "place_z_i_p_k_o", + "platnosc_online_karta_platnicza", "posojilnica_bank_e_gen", - "Poštová banka", + "postova_banka", "raiffeisen_bankengruppe_osterreich", "schelhammer_capital_bank_ag", "schoellerbank_ag", "sparda_bank_wien", "sporo_pay", - "Santander-Przelew24", + "santander_przelew24", "tatra_pay", "viamo", "volksbank_gruppe", "volkskreditbank_ag", "vr_bank_braunau", - "Pay with Alior Bank", - "Banki Spółdzielcze", - "Pay with Inteligo", - "BNP Paribas Poland", - "Bank Nowy S.A.", - "Credit Agricole", - "Pay with BOŚ", - "Pay with CitiHandlowy", - "Pay with Plus Bank", - "Toyota Bank", + "pay_with_alior_bank", + "banki_spoldzielcze", + "pay_with_inteligo", + "b_n_p_paribas_poland", + "bank_nowy_s_a", + "credit_agricole", + "pay_with_b_o_s", + "pay_with_citi_handlowy", + "pay_with_plus_bank", + "toyota_bank", "velo_bank", - "e-transfer Pocztowy24", + "e_transfer_pocztowy24", "plus_bank", "etransfer_pocztowy24", "banki_spbdzielcze", @@ -2936,9 +2900,9 @@ "coinbase", "cybersource", "iatapay", - "dummyconnector1", - "dummyconnector2", - "dummyconnector3", + "phonypay", + "fauxpay", + "pretendpay", "opennode", "bambora", "dlocal", @@ -3399,6 +3363,7 @@ "PKR", "PLN", "QAR", + "RON", "RUB", "SAR", "SCR", @@ -3410,6 +3375,7 @@ "SVC", "SZL", "THB", + "TRY", "TTD", "TWD", "TZS", @@ -3478,6 +3444,46 @@ } } }, + "CustomerDetails": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The identifier for the customer." + }, + "name": { + "type": "string", + "description": "The customer's name", + "example": "John Doe", + "nullable": true, + "maxLength": 255 + }, + "email": { + "type": "string", + "description": "The customer's email address", + "example": "johntest@test.com", + "nullable": true, + "maxLength": 255 + }, + "phone": { + "type": "string", + "description": "The customer's phone number", + "example": "3141592653", + "nullable": true, + "maxLength": 10 + }, + "phone_country_code": { + "type": "string", + "description": "The country code for the customer's phone number", + "example": "+1", + "nullable": true, + "maxLength": 2 + } + } + }, "CustomerPaymentMethod": { "type": "object", "required": [ @@ -5281,58 +5287,49 @@ } }, "Metadata": { - "allOf": [ - { - "type": "object", - "description": "Any other metadata that is to be provided" + "type": "object", + "properties": { + "order_details": { + "allOf": [ + { + "$ref": "#/components/schemas/OrderDetails" + } + ], + "nullable": true }, - { - "type": "object", - "properties": { - "order_details": { - "allOf": [ - { - "$ref": "#/components/schemas/OrderDetails" - } - ], - "nullable": true - }, - "routing_parameters": { - "type": "object", - "description": "Information used for routing", - "additionalProperties": { - "type": "string" - }, - "nullable": true - }, - "order_category": { - "type": "string", - "description": "Information about the order category that merchant wants to specify at connector level. (e.g. In Noon Payments it can take values like \"pay\", \"food\", or any other custom string set by the merchant in Noon's Dashboard)", - "nullable": true - }, - "redirect_response": { - "allOf": [ - { - "$ref": "#/components/schemas/RedirectResponse" - } - ], - "nullable": true - }, - "allowed_payment_method_types": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PaymentMethodType" - }, - "description": "Allowed payment method types for a payment intent", - "nullable": true + "order_category": { + "type": "string", + "description": "Information about the order category that merchant wants to specify at connector level. (e.g. In Noon Payments it can take values like \"pay\", \"food\", or any other custom string set by the merchant in Noon's Dashboard)", + "nullable": true + }, + "redirect_response": { + "allOf": [ + { + "$ref": "#/components/schemas/RedirectResponse" } - } + ], + "nullable": true + }, + "allowed_payment_method_types": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentMethodType" + }, + "description": "Allowed payment method types for a payment intent", + "nullable": true } - ] + } }, "MobilePayRedirection": { "type": "object" }, + "NextActionCall": { + "type": "string", + "enum": [ + "confirm", + "sync" + ] + }, "NextActionData": { "oneOf": [ { @@ -5372,6 +5369,29 @@ ] } } + }, + { + "type": "object", + "description": "contains third party sdk session token response", + "required": [ + "type" + ], + "properties": { + "session_token": { + "allOf": [ + { + "$ref": "#/components/schemas/SessionToken" + } + ], + "nullable": true + }, + "type": { + "type": "string", + "enum": [ + "third_party_sdk_session_token" + ] + } + } } ], "discriminator": { @@ -5388,42 +5408,110 @@ "display_bank_transfer_information" ] }, - "OnlineMandate": { + "NoThirdPartySdkSessionResponse": { "type": "object", "required": [ - "ip_address", - "user_agent" + "epoch_timestamp", + "expires_at", + "merchant_session_identifier", + "nonce", + "merchant_identifier", + "domain_name", + "display_name", + "signature", + "operational_analytics_identifier", + "retries", + "psp_id" ], "properties": { - "ip_address": { + "epoch_timestamp": { + "type": "integer", + "format": "int64", + "description": "Timestamp at which session is requested", + "minimum": 0.0 + }, + "expires_at": { + "type": "integer", + "format": "int64", + "description": "Timestamp at which session expires", + "minimum": 0.0 + }, + "merchant_session_identifier": { "type": "string", - "description": "Ip address of the customer machine from which the mandate was created", - "example": "123.32.25.123" + "description": "The identifier for the merchant session" }, - "user_agent": { + "nonce": { "type": "string", - "description": "The user-agent of the customer's browser" - } - } - }, - "OrderDetails": { - "type": "object", - "required": [ - "product_name", - "quantity" - ], - "properties": { - "product_name": { + "description": "Apple pay generated unique ID (UUID) value" + }, + "merchant_identifier": { "type": "string", - "description": "Name of the product that is being purchased", - "example": "shirt", - "maxLength": 255 + "description": "The identifier for the merchant" }, - "quantity": { - "type": "integer", - "format": "int32", - "description": "The quantity of the product to be purchased", - "example": 1, + "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", + "minimum": 0.0 + }, + "psp_id": { + "type": "string", + "description": "The identifier for the connector transaction" + } + } + }, + "OnlineMandate": { + "type": "object", + "required": [ + "ip_address", + "user_agent" + ], + "properties": { + "ip_address": { + "type": "string", + "description": "Ip address of the customer machine from which the mandate was created", + "example": "123.32.25.123" + }, + "user_agent": { + "type": "string", + "description": "The user-agent of the customer's browser" + } + } + }, + "OrderDetails": { + "type": "object", + "required": [ + "product_name", + "quantity" + ], + "properties": { + "product_name": { + "type": "string", + "description": "Name of the product that is being purchased", + "example": "shirt", + "maxLength": 255 + }, + "quantity": { + "type": "integer", + "format": "int32", + "description": "The quantity of the product to be purchased", + "example": 1, "minimum": 0.0 } } @@ -5545,10 +5633,10 @@ { "type": "object", "required": [ - "pay_bright" + "pay_bright_redirect" ], "properties": { - "pay_bright": { + "pay_bright_redirect": { "type": "object" } } @@ -5556,10 +5644,10 @@ { "type": "object", "required": [ - "walley" + "walley_redirect" ], "properties": { - "walley": { + "walley_redirect": { "type": "object" } } @@ -6083,6 +6171,7 @@ "pay_bright", "paypal", "przelewy24", + "samsung_pay", "sepa", "sofort", "swish", @@ -6218,38 +6307,66 @@ "PaymentsCreateRequest": { "type": "object", "required": [ - "amount", + "currency", "manual_retry", - "currency" + "amount" ], "properties": { - "phone": { + "name": { "type": "string", - "description": "The customer's phone number", - "example": "3141592653", + "description": "description: The customer's name\nThis field will be deprecated soon, use the customer object instead", + "example": "John Test", "nullable": true, "maxLength": 255 }, - "card_cvc": { + "payment_experience": { + "allOf": [ + { + "$ref": "#/components/schemas/PaymentExperience" + } + ], + "nullable": true + }, + "business_label": { "type": "string", - "description": "This is used when payment is to be confirmed and the card is not saved", + "description": "Business label of the merchant for this payment", + "example": "food", "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, + "phone": { + "type": "string", + "description": "The customer's phone number\nThis field will be deprecated soon, use the customer object instead", + "example": "3141592653", "nullable": true, - "minimum": 0.0 + "maxLength": 255 }, - "customer_id": { + "statement_descriptor_suffix": { "type": "string", - "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.", - "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44", + "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.", + "example": "Payment for shoes purchase", + "nullable": true, + "maxLength": 255 + }, + "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 }, + "currency": { + "allOf": [ + { + "$ref": "#/components/schemas/Currency" + } + ], + "nullable": true + }, + "card_cvc": { + "type": "string", + "description": "This is used when payment is to be confirmed and the card is not saved", + "nullable": true + }, "order_details": { "type": "array", "items": { @@ -6259,17 +6376,17 @@ "example": "[{\n \"product_name\": \"gillete creme\",\n \"quantity\": 15,\n \"amount\" : 900\n }]", "nullable": true }, - "amount_to_capture": { - "type": "integer", - "format": "int64", - "description": "The Amount to be captured/ debited from the users payment method. It shall be in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,\nIf not provided, the default amount_to_capture will be the payment amount.", - "example": 6540, + "shipping": { + "allOf": [ + { + "$ref": "#/components/schemas/Address" + } + ], "nullable": true }, - "business_label": { + "business_sub_label": { "type": "string", - "description": "Business label of the merchant for this payment", - "example": "food", + "description": "Business sub label for the payment", "nullable": true }, "capture_on": { @@ -6279,108 +6396,65 @@ "example": "2022-09-10T10:11:12Z", "nullable": true }, - "phone_country_code": { - "type": "string", - "description": "The country code for the customer phone number", - "example": "+1", - "nullable": true, - "maxLength": 255 - }, - "payment_token": { - "type": "string", - "description": "Provide a reference to a stored payment method", - "example": "187282ab-40ef-47a9-9206-5099ba31e432", - "nullable": true - }, - "client_secret": { - "type": "string", - "description": "It's a token used for client side verification.", - "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo", - "nullable": true - }, - "payment_experience": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentExperience" - } - ], - "nullable": true - }, - "allowed_payment_method_types": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PaymentMethodType" - }, - "description": "Allowed Payment Method Types for a given PaymentIntent", - "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." }, - "email": { + "merchant_id": { "type": "string", - "description": "description: The customer's email address", - "example": "johntest@test.com", + "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 }, - "authentication_type": { + "capture_method": { "allOf": [ { - "$ref": "#/components/schemas/AuthenticationType" + "$ref": "#/components/schemas/CaptureMethod" } ], "nullable": true }, - "business_country": { + "mandate_data": { "allOf": [ { - "$ref": "#/components/schemas/CountryAlpha2" + "$ref": "#/components/schemas/MandateData" } ], "nullable": true }, - "return_url": { - "type": "string", - "description": "The URL to redirect after the completion of the operation", - "example": "https://hyperswitch.io", + "udf": { + "type": "object", + "description": "Any user defined fields can be passed here.", "nullable": true }, - "payment_method_data": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentMethodData" - } - ], + "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 }, - "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 - }, - "shipping": { + "payment_method": { "allOf": [ { - "$ref": "#/components/schemas/Address" + "$ref": "#/components/schemas/PaymentMethod" } ], "nullable": true }, - "billing": { + "customer": { "allOf": [ { - "$ref": "#/components/schemas/Address" + "$ref": "#/components/schemas/CustomerDetails" } ], "nullable": true }, - "metadata": { - "allOf": [ - { - "$ref": "#/components/schemas/Metadata" - } - ], + "payment_token": { + "type": "string", + "description": "Provide a reference to a stored payment method", + "example": "187282ab-40ef-47a9-9206-5099ba31e432", "nullable": true }, "connector": { @@ -6395,22 +6469,16 @@ ], "nullable": true }, - "capture_method": { - "allOf": [ - { - "$ref": "#/components/schemas/CaptureMethod" - } - ], + "client_secret": { + "type": "string", + "description": "It's a token used for client side verification.", + "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo", "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." - }, - "statement_descriptor_suffix": { + "phone_country_code": { "type": "string", - "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.", - "example": "Payment for shoes purchase", + "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 }, @@ -6422,27 +6490,6 @@ ], "nullable": true }, - "mandate_data": { - "allOf": [ - { - "$ref": "#/components/schemas/MandateData" - } - ], - "nullable": true - }, - "confirm": { - "type": "boolean", - "description": "Whether to confirm the payment (if applicable)", - "default": false, - "example": true, - "nullable": true - }, - "description": { - "type": "string", - "description": "A description of the payment", - "example": "It's my first payment request", - "nullable": true - }, "off_session": { "type": "boolean", "description": "Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with `confirm: true`.", @@ -6457,25 +6504,25 @@ ], "nullable": true }, - "payment_method": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentMethod" - } - ], - "nullable": true - }, - "statement_descriptor_name": { + "email": { "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 customer's email address\nThis field will be deprecated soon, use the customer object instead", + "example": "johntest@test.com", "nullable": true, "maxLength": 255 }, - "merchant_id": { + "payment_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", + "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 + }, + "customer_id": { + "type": "string", + "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 }, @@ -6487,13 +6534,6 @@ ], "nullable": true }, - "name": { - "type": "string", - "description": "description: The customer's name", - "example": "John Test", - "nullable": true, - "maxLength": 255 - }, "setup_future_usage": { "allOf": [ { @@ -6502,6 +6542,57 @@ ], "nullable": true }, + "payment_method_data": { + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodData" + } + ], + "nullable": true + }, + "metadata": { + "allOf": [ + { + "$ref": "#/components/schemas/Metadata" + } + ], + "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 + }, + "allowed_payment_method_types": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentMethodType" + }, + "description": "Allowed Payment Method Types for a given PaymentIntent", + "nullable": true + }, + "description": { + "type": "string", + "description": "A description of the payment", + "example": "It's my first payment request", + "nullable": true + }, + "browser_info": { + "type": "object", + "description": "Additional details required by 3DS 2.0", + "nullable": true + }, + "business_country": { + "allOf": [ + { + "$ref": "#/components/schemas/CountryAlpha2" + } + ], + "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", @@ -6509,22 +6600,33 @@ "nullable": true, "maxLength": 255 }, - "currency": { + "return_url": { + "type": "string", + "description": "The URL to redirect after the completion of the operation", + "example": "https://hyperswitch.io", + "nullable": true + }, + "billing": { "allOf": [ { - "$ref": "#/components/schemas/Currency" + "$ref": "#/components/schemas/Address" } ], "nullable": true }, - "browser_info": { - "type": "object", - "description": "Additional details required by 3DS 2.0", + "authentication_type": { + "allOf": [ + { + "$ref": "#/components/schemas/AuthenticationType" + } + ], "nullable": true }, - "business_sub_label": { - "type": "string", - "description": "Business sub label for the payment", + "confirm": { + "type": "boolean", + "description": "Whether to confirm the payment (if applicable)", + "default": false, + "example": true, "nullable": true } } @@ -6612,37 +6714,45 @@ "example": true, "nullable": true }, + "customer": { + "allOf": [ + { + "$ref": "#/components/schemas/CustomerDetails" + } + ], + "nullable": true + }, "customer_id": { "type": "string", - "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.", + "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 }, "email": { "type": "string", - "description": "description: The customer's email address", + "description": "The customer's email address\nThis field will be deprecated soon, use the customer object instead", "example": "johntest@test.com", "nullable": true, "maxLength": 255 }, "name": { "type": "string", - "description": "description: The customer's name", + "description": "description: The customer's name\nThis field will be deprecated soon, use the customer object instead", "example": "John Test", "nullable": true, "maxLength": 255 }, "phone": { "type": "string", - "description": "The customer's phone number", + "description": "The customer's phone number\nThis field will be deprecated soon, use the customer object instead", "example": "3141592653", "nullable": true, "maxLength": 255 }, "phone_country_code": { "type": "string", - "description": "The country code for the customer phone number", + "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 @@ -6835,6 +6945,11 @@ "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." + }, + "udf": { + "type": "object", + "description": "Any user defined fields can be passed here.", + "nullable": true } } }, @@ -7154,6 +7269,11 @@ } ], "nullable": true + }, + "udf": { + "type": "object", + "description": "Any user defined fields can be passed here.", + "nullable": true } } }, @@ -7691,6 +7811,44 @@ ], "example": "custom" }, + "SamsungPayWalletData": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string", + "description": "The encrypted payment token from Samsung" + } + } + }, + "SdkNextAction": { + "type": "object", + "required": [ + "next_action" + ], + "properties": { + "next_action": { + "$ref": "#/components/schemas/NextActionCall" + } + } + }, + "SecretInfoToInitiateSdk": { + "type": "object", + "required": [ + "display", + "payment" + ], + "properties": { + "display": { + "type": "string" + }, + "payment": { + "type": "string" + } + } + }, "SepaAndBacsBillingDetails": { "type": "object", "required": [ @@ -7821,12 +7979,37 @@ } } ] + }, + { + "type": "object", + "required": [ + "wallet_name" + ], + "properties": { + "wallet_name": { + "type": "string", + "enum": [ + "no_session_token_received" + ] + } + } } ], "discriminator": { "propertyName": "wallet_name" } }, + "ThirdPartySdkSessionResponse": { + "type": "object", + "required": [ + "secrets" + ], + "properties": { + "secrets": { + "$ref": "#/components/schemas/SecretInfoToInitiateSdk" + } + } + }, "UpdateApiKeyRequest": { "type": "object", "description": "The request body for updating an API Key.", @@ -7860,10 +8043,10 @@ { "type": "object", "required": [ - "ali_pay" + "ali_pay_redirect" ], "properties": { - "ali_pay": { + "ali_pay_redirect": { "$ref": "#/components/schemas/AliPayRedirection" } } @@ -7890,6 +8073,17 @@ } } }, + { + "type": "object", + "required": [ + "apple_pay_third_party_sdk" + ], + "properties": { + "apple_pay_third_party_sdk": { + "$ref": "#/components/schemas/ApplePayThirdPartySdkData" + } + } + }, { "type": "object", "required": [ @@ -7907,7 +8101,7 @@ "google_pay_redirect" ], "properties": { - "apple_pay_redirect": { + "google_pay_redirect": { "$ref": "#/components/schemas/GooglePayRedirectData" } } @@ -7915,10 +8109,10 @@ { "type": "object", "required": [ - "mb_way" + "mb_way_redirect" ], "properties": { - "mb_way": { + "mb_way_redirect": { "$ref": "#/components/schemas/MbWayRedirection" } } @@ -7926,10 +8120,10 @@ { "type": "object", "required": [ - "mobile_pay" + "mobile_pay_redirect" ], "properties": { - "mobile_pay": { + "mobile_pay_redirect": { "$ref": "#/components/schemas/MobilePayRedirection" } } @@ -7956,6 +8150,17 @@ } } }, + { + "type": "object", + "required": [ + "samsung_pay" + ], + "properties": { + "samsung_pay": { + "$ref": "#/components/schemas/SamsungPayWalletData" + } + } + }, { "type": "object", "required": [