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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
docs(openapi): add API reference for list payment methods client SDK endpoint (#13583)
Shankar Singh C75d7b9bba1f9
diff --git a/api-reference/docs.json b/api-reference/docs.jsonindex 55b843491b..df914a65ab 100644--- a/api-reference/docs.json+++ b/api-reference/docs.json@@ -67,7 +67,8 @@"v2/payment-methods/payment-method--delete-v1","v2/payment-methods/payment-method--list-customer-saved-payment-methods-v1","v2/payment-methods/payment-method--payment-method-token-to-payment-method-id-v1",- "v2/payment-methods/payment-method--set-default-payment-method-for-customer-v1"+ "v2/payment-methods/payment-method--set-default-payment-method-for-customer-v1",+ "v1/payment-methods/list-payment-methods-for-a-payment-via-client-sdk"]},{diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 9a0aad94a5..71640e36e5 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -4007,6 +4007,141 @@]}},+ "/payments/{payment_id}/client": {+ "get": {+ "tags": [+ "Payment Methods"+ ],+ "summary": "List payment methods for a Payment",+ "description": "Client SDK endpoint. Returns a unified response combining merchant-enabled\npayment methods and customer saved payment methods, filtered via Euclid\nconstraint graph and session flow routing.\n\nSupported client auth:\n- SDK auth via `Authorization`.\n- Publishable-key auth via `api-key: pk_...` and `client_secret` query param.\n\nMerchant secret-key auth is intentionally not supported for this endpoint.",+ "operationId": "List Payment Methods for a Payment via Client SDK",+ "parameters": [+ {+ "name": "payment_id",+ "in": "path",+ "description": "The identifier for the payment",+ "required": true,+ "schema": {+ "type": "string"+ }+ },+ {+ "name": "client_secret",+ "in": "query",+ "description": "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK",+ "required": false,+ "schema": {+ "type": "string",+ "nullable": true+ }+ },+ {+ "name": "accepted_countries",+ "in": "query",+ "description": "The two-letter ISO currency code",+ "required": false,+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CountryAlpha2"+ },+ "nullable": true+ }+ },+ {+ "name": "accepted_currencies",+ "in": "query",+ "description": "The three-letter ISO currency code",+ "required": false,+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Currency"+ },+ "nullable": true+ }+ },+ {+ "name": "amount",+ "in": "query",+ "description": "The amount accepted for processing by the particular payment method.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int64",+ "nullable": true+ }+ },+ {+ "name": "recurring_enabled",+ "in": "query",+ "description": "Indicates whether the payment method is eligible for recurring payments",+ "required": false,+ "schema": {+ "type": "boolean",+ "nullable": true+ }+ },+ {+ "name": "installment_payment_enabled",+ "in": "query",+ "description": "Indicates whether the payment method is eligible for installment payments",+ "required": false,+ "schema": {+ "type": "boolean",+ "nullable": true+ }+ },+ {+ "name": "limit",+ "in": "query",+ "description": "Indicates the limit of last used payment methods",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int64",+ "nullable": true+ }+ },+ {+ "name": "card_networks",+ "in": "query",+ "description": "Indicates whether the payment method is eligible for card netwotks",+ "required": false,+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CardNetwork"+ },+ "nullable": true+ }+ }+ ],+ "responses": {+ "200": {+ "description": "Payment Methods retrieved",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ClientPaymentMethodsListResponse"+ }+ }+ }+ },+ "400": {+ "description": "Invalid Data"+ },+ "404": {+ "description": "Payment Methods does not exist in records"+ }+ },+ "security": [+ {+ "publishable_key": []+ }+ ]+ }+ },"/{customer_id}/payment_methods/{payment_method_id}/default": {"post": {"tags": [@@ -12667,6 +12802,53 @@}]},+ "BankDebitDataForClient": {+ "oneOf": [+ {+ "type": "object",+ "required": [+ "ach_bank_debit"+ ],+ "properties": {+ "ach_bank_debit": {+ "type": "object",+ "required": [+ "account_number_last4_digits",+ "routing_number_last4_digits",+ "bank_name",+ "bank_type",+ "bank_holder_type"+ ],+ "properties": {+ "account_number_last4_digits": {+ "type": "string"+ },+ "routing_number_last4_digits": {+ "type": "string"+ },+ "bank_account_holder_name": {+ "type": "string",+ "nullable": true+ },+ "bank_name": {+ "type": "string",+ "example": "ach"+ },+ "bank_type": {+ "type": "string",+ "example": "checking"+ },+ "bank_holder_type": {+ "type": "string",+ "example": "personal"+ }+ }+ }+ }+ }+ ],+ "description": "Bank debit payment method data returned in the client-facing PM list.\nField names use `_last4_digits` to match the modular service response."+ },"BankDebitDetail": {"oneOf": [{@@ -16772,6 +16954,38 @@}}},+ "ClientPaymentMethodsListResponse": {+ "type": "object",+ "description": "Response for the GET /payments/{payment_id}/payment-methods/client endpoint",+ "required": [+ "payment_methods_enabled",+ "customer_payment_methods",+ "sdk_next_action",+ "intent_data"+ ],+ "properties": {+ "payment_methods_enabled": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ResponsePaymentMethodsEnabledForClient"+ },+ "description": "Flat list of enabled payment methods — one entry per (payment_method_type × payment_method_subtype)"+ },+ "customer_payment_methods": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CustomerPaymentMethodForClient"+ },+ "description": "The customer's saved payment methods"+ },+ "sdk_next_action": {+ "$ref": "#/components/schemas/SdkNextAction"+ },+ "intent_data": {+ "$ref": "#/components/schemas/PaymentMethodListIntentData"+ }+ }+ },"ClientSecret": {"type": "string","description": "For Client based calls, SDK will use the client_secret\\nin order to call /payment_methods\\nClient secret will be generated whenever a new\\npayment method is created"@@ -19409,6 +19623,109 @@}}},+ "CustomerPaymentMethodDataForClient": {+ "oneOf": [+ {+ "type": "object",+ "required": [+ "card"+ ],+ "properties": {+ "card": {+ "$ref": "#/components/schemas/CardDetailFromLocker"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "wallet"+ ],+ "properties": {+ "wallet": {+ "$ref": "#/components/schemas/WalletPaymentMethodDataForClient"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "bank_debit"+ ],+ "properties": {+ "bank_debit": {+ "$ref": "#/components/schemas/BankDebitDataForClient"+ }+ }+ }+ ]+ },+ "CustomerPaymentMethodForClient": {+ "type": "object",+ "description": "A saved customer payment method as returned in the client-facing PM list.\n\nThis is a slimmed-down version of `CustomerPaymentMethod` intended for the\n`GET /payments/{payment_id}/payment-methods/client` endpoint. Fields that are\nOnly the fields needed by the SDK are included; server-side fields\n(e.g. `surcharge_details`, `metadata`) are omitted.",+ "required": [+ "payment_token",+ "payment_method",+ "default_payment_method_set",+ "requires_cvv"+ ],+ "properties": {+ "payment_token": {+ "type": "string",+ "description": "Token for payment method in temporary card locker which gets refreshed often.\nThe SDK passes this back when submitting the payment.",+ "example": "7ebf443f-a050-4067-84e5-e6f6d4800aef"+ },+ "payment_method": {+ "$ref": "#/components/schemas/PaymentMethod"+ },+ "payment_method_type": {+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentMethodType"+ }+ ],+ "nullable": true+ },+ "default_payment_method_set": {+ "type": "boolean",+ "description": "Whether this is the customer's default payment method",+ "example": true+ },+ "requires_cvv": {+ "type": "boolean",+ "description": "Whether CVV collection is required before using this method",+ "example": true+ },+ "created": {+ "type": "string",+ "format": "date-time",+ "description": "When the payment method was saved",+ "example": "2023-01-18T11:04:09.922Z",+ "nullable": true+ },+ "last_used_at": {+ "type": "string",+ "format": "date-time",+ "description": "When this payment method was last used for a payment",+ "example": "2024-02-24T11:04:09.922Z",+ "nullable": true+ },+ "recurring_enabled": {+ "type": "boolean",+ "description": "Whether this payment method supports recurring / off-session payments",+ "example": true,+ "nullable": true+ },+ "payment_method_data": {+ "allOf": [+ {+ "$ref": "#/components/schemas/CustomerPaymentMethodDataForClient"+ }+ ],+ "nullable": true+ }+ }+ },"CustomerPaymentMethodUpdateResponse": {"type": "object","required": [@@ -30945,6 +31262,41 @@"redacted"]},+ "PaymentMethodSubtypeSpecificDataForClient": {+ "oneOf": [+ {+ "type": "object",+ "description": "Card payment method — contains card network info",+ "required": [+ "card_networks"+ ],+ "properties": {+ "card_networks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CardNetwork"+ }+ }+ }+ },+ {+ "type": "object",+ "description": "Bank payment method (bank_redirect) — contains supported bank names",+ "required": [+ "bank_names"+ ],+ "properties": {+ "bank_names": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BankNames"+ }+ }+ }+ }+ ],+ "description": "Payment experience entry in the client PM list.\nSubtype-specific data for each payment method entry in the client list"+ },"PaymentMethodTokenizationDetails": {"type": "object","required": [@@ -41063,6 +41415,52 @@}}},+ "ResponsePaymentMethodsEnabledForClient": {+ "allOf": [+ {+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentMethodSubtypeSpecificDataForClient"+ }+ ],+ "nullable": true+ },+ {+ "type": "object",+ "required": [+ "payment_method",+ "payment_method_type"+ ],+ "properties": {+ "payment_method": {+ "$ref": "#/components/schemas/PaymentMethod"+ },+ "payment_method_type": {+ "$ref": "#/components/schemas/PaymentMethodType"+ },+ "payment_experience": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/PaymentExperience"+ },+ "description": "Payment experience options for this method (wallets, pay_later, etc.)",+ "nullable": true+ },+ "collect_shipping_details_from_wallets": {+ "type": "boolean",+ "description": "Whether to collect shipping details from the wallet connector (null for non-wallet)",+ "nullable": true+ },+ "collect_billing_details_from_wallets": {+ "type": "boolean",+ "description": "Whether to collect billing details from the wallet connector (null for non-wallet)",+ "nullable": true+ }+ }+ }+ ],+ "description": "A single flat entry in the client payment method list — one per (payment_method_type × payment_method_subtype)"+ },"ResumeOption": {"type": "string","enum": [@@ -46035,6 +46433,44 @@}]},+ "WalletPaymentMethodDataForClient": {+ "oneOf": [+ {+ "type": "object",+ "required": [+ "apple_pay"+ ],+ "properties": {+ "apple_pay": {+ "$ref": "#/components/schemas/PaymentMethodDataWalletInfo"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "google_pay"+ ],+ "properties": {+ "google_pay": {+ "$ref": "#/components/schemas/PaymentMethodDataWalletInfo"+ }+ }+ },+ {+ "type": "object",+ "required": [+ "pay_pal"+ ],+ "properties": {+ "pay_pal": {+ "$ref": "#/components/schemas/PaypalRedirection"+ }+ }+ }+ ],+ "description": "Typed subtype-specific data for a saved customer payment method, returned in the\n`GET /payments/{payment_id}/payment-methods/client` response.\n\nSerializes as an externally-tagged enum, producing e.g.:\n`{ \"card\": { \"last4_digits\": \"4242\", ... } }`\n\nOnly variants for subtypes that actually carry extra data are included;\nfor all other subtypes the `payment_method_data` field on\n`CustomerPaymentMethodForClient` is `None`.\nWallet payment method data returned in the client-facing PM list."+ },"WalletResponse": {"allOf": [{diff --git a/api-reference/v1/payment-methods/list-payment-methods-for-a-payment-via-client-sdk.mdx b/api-reference/v1/payment-methods/list-payment-methods-for-a-payment-via-client-sdk.mdxnew file mode 100644index 0000000000..4d5cb3e855--- /dev/null+++ b/api-reference/v1/payment-methods/list-payment-methods-for-a-payment-via-client-sdk.mdx@@ -0,0 +1,3 @@+---+openapi: get /payments/{payment_id}/client+---diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rsindex 2b6ffda666..91b92476fe 100644--- a/crates/api_models/src/payment_methods.rs+++ b/crates/api_models/src/payment_methods.rs@@ -2983,6 +2983,7 @@ pub struct ResponsePaymentMethodsEnabledForClient {pub data: Option<PaymentMethodSubtypeSpecificDataForClient>,/// Payment experience options for this method (wallets, pay_later, etc.)+ #[schema(value_type = Option<Vec<PaymentExperience>>)]pub payment_experience: Option<Vec<api_enums::PaymentExperience>>,/// Whether to collect shipping details from the wallet connector (null for non-wallet)@@ -3008,6 +3009,7 @@ pub struct ResponsePaymentMethodsEnabledForClient {pub enum WalletPaymentMethodDataForClient {ApplePay(Box<PaymentMethodDataWalletInfo>),GooglePay(Box<PaymentMethodDataWalletInfo>),+ #[schema(value_type = PaypalRedirection)]PayPal(Box<payments::PaypalRedirection>),}diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex 0b93a8ef23..202c2f7b85 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -149,6 +149,7 @@ Never share your secret api keys. Keep them guarded and secure.routes::payment_method::list_payment_method_api,routes::payment_method::list_customer_payment_method_api,routes::payment_method::list_customer_payment_method_api_client,+ routes::payment_method::list_payment_methods_for_payments_client,routes::payment_method::default_payment_method_set_api,routes::payment_method::payment_method_retrieve_api,routes::payment_method::payment_method_update_api,@@ -424,6 +425,13 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payment_methods::BankDebitTypes,api_models::payment_methods::BankTransferTypes,api_models::payment_methods::CustomerPaymentMethodsListResponse,+ api_models::payment_methods::ClientPaymentMethodsListResponse,+ api_models::payment_methods::ResponsePaymentMethodsEnabledForClient,+ api_models::payment_methods::PaymentMethodSubtypeSpecificDataForClient,+ api_models::payment_methods::CustomerPaymentMethodForClient,+ api_models::payment_methods::CustomerPaymentMethodDataForClient,+ api_models::payment_methods::WalletPaymentMethodDataForClient,+ api_models::payment_methods::BankDebitDataForClient,api_models::payment_methods::PaymentMethodDeleteResponse,api_models::payment_methods::PaymentMethodUpdate,api_models::payment_methods::CustomerDefaultPaymentMethodResponse,diff --git a/crates/openapi/src/routes/payment_method.rs b/crates/openapi/src/routes/payment_method.rsindex fa01fee0ef..2ace61bc0b 100644--- a/crates/openapi/src/routes/payment_method.rs+++ b/crates/openapi/src/routes/payment_method.rs@@ -118,6 +118,43 @@ pub async fn list_customer_payment_method_api() {})]pub async fn list_customer_payment_method_api_client() {}+/// List payment methods for a Payment+///+/// Client SDK endpoint. Returns a unified response combining merchant-enabled+/// payment methods and customer saved payment methods, filtered via Euclid+/// constraint graph and session flow routing.+///+/// Supported client auth:+/// - SDK auth via `Authorization`.+/// - Publishable-key auth via `api-key: pk_...` and `client_secret` query param.+///+/// Merchant secret-key auth is intentionally not supported for this endpoint.+#[utoipa::path(+ get,+ path = "/payments/{payment_id}/client",+ params (+ ("payment_id" = String, Path, description = "The identifier for the payment"),+ ("client_secret" = Option<String>, Query, description = "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"),+ ("accepted_countries" = Option<Vec<CountryAlpha2>>, Query, description = "The two-letter ISO currency code"),+ ("accepted_currencies" = Option<Vec<Currency>>, Query, description = "The three-letter ISO currency code"),+ ("amount" = Option<i64>, Query, description = "The amount accepted for processing by the particular payment method."),+ ("recurring_enabled" = Option<bool>, Query, description = "Indicates whether the payment method is eligible for recurring payments"),+ ("installment_payment_enabled" = Option<bool>, Query, description = "Indicates whether the payment method is eligible for installment payments"),+ ("limit" = Option<i64>, Query, description = "Indicates the limit of last used payment methods"),+ ("card_networks" = Option<Vec<CardNetwork>>, Query, description = "Indicates whether the payment method is eligible for card netwotks"),+ ),+ responses(+ (status = 200, description = "Payment Methods retrieved", body = ClientPaymentMethodsListResponse),+ (status = 400, description = "Invalid Data"),+ (status = 404, description = "Payment Methods does not exist in records")+ ),+ tag = "Payment Methods",+ operation_id = "List Payment Methods for a Payment via Client SDK",+ security(("publishable_key" = []))+)]+#[cfg(feature = "v1")]+pub async fn list_payment_methods_for_payments_client() {}+/// Payment Method - Retrieve////// Retrieves a payment method of a customer.