Class: WhopSDK::Resources::Topups

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

Overview

Topups

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Topups

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

Parameters:



46
47
48
# File 'lib/whop_sdk/resources/topups.rb', line 46

def initialize(client:)
  @client = client
end

Instance Method Details

#create(amount:, company_id:, currency:, payment_method_id:, request_options: {}) ⇒ WhopSDK::Models::TopupCreateResponse

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

Add funds to a company’s platform balance by charging a stored payment method. Top-ups have no fees or taxes and do not count as revenue.

Required permissions:

  • ‘payment:charge`

Parameters:

  • amount (Float)

    The amount to add to the balance in the specified currency. For example, 50.00 f

  • company_id (String)

    The unique identifier of the company to add funds to, starting with ‘biz_’.

  • currency (Symbol, WhopSDK::Models::Currency)

    The currency for the top-up amount, such as ‘usd’.

  • payment_method_id (String)

    The unique identifier of the stored payment method to charge for the top-up.

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

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
# File 'lib/whop_sdk/resources/topups.rb', line 32

def create(params)
  parsed, options = WhopSDK::TopupCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "topups",
    body: parsed,
    model: WhopSDK::Models::TopupCreateResponse,
    options: options
  )
end