Class: CheckoutSdk::Payments::PaymentSetupsClient

Inherits:
Client
  • Object
show all
Defined in:
lib/checkout_sdk/payments/setups/payment_setups_client.rb

Overview

Client for Payment Setups API operations

Beta

Constant Summary collapse

PAYMENTS_PATH =
'payments'
SETUPS_PATH =
'setups'
CONFIRM_PATH =
'confirm'

Instance Attribute Summary

Attributes inherited from Client

#api_client, #authorization_type, #configuration

Instance Method Summary collapse

Constructor Details

#initialize(api_client, configuration) ⇒ PaymentSetupsClient

Returns a new instance of PaymentSetupsClient.

Parameters:



14
15
16
# File 'lib/checkout_sdk/payments/setups/payment_setups_client.rb', line 14

def initialize(api_client, configuration)
  super(api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY_OR_OAUTH)
end

Instance Method Details

#confirm_payment_setup(id, payment_method_option_id) ⇒ Object

Confirms a Payment Setup to begin processing the payment request with your chosen payment method option.

Beta

to process the payment with

Parameters:

  • id (String)
    • The unique identifier of the Payment Setup

  • payment_method_option_id (String)
    • The unique identifier of the payment option



67
68
69
70
71
72
# File 'lib/checkout_sdk/payments/setups/payment_setups_client.rb', line 67

def confirm_payment_setup(id, payment_method_option_id)
  api_client.invoke_post(
    build_path(PAYMENTS_PATH, SETUPS_PATH, id, CONFIRM_PATH, payment_method_option_id),
    sdk_authorization
  )
end

#create_payment_setup(payment_setups_request) ⇒ Object

Creates a Payment Setup. To maximize the amount of information the payment setup can use, we recommend that you create a payment setup as early as possible in the customer’s journey. For example, the first time they land on the basket page.

Beta

Parameters:

  • payment_setups_request (Hash)


25
26
27
28
29
30
31
# File 'lib/checkout_sdk/payments/setups/payment_setups_client.rb', line 25

def create_payment_setup(payment_setups_request)
  api_client.invoke_post(
    build_path(PAYMENTS_PATH, SETUPS_PATH),
    sdk_authorization,
    payment_setups_request
  )
end

#get_payment_setup(id) ⇒ Object

Retrieves a Payment Setup.

Beta

Parameters:

  • id (String)
    • The unique identifier of the Payment Setup to retrieve



53
54
55
56
57
58
# File 'lib/checkout_sdk/payments/setups/payment_setups_client.rb', line 53

def get_payment_setup(id)
  api_client.invoke_get(
    build_path(PAYMENTS_PATH, SETUPS_PATH, id),
    sdk_authorization
  )
end

#update_payment_setup(id, payment_setups_request) ⇒ Object

Updates a Payment Setup. You should update the payment setup whenever there are significant changes in the data relevant to the customer’s transaction. For example, when the customer makes a change that impacts the total payment amount.

Beta

Parameters:

  • id (String)
    • The unique identifier of the Payment Setup to update

  • payment_setups_request (Hash)


41
42
43
44
45
46
47
# File 'lib/checkout_sdk/payments/setups/payment_setups_client.rb', line 41

def update_payment_setup(id, payment_setups_request)
  api_client.invoke_put(
    build_path(PAYMENTS_PATH, SETUPS_PATH, id),
    sdk_authorization,
    payment_setups_request
  )
end