Class: WhopSDK::Resources::PaymentMethods

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/payment_methods.rb

Overview

Payment methods

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PaymentMethods

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PaymentMethods.

Parameters:



94
95
96
# File 'lib/whop_sdk/resources/payment_methods.rb', line 94

def initialize(client:)
  @client = client
end

Instance Method Details

#list(after: nil, before: nil, company_id: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, member_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PaymentMethodListResponse::BasePaymentMethod, WhopSDK::Models::PaymentMethodListResponse::CardPaymentMethod, WhopSDK::Models::PaymentMethodListResponse::UsBankAccountPaymentMethod, WhopSDK::Models::PaymentMethodListResponse::CashappPaymentMethod, WhopSDK::Models::PaymentMethodListResponse::IdealPaymentMethod, WhopSDK::Models::PaymentMethodListResponse::SepaDebitPaymentMethod>

Some parameter documentations has been truncated, see Models::PaymentMethodListParams for more details.

Returns a paginated list of payment methods for a member or company, with optional filtering by creation date. A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet.

Required permissions:

  • ‘member:payment_methods:read`

Parameters:

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • company_id (String, nil)

    The unique identifier of the company. Provide either this or member_id, not both

  • created_after (Time, nil)

    Only return payment methods created after this timestamp.

  • created_before (Time, nil)

    Only return payment methods created before this timestamp.

  • direction (Symbol, WhopSDK::Models::Direction, nil)

    The direction of the sort.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • member_id (String, nil)

    The unique identifier of the member to list payment methods for.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/whop_sdk/resources/payment_methods.rb', line 78

def list(params = {})
  parsed, options = WhopSDK::PaymentMethodListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "payment_methods",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::PaymentMethodListResponse,
    options: options
  )
end

#retrieve(id, company_id: nil, member_id: nil, request_options: {}) ⇒ WhopSDK::Models::PaymentMethodRetrieveResponse::BasePaymentMethod, ...

Some parameter documentations has been truncated, see Models::PaymentMethodRetrieveParams for more details.

Retrieves the details of an existing payment method.

Required permissions:

  • ‘member:payment_methods:read`

Parameters:

  • id (String)

    The unique identifier of the payment method.

  • company_id (String, nil)

    The unique identifier of the company. Provide either this or member_id, not both

  • member_id (String, nil)

    The unique identifier of the member. Provide either this or company_id, not both

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/whop_sdk/resources/payment_methods.rb', line 29

def retrieve(id, params = {})
  parsed, options = WhopSDK::PaymentMethodRetrieveParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["payment_methods/%1$s", id],
    query: query,
    model: WhopSDK::Models::PaymentMethodRetrieveResponse,
    options: options
  )
end