From 59e0aa9e9cdf4414f78eb5301c47665816c8e9f9 Mon Sep 17 00:00:00 2001 From: rodrigojara-cko Date: Thu, 15 Oct 2026 10:03:47 +0200 Subject: [PATCH 1/4] docs(setups): use payment method status values from the spec The Blik status doc and the payment-method serialization specs used "available", which is not a PaymentMethodStatus value. Use "ready" and point the doc at PaymentSetupPaymentMethodStatus. --- .../payments/setups/blik_payment_method.rb | 3 ++- .../setup_payment_methods_serialization_spec.rb | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/checkout_sdk/payments/setups/blik_payment_method.rb b/lib/checkout_sdk/payments/setups/blik_payment_method.rb index 6ee1d26..f092e80 100644 --- a/lib/checkout_sdk/payments/setups/blik_payment_method.rb +++ b/lib/checkout_sdk/payments/setups/blik_payment_method.rb @@ -5,7 +5,8 @@ module Payments # Blik payment method configuration on a Payment Setup. # # @!attribute status - # @return [String] (response-only) Payment method status (e.g. "available"). + # @return [String] (response-only) Payment method status, one of + # {PaymentSetupPaymentMethodStatus} (e.g. "ready"). # @!attribute flags # @return [Array(String)] (response-only) Diagnostic flags returned by the API. # @!attribute partner_code diff --git a/spec/checkout_sdk/payments/setups/setup_payment_methods_serialization_spec.rb b/spec/checkout_sdk/payments/setups/setup_payment_methods_serialization_spec.rb index 72126cd..5ff73da 100644 --- a/spec/checkout_sdk/payments/setups/setup_payment_methods_serialization_spec.rb +++ b/spec/checkout_sdk/payments/setups/setup_payment_methods_serialization_spec.rb @@ -4,7 +4,7 @@ describe CheckoutSdk::Payments::BacsPaymentMethod do it 'serializes its fields to their swagger keys' do pm = described_class.new - pm.status = 'available' + pm.status = 'ready' pm.flags = %w[flag_a] pm.instrument_id = 'src_wkq7552u245upl5h75x24554xy' pm.initialization = 'setup' @@ -17,7 +17,7 @@ hash = CheckoutSdk::JsonSerializer.to_custom_hash(pm) - expect(hash['status']).to eq('available') + expect(hash['status']).to eq('ready') expect(hash['flags']).to eq(%w[flag_a]) expect(hash['instrument_id']).to eq('src_wkq7552u245upl5h75x24554xy') expect(hash['initialization']).to eq('setup') @@ -33,7 +33,7 @@ describe CheckoutSdk::Payments::CardPresentPaymentMethod do it 'serializes its fields to their swagger keys' do pm = described_class.new - pm.status = 'available' + pm.status = 'ready' pm.flags = %w[flag_a] pm.track2 = 'track2-data' pm.emv = 'emv-data' @@ -44,7 +44,7 @@ hash = CheckoutSdk::JsonSerializer.to_custom_hash(pm) - expect(hash['status']).to eq('available') + expect(hash['status']).to eq('ready') expect(hash['flags']).to eq(%w[flag_a]) expect(hash['track2']).to eq('track2-data') expect(hash['emv']).to eq('emv-data') @@ -59,14 +59,14 @@ it 'serializes bank_id, status, flags and action' do pm = described_class.new pm.bank_id = 'ob-natwest' - pm.status = 'available' + pm.status = 'ready' pm.flags = %w[flag_a] pm.action = { 'type' => 'select_bank', 'banks' => [{ 'bank_id' => 'ob-natwest' }] } hash = CheckoutSdk::JsonSerializer.to_custom_hash(pm) expect(hash['bank_id']).to eq('ob-natwest') - expect(hash['status']).to eq('available') + expect(hash['status']).to eq('ready') expect(hash['flags']).to eq(%w[flag_a]) expect(hash['action']).to eq({ 'type' => 'select_bank', 'banks' => [{ 'bank_id' => 'ob-natwest' }] }) end @@ -143,12 +143,12 @@ describe CheckoutSdk::Payments::StablecoinPaymentMethod do it 'serializes its response fields' do pm = described_class.new - pm.status = 'available' + pm.status = 'ready' pm.flags = %w[flag_a] hash = CheckoutSdk::JsonSerializer.to_custom_hash(pm) - expect(hash['status']).to eq('available') + expect(hash['status']).to eq('ready') expect(hash['flags']).to eq(%w[flag_a]) end end From a47d93110911a2679b20fef07f1df6a1adb4f1bf Mon Sep 17 00:00:00 2001 From: rodrigojara-cko Date: Mon, 19 Oct 2026 09:57:52 +0200 Subject: [PATCH 2/4] docs(setups): document the payment method status values and cover blik Document the status values on Bacs, CardPresent and Stablecoin as on Blik, map Blik to its swagger schema, add a Blik serialization spec, and use a valid initialization value (enabled) in the Bacs spec. --- .../payments/setups/bacs_payment_method.rb | 3 ++- .../payments/setups/blik_payment_method.rb | 2 +- .../setups/card_present_payment_method.rb | 3 ++- .../setups/stablecoin_payment_method.rb | 3 ++- .../setup_payment_methods_serialization_spec.rb | 17 +++++++++++++++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/checkout_sdk/payments/setups/bacs_payment_method.rb b/lib/checkout_sdk/payments/setups/bacs_payment_method.rb index 83fe5c7..bc1f5df 100644 --- a/lib/checkout_sdk/payments/setups/bacs_payment_method.rb +++ b/lib/checkout_sdk/payments/setups/bacs_payment_method.rb @@ -5,7 +5,8 @@ module Payments # Bacs payment method configuration on a Payment Setup. Maps swagger `Bacs`. # # @!attribute status - # @return [String] (response-only) Payment method status. + # @return [String] (response-only) Payment method status, one of + # {PaymentSetupPaymentMethodStatus} (e.g. "ready"). # @!attribute flags # @return [Array(String)] (response-only) Diagnostic flags returned by the API. # @!attribute initialization diff --git a/lib/checkout_sdk/payments/setups/blik_payment_method.rb b/lib/checkout_sdk/payments/setups/blik_payment_method.rb index f092e80..0c471a1 100644 --- a/lib/checkout_sdk/payments/setups/blik_payment_method.rb +++ b/lib/checkout_sdk/payments/setups/blik_payment_method.rb @@ -2,7 +2,7 @@ module CheckoutSdk module Payments - # Blik payment method configuration on a Payment Setup. + # Blik payment method configuration on a Payment Setup. Maps swagger `Blik`. # # @!attribute status # @return [String] (response-only) Payment method status, one of diff --git a/lib/checkout_sdk/payments/setups/card_present_payment_method.rb b/lib/checkout_sdk/payments/setups/card_present_payment_method.rb index 2679164..a566d01 100644 --- a/lib/checkout_sdk/payments/setups/card_present_payment_method.rb +++ b/lib/checkout_sdk/payments/setups/card_present_payment_method.rb @@ -5,7 +5,8 @@ module Payments # Card Present payment method configuration on a Payment Setup. Maps swagger `CardPresent`. # # @!attribute status - # @return [String] (response-only) Payment method status. + # @return [String] (response-only) Payment method status, one of + # {PaymentSetupPaymentMethodStatus} (e.g. "ready"). # @!attribute flags # @return [Array(String)] (response-only) Diagnostic flags returned by the API. # @!attribute track2 diff --git a/lib/checkout_sdk/payments/setups/stablecoin_payment_method.rb b/lib/checkout_sdk/payments/setups/stablecoin_payment_method.rb index cce50c0..5c7570f 100644 --- a/lib/checkout_sdk/payments/setups/stablecoin_payment_method.rb +++ b/lib/checkout_sdk/payments/setups/stablecoin_payment_method.rb @@ -5,7 +5,8 @@ module Payments # Stablecoin payment method configuration on a Payment Setup. Maps swagger `Stablecoin`. # # @!attribute status - # @return [String] (response-only) Payment method status. + # @return [String] (response-only) Payment method status, one of + # {PaymentSetupPaymentMethodStatus} (e.g. "ready"). # @!attribute flags # @return [Array(String)] (response-only) Diagnostic flags returned by the API. class StablecoinPaymentMethod diff --git a/spec/checkout_sdk/payments/setups/setup_payment_methods_serialization_spec.rb b/spec/checkout_sdk/payments/setups/setup_payment_methods_serialization_spec.rb index 5ff73da..31c5b12 100644 --- a/spec/checkout_sdk/payments/setups/setup_payment_methods_serialization_spec.rb +++ b/spec/checkout_sdk/payments/setups/setup_payment_methods_serialization_spec.rb @@ -7,7 +7,7 @@ pm.status = 'ready' pm.flags = %w[flag_a] pm.instrument_id = 'src_wkq7552u245upl5h75x24554xy' - pm.initialization = 'setup' + pm.initialization = 'enabled' pm.account_holder = { 'type' => 'individual', 'first_name' => 'John' } pm.account_number = '12345678' pm.bank_code = '200000' @@ -20,7 +20,7 @@ expect(hash['status']).to eq('ready') expect(hash['flags']).to eq(%w[flag_a]) expect(hash['instrument_id']).to eq('src_wkq7552u245upl5h75x24554xy') - expect(hash['initialization']).to eq('setup') + expect(hash['initialization']).to eq('enabled') expect(hash['account_holder']).to eq({ 'type' => 'individual', 'first_name' => 'John' }) expect(hash['account_number']).to eq('12345678') expect(hash['bank_code']).to eq('200000') @@ -140,6 +140,19 @@ end end + describe CheckoutSdk::Payments::BlikPaymentMethod do + it 'serializes its fields to their swagger keys' do + pm = described_class.new + pm.status = 'ready' + pm.flags = %w[flag_a] + pm.partner_code = '777123' + + hash = CheckoutSdk::JsonSerializer.to_custom_hash(pm) + + expect(hash).to eq({ 'status' => 'ready', 'flags' => %w[flag_a], 'partner_code' => '777123' }) + end + end + describe CheckoutSdk::Payments::StablecoinPaymentMethod do it 'serializes its response fields' do pm = described_class.new From 79fe15932b406a7086220d4e01954a881f3104e3 Mon Sep 17 00:00:00 2001 From: rodrigojara-cko Date: Mon, 19 Oct 2026 12:18:34 +0200 Subject: [PATCH 3/4] docs(setups): document the card, wallet, settings and metadata request keys The Payment Setup client takes a Hash and documented only some of its keys. Document payment_methods card (token and details), applepay and googlepay (token_data and the token object), instrument and auto_confirm, settings capture and excluded_payment_methods, order sub_merchants number_of_sales and metadata, plus the read-only fields returned. --- .../payments/setups/payment_setups_client.rb | 70 +++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/lib/checkout_sdk/payments/setups/payment_setups_client.rb b/lib/checkout_sdk/payments/setups/payment_setups_client.rb index aceb343..39655c0 100644 --- a/lib/checkout_sdk/payments/setups/payment_setups_client.rb +++ b/lib/checkout_sdk/payments/setups/payment_setups_client.rb @@ -39,6 +39,33 @@ def initialize(api_client, configuration) # `paybybank`; the API ignores `pay_by_bank` without an error), a Hash with the keys documented # on {PayByBankPaymentMethod}; you send :bank_id (the identifier of the bank the customer has # selected for the payment). + # :payment_methods may also include: + # - :card - :token (a Hash with :id, the Checkout.com card token), :details (the card data: + # :number, :expiry_month, :expiry_year, :name, :cvv, :stored (Boolean) and :allow_update + # (Boolean)), :store_for_future_use (Boolean), :phone (:country_code and :number), + # :account_holder (:type, one of "individual", "government" or "corporate", :first_name, + # :last_name, :middle_name, :company_name and :account_name_inquiry (Boolean)) and + # :preferred_scheme ("visa", "mastercard" or "cartes_bancaires"). The card data goes under + # :details; the API ignores it at the top level of :card. + # - :applepay - :token_data (:version, :data, :signature and :header, a Hash with + # :ephemeral_public_key, :public_key_hash and :transaction_id), :token (a Hash with :id, + # pattern ^(tok)_(\w{26})$, and :expires_on; a String token is not accepted), + # :store_for_future_use (Boolean), :phone, :account_holder and :preferred_scheme ("visa", + # "mastercard" or "cartes_bancaires"). Apple Pay has no :details. + # - :googlepay - :token_data (:protocol_version, :signature, :signed_message and + # :tokenization_key), :token, :store_for_future_use, :phone and :account_holder as on + # :applepay, and :preferred_scheme ("visa" or "mastercard" only). Google Pay has no :details. + # - :instrument - :id (the unique identifier of the instrument to use). + # - :auto_confirm - The payment method that automatically confirms the payment when it is + # ready, for example "card". + # :settings may include :success_url and :failure_url (max 255 characters), :capture (Boolean, + # whether to capture the payment immediately, default true) and :excluded_payment_methods + # (Array of payment method names, for example ["klarna"]). + # :order may include :sub_merchants, an Array of Hashes with :id, :product_category, + # :number_of_sales (Integer; the API does not define number_of_trades) and :registration_date + # (yyyy-MM-dd). + # :metadata - A Hash of key/value pairs to attach to the payment (max 20 keys); each value is a + # String (max 255 characters), a Number or a Boolean. # :risk {PaymentSetupRisk} - Risk assessment settings for the Payment Setup: :enabled # (Boolean, whether a risk assessment should be performed, default true). # :customer may include: @@ -66,7 +93,9 @@ def initialize(api_client, configuration) # @return [Hash] The Payment Setup (swagger `PaymentSetup`, 200). For Cash App Pay, read # payment_methods.cashapp.action.redirect_url, payment_methods.cashapp.reference and, once only, # payment_methods.cashapp.customer_profile. For Pay by Bank, read - # payment_methods.paybybank.action.banks. + # payment_methods.paybybank.action.banks. Card, Apple Pay and Google Pay return the read-only + # :schemes (supported card scheme names) and card details :last4, :bin, :scheme and + # :expires_on; instrument returns the read-only :type and :action. def create_payment_setup(payment_setups_request) api_client.invoke_post( build_path(PAYMENTS_PATH, SETUPS_PATH), @@ -100,6 +129,33 @@ def create_payment_setup(payment_setups_request) # `paybybank`; the API ignores `pay_by_bank` without an error), a Hash with the keys documented # on {PayByBankPaymentMethod}; you send :bank_id (the identifier of the bank the customer has # selected for the payment). + # :payment_methods may also include: + # - :card - :token (a Hash with :id, the Checkout.com card token), :details (the card data: + # :number, :expiry_month, :expiry_year, :name, :cvv, :stored (Boolean) and :allow_update + # (Boolean)), :store_for_future_use (Boolean), :phone (:country_code and :number), + # :account_holder (:type, one of "individual", "government" or "corporate", :first_name, + # :last_name, :middle_name, :company_name and :account_name_inquiry (Boolean)) and + # :preferred_scheme ("visa", "mastercard" or "cartes_bancaires"). The card data goes under + # :details; the API ignores it at the top level of :card. + # - :applepay - :token_data (:version, :data, :signature and :header, a Hash with + # :ephemeral_public_key, :public_key_hash and :transaction_id), :token (a Hash with :id, + # pattern ^(tok)_(\w{26})$, and :expires_on; a String token is not accepted), + # :store_for_future_use (Boolean), :phone, :account_holder and :preferred_scheme ("visa", + # "mastercard" or "cartes_bancaires"). Apple Pay has no :details. + # - :googlepay - :token_data (:protocol_version, :signature, :signed_message and + # :tokenization_key), :token, :store_for_future_use, :phone and :account_holder as on + # :applepay, and :preferred_scheme ("visa" or "mastercard" only). Google Pay has no :details. + # - :instrument - :id (the unique identifier of the instrument to use). + # - :auto_confirm - The payment method that automatically confirms the payment when it is + # ready, for example "card". + # :settings may include :success_url and :failure_url (max 255 characters), :capture (Boolean, + # whether to capture the payment immediately, default true) and :excluded_payment_methods + # (Array of payment method names, for example ["klarna"]). + # :order may include :sub_merchants, an Array of Hashes with :id, :product_category, + # :number_of_sales (Integer; the API does not define number_of_trades) and :registration_date + # (yyyy-MM-dd). + # :metadata - A Hash of key/value pairs to attach to the payment (max 20 keys); each value is a + # String (max 255 characters), a Number or a Boolean. # :risk {PaymentSetupRisk} - Risk assessment settings for the Payment Setup: :enabled # (Boolean, whether a risk assessment should be performed, default true). # :customer may include: @@ -127,7 +183,9 @@ def create_payment_setup(payment_setups_request) # @return [Hash] The Payment Setup (swagger `PaymentSetup`, 200). For Cash App Pay, read # payment_methods.cashapp.action.redirect_url, payment_methods.cashapp.reference and, once only, # payment_methods.cashapp.customer_profile. For Pay by Bank, read - # payment_methods.paybybank.action.banks. + # payment_methods.paybybank.action.banks. Card, Apple Pay and Google Pay return the read-only + # :schemes (supported card scheme names) and card details :last4, :bin, :scheme and + # :expires_on; instrument returns the read-only :type and :action. def update_payment_setup(id, payment_setups_request) api_client.invoke_put( build_path(PAYMENTS_PATH, SETUPS_PATH, id), @@ -143,7 +201,9 @@ def update_payment_setup(id, payment_setups_request) # @return [Hash] The Payment Setup (swagger `PaymentSetup`, 200). For Cash App Pay, read # payment_methods.cashapp.action.redirect_url, payment_methods.cashapp.reference and, once only, # payment_methods.cashapp.customer_profile. For Pay by Bank, read - # payment_methods.paybybank.action.banks. + # payment_methods.paybybank.action.banks. Card, Apple Pay and Google Pay return the read-only + # :schemes (supported card scheme names) and card details :last4, :bin, :scheme and + # :expires_on; instrument returns the read-only :type and :action. def get_payment_setup(id) api_client.invoke_get( build_path(PAYMENTS_PATH, SETUPS_PATH, id), @@ -161,7 +221,9 @@ def get_payment_setup(id) # @return [Hash] The Payment Setup (swagger `PaymentSetup`, 200). For Cash App Pay, read # payment_methods.cashapp.action.redirect_url, payment_methods.cashapp.reference and, once only, # payment_methods.cashapp.customer_profile. For Pay by Bank, read - # payment_methods.paybybank.action.banks. + # payment_methods.paybybank.action.banks. Card, Apple Pay and Google Pay return the read-only + # :schemes (supported card scheme names) and card details :last4, :bin, :scheme and + # :expires_on; instrument returns the read-only :type and :action. def confirm_payment_setup(id, payment_method_name) api_client.invoke_post( build_path(PAYMENTS_PATH, SETUPS_PATH, id, CONFIRM_PATH, payment_method_name), From 48ed6ec601919218792828f12554f96e3dcbaef2 Mon Sep 17 00:00:00 2001 From: rodrigojara-cko Date: Tue, 20 Oct 2026 10:35:16 +0200 Subject: [PATCH 4/4] docs(setups): complete the types and constraints of the payment setup request keys Mark the wallet token id as required, add the phone length limits, the uri format of the redirect URLs, the type of every key, the write-only card and wallet fields, and the read-only response values (Google Pay schemes, set_instrument). --- .../payments/setups/payment_setups_client.rb | 130 ++++++++++-------- 1 file changed, 72 insertions(+), 58 deletions(-) diff --git a/lib/checkout_sdk/payments/setups/payment_setups_client.rb b/lib/checkout_sdk/payments/setups/payment_setups_client.rb index 39655c0..d451fa4 100644 --- a/lib/checkout_sdk/payments/setups/payment_setups_client.rb +++ b/lib/checkout_sdk/payments/setups/payment_setups_client.rb @@ -39,31 +39,36 @@ def initialize(api_client, configuration) # `paybybank`; the API ignores `pay_by_bank` without an error), a Hash with the keys documented # on {PayByBankPaymentMethod}; you send :bank_id (the identifier of the bank the customer has # selected for the payment). - # :payment_methods may also include: - # - :card - :token (a Hash with :id, the Checkout.com card token), :details (the card data: - # :number, :expiry_month, :expiry_year, :name, :cvv, :stored (Boolean) and :allow_update - # (Boolean)), :store_for_future_use (Boolean), :phone (:country_code and :number), - # :account_holder (:type, one of "individual", "government" or "corporate", :first_name, - # :last_name, :middle_name, :company_name and :account_name_inquiry (Boolean)) and - # :preferred_scheme ("visa", "mastercard" or "cartes_bancaires"). The card data goes under - # :details; the API ignores it at the top level of :card. - # - :applepay - :token_data (:version, :data, :signature and :header, a Hash with - # :ephemeral_public_key, :public_key_hash and :transaction_id), :token (a Hash with :id, - # pattern ^(tok)_(\w{26})$, and :expires_on; a String token is not accepted), - # :store_for_future_use (Boolean), :phone, :account_holder and :preferred_scheme ("visa", - # "mastercard" or "cartes_bancaires"). Apple Pay has no :details. - # - :googlepay - :token_data (:protocol_version, :signature, :signed_message and - # :tokenization_key), :token, :store_for_future_use, :phone and :account_holder as on - # :applepay, and :preferred_scheme ("visa" or "mastercard" only). Google Pay has no :details. - # - :instrument - :id (the unique identifier of the instrument to use). - # - :auto_confirm - The payment method that automatically confirms the payment when it is - # ready, for example "card". - # :settings may include :success_url and :failure_url (max 255 characters), :capture (Boolean, - # whether to capture the payment immediately, default true) and :excluded_payment_methods - # (Array of payment method names, for example ["klarna"]). - # :order may include :sub_merchants, an Array of Hashes with :id, :product_category, - # :number_of_sales (Integer; the API does not define number_of_trades) and :registration_date - # (yyyy-MM-dd). + # :payment_methods may also include (every key is optional unless marked required): + # - :card - :token (a Hash with :id, String, the Checkout.com card token), :details (the card + # data: :number (String, write-only), :expiry_month (Integer), :expiry_year (Integer), :name + # (String, write-only), :cvv (String, write-only), :stored (Boolean, write-only) and + # :allow_update (Boolean)), :store_for_future_use (Boolean, write-only), :phone + # (:country_code, String, min 1 character, max 7 characters, and :number, String, min 6 + # characters, max 25 characters), :account_holder (:type, one of "individual", "government" + # or "corporate", :first_name, :last_name, :middle_name, :company_name (Strings) and + # :account_name_inquiry (Boolean)) and :preferred_scheme ("visa", "mastercard" or + # "cartes_bancaires"). The card data goes under :details; the API ignores it at the top level + # of :card. + # - :applepay - :token_data (write-only: :version, :data and :signature (Strings) and :header, + # a Hash with :ephemeral_public_key, :public_key_hash and :transaction_id (Strings)), :token (a + # Hash with :id, String, required, pattern ^(tok)_(\w{26})$, and :expires_on, date-time, + # ISO 8601; a String token is not accepted), :store_for_future_use (Boolean, write-only), + # :phone and :account_holder as on :card, and :preferred_scheme ("visa", "mastercard" or + # "cartes_bancaires"). Apple Pay has no :details. + # - :googlepay - :token_data (write-only: :protocol_version, :signature, :signed_message and + # :tokenization_key (Strings)), :token, :store_for_future_use, :phone and :account_holder as + # on :applepay, and :preferred_scheme ("visa" or "mastercard" only). Google Pay has no + # :details. + # - :instrument - :id (String, the unique identifier of the instrument to use). + # - :auto_confirm - String, the payment method that automatically confirms the payment when it + # is ready, for example "card". + # :settings may include :success_url and :failure_url (String, format uri, max 255 + # characters), :capture (Boolean, whether to capture the payment immediately, default true) and + # :excluded_payment_methods (Array of Strings, payment method names, for example ["klarna"]). + # :order may include :sub_merchants, an Array of Hashes with :id (String), :product_category + # (String), :number_of_sales (Integer; the API does not define number_of_trades) and + # :registration_date (String, format date, yyyy-MM-dd). # :metadata - A Hash of key/value pairs to attach to the payment (max 20 keys); each value is a # String (max 255 characters), a Number or a Boolean. # :risk {PaymentSetupRisk} - Risk assessment settings for the Payment Setup: :enabled @@ -94,8 +99,9 @@ def initialize(api_client, configuration) # payment_methods.cashapp.action.redirect_url, payment_methods.cashapp.reference and, once only, # payment_methods.cashapp.customer_profile. For Pay by Bank, read # payment_methods.paybybank.action.banks. Card, Apple Pay and Google Pay return the read-only - # :schemes (supported card scheme names) and card details :last4, :bin, :scheme and - # :expires_on; instrument returns the read-only :type and :action. + # :schemes (supported card scheme names; Google Pay never lists cartes_bancaires) and card + # details :last4, :bin, :scheme (Strings) and :expires_on (date-time); instrument returns the + # read-only :type (String) and :action (:type, "set_instrument"). def create_payment_setup(payment_setups_request) api_client.invoke_post( build_path(PAYMENTS_PATH, SETUPS_PATH), @@ -129,31 +135,36 @@ def create_payment_setup(payment_setups_request) # `paybybank`; the API ignores `pay_by_bank` without an error), a Hash with the keys documented # on {PayByBankPaymentMethod}; you send :bank_id (the identifier of the bank the customer has # selected for the payment). - # :payment_methods may also include: - # - :card - :token (a Hash with :id, the Checkout.com card token), :details (the card data: - # :number, :expiry_month, :expiry_year, :name, :cvv, :stored (Boolean) and :allow_update - # (Boolean)), :store_for_future_use (Boolean), :phone (:country_code and :number), - # :account_holder (:type, one of "individual", "government" or "corporate", :first_name, - # :last_name, :middle_name, :company_name and :account_name_inquiry (Boolean)) and - # :preferred_scheme ("visa", "mastercard" or "cartes_bancaires"). The card data goes under - # :details; the API ignores it at the top level of :card. - # - :applepay - :token_data (:version, :data, :signature and :header, a Hash with - # :ephemeral_public_key, :public_key_hash and :transaction_id), :token (a Hash with :id, - # pattern ^(tok)_(\w{26})$, and :expires_on; a String token is not accepted), - # :store_for_future_use (Boolean), :phone, :account_holder and :preferred_scheme ("visa", - # "mastercard" or "cartes_bancaires"). Apple Pay has no :details. - # - :googlepay - :token_data (:protocol_version, :signature, :signed_message and - # :tokenization_key), :token, :store_for_future_use, :phone and :account_holder as on - # :applepay, and :preferred_scheme ("visa" or "mastercard" only). Google Pay has no :details. - # - :instrument - :id (the unique identifier of the instrument to use). - # - :auto_confirm - The payment method that automatically confirms the payment when it is - # ready, for example "card". - # :settings may include :success_url and :failure_url (max 255 characters), :capture (Boolean, - # whether to capture the payment immediately, default true) and :excluded_payment_methods - # (Array of payment method names, for example ["klarna"]). - # :order may include :sub_merchants, an Array of Hashes with :id, :product_category, - # :number_of_sales (Integer; the API does not define number_of_trades) and :registration_date - # (yyyy-MM-dd). + # :payment_methods may also include (every key is optional unless marked required): + # - :card - :token (a Hash with :id, String, the Checkout.com card token), :details (the card + # data: :number (String, write-only), :expiry_month (Integer), :expiry_year (Integer), :name + # (String, write-only), :cvv (String, write-only), :stored (Boolean, write-only) and + # :allow_update (Boolean)), :store_for_future_use (Boolean, write-only), :phone + # (:country_code, String, min 1 character, max 7 characters, and :number, String, min 6 + # characters, max 25 characters), :account_holder (:type, one of "individual", "government" + # or "corporate", :first_name, :last_name, :middle_name, :company_name (Strings) and + # :account_name_inquiry (Boolean)) and :preferred_scheme ("visa", "mastercard" or + # "cartes_bancaires"). The card data goes under :details; the API ignores it at the top level + # of :card. + # - :applepay - :token_data (write-only: :version, :data and :signature (Strings) and :header, + # a Hash with :ephemeral_public_key, :public_key_hash and :transaction_id (Strings)), :token (a + # Hash with :id, String, required, pattern ^(tok)_(\w{26})$, and :expires_on, date-time, + # ISO 8601; a String token is not accepted), :store_for_future_use (Boolean, write-only), + # :phone and :account_holder as on :card, and :preferred_scheme ("visa", "mastercard" or + # "cartes_bancaires"). Apple Pay has no :details. + # - :googlepay - :token_data (write-only: :protocol_version, :signature, :signed_message and + # :tokenization_key (Strings)), :token, :store_for_future_use, :phone and :account_holder as + # on :applepay, and :preferred_scheme ("visa" or "mastercard" only). Google Pay has no + # :details. + # - :instrument - :id (String, the unique identifier of the instrument to use). + # - :auto_confirm - String, the payment method that automatically confirms the payment when it + # is ready, for example "card". + # :settings may include :success_url and :failure_url (String, format uri, max 255 + # characters), :capture (Boolean, whether to capture the payment immediately, default true) and + # :excluded_payment_methods (Array of Strings, payment method names, for example ["klarna"]). + # :order may include :sub_merchants, an Array of Hashes with :id (String), :product_category + # (String), :number_of_sales (Integer; the API does not define number_of_trades) and + # :registration_date (String, format date, yyyy-MM-dd). # :metadata - A Hash of key/value pairs to attach to the payment (max 20 keys); each value is a # String (max 255 characters), a Number or a Boolean. # :risk {PaymentSetupRisk} - Risk assessment settings for the Payment Setup: :enabled @@ -184,8 +195,9 @@ def create_payment_setup(payment_setups_request) # payment_methods.cashapp.action.redirect_url, payment_methods.cashapp.reference and, once only, # payment_methods.cashapp.customer_profile. For Pay by Bank, read # payment_methods.paybybank.action.banks. Card, Apple Pay and Google Pay return the read-only - # :schemes (supported card scheme names) and card details :last4, :bin, :scheme and - # :expires_on; instrument returns the read-only :type and :action. + # :schemes (supported card scheme names; Google Pay never lists cartes_bancaires) and card + # details :last4, :bin, :scheme (Strings) and :expires_on (date-time); instrument returns the + # read-only :type (String) and :action (:type, "set_instrument"). def update_payment_setup(id, payment_setups_request) api_client.invoke_put( build_path(PAYMENTS_PATH, SETUPS_PATH, id), @@ -202,8 +214,9 @@ def update_payment_setup(id, payment_setups_request) # payment_methods.cashapp.action.redirect_url, payment_methods.cashapp.reference and, once only, # payment_methods.cashapp.customer_profile. For Pay by Bank, read # payment_methods.paybybank.action.banks. Card, Apple Pay and Google Pay return the read-only - # :schemes (supported card scheme names) and card details :last4, :bin, :scheme and - # :expires_on; instrument returns the read-only :type and :action. + # :schemes (supported card scheme names; Google Pay never lists cartes_bancaires) and card + # details :last4, :bin, :scheme (Strings) and :expires_on (date-time); instrument returns the + # read-only :type (String) and :action (:type, "set_instrument"). def get_payment_setup(id) api_client.invoke_get( build_path(PAYMENTS_PATH, SETUPS_PATH, id), @@ -222,8 +235,9 @@ def get_payment_setup(id) # payment_methods.cashapp.action.redirect_url, payment_methods.cashapp.reference and, once only, # payment_methods.cashapp.customer_profile. For Pay by Bank, read # payment_methods.paybybank.action.banks. Card, Apple Pay and Google Pay return the read-only - # :schemes (supported card scheme names) and card details :last4, :bin, :scheme and - # :expires_on; instrument returns the read-only :type and :action. + # :schemes (supported card scheme names; Google Pay never lists cartes_bancaires) and card + # details :last4, :bin, :scheme (Strings) and :expires_on (date-time); instrument returns the + # read-only :type (String) and :action (:type, "set_instrument"). def confirm_payment_setup(id, payment_method_name) api_client.invoke_post( build_path(PAYMENTS_PATH, SETUPS_PATH, id, CONFIRM_PATH, payment_method_name),