Class: CheckoutSdk::Payments::FlowClient

Inherits:
Client
  • Object
show all
Defined in:
lib/checkout_sdk/payments/flow/flow_client.rb

Overview

Client for Payment Flow API operations

Beta

Constant Summary collapse

PAYMENT_SESSIONS_PATH =
'payment-sessions'
SUBMIT_PATH =
'submit'
COMPLETE_PATH =
'complete'

Instance Attribute Summary

Attributes inherited from Client

#api_client, #authorization_type, #configuration

Instance Method Summary collapse

Constructor Details

#initialize(api_client, configuration) ⇒ FlowClient

Returns a new instance of FlowClient.

Parameters:



14
15
16
# File 'lib/checkout_sdk/payments/flow/flow_client.rb', line 14

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

Instance Method Details

#request_payment_session(request_payment_session_request) ⇒ Object

Creates a Payment Session. Use this endpoint to set up a payment session before collecting payment details from your customer.

Beta

Parameters:

  • request_payment_session_request (Hash)


23
24
25
26
27
28
29
# File 'lib/checkout_sdk/payments/flow/flow_client.rb', line 23

def request_payment_session(request_payment_session_request)
  api_client.invoke_post(
    build_path(PAYMENT_SESSIONS_PATH),
    sdk_authorization,
    request_payment_session_request
  )
end

#request_payment_session_with_payment(request_payment_session_with_payment_request) ⇒ Object

Creates and submits a Payment Session in a single request. Use this endpoint to create a payment session and immediately process the payment.

Beta

Parameters:

  • request_payment_session_with_payment_request (Hash)


50
51
52
53
54
55
56
# File 'lib/checkout_sdk/payments/flow/flow_client.rb', line 50

def request_payment_session_with_payment(request_payment_session_with_payment_request)
  api_client.invoke_post(
    build_path(PAYMENT_SESSIONS_PATH, COMPLETE_PATH),
    sdk_authorization,
    request_payment_session_with_payment_request
  )
end

#submit_payment_session(id, submit_payment_session_request) ⇒ Object

Submits a Payment Session. Use this endpoint to submit payment details and process the payment for an existing session.

Beta

Parameters:

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

  • submit_payment_session_request (Hash)


37
38
39
40
41
42
43
# File 'lib/checkout_sdk/payments/flow/flow_client.rb', line 37

def submit_payment_session(id, submit_payment_session_request)
  api_client.invoke_post(
    build_path(PAYMENT_SESSIONS_PATH, id, SUBMIT_PATH),
    sdk_authorization,
    submit_payment_session_request
  )
end