Class: WhopSDK::Resources::PaymentMethods

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

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:



86
87
88
# File 'lib/whop_sdk/resources/payment_methods.rb', line 86

def initialize(client:)
  @client = client
end

Instance Method Details

#list(member_id: , after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PaymentMethodListResponse>

A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. It holds the necessary billing details and can be attached to a member for future one-time or recurring charges. This lets you reuse the same payment credentials across multiple payments.

Required permissions:

  • ‘member:payment_methods:read`

Parameters:

  • member_id (String)

    The ID of the Member to list payment methods for

  • 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.

  • created_after (Time, nil)

    The minimum creation date to filter by

  • created_before (Time, nil)

    The maximum creation date to filter by

  • 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.

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

Returns:

See Also:



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/whop_sdk/resources/payment_methods.rb', line 71

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

#retrieve(id, member_id: , request_options: {}) ⇒ WhopSDK::Models::PaymentMethodRetrieveResponse

A payment method is a stored representation of how a customer intends to pay, such as a card, bank account, or digital wallet. It holds the necessary billing details and can be attached to a member for future one-time or recurring charges. This lets you reuse the same payment credentials across multiple payments.

Required permissions:

  • ‘member:payment_methods:read`

Parameters:

  • id (String)

    The ID of the PaymentMethod

  • member_id (String)

    The ID of the Member associated with the PaymentMethod

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

Returns:

See Also:



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

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