Module: NOWPayments::API::Payouts

Included in:
Client
Defined in:
lib/nowpayments/api/payouts.rb

Overview

Payout and mass payout endpoints (requires JWT auth)

Instance Method Summary collapse

Instance Method Details

#balanceHash

Get account balance GET /v1/balance



10
11
12
# File 'lib/nowpayments/api/payouts.rb', line 10

def balance
  get("balance").body
end

#create_payout(withdrawals:, payout_description: nil, ipn_callback_url: nil) ⇒ Hash

Create payout POST /v1/payout Note: This endpoint requires JWT authentication



47
48
49
50
51
52
53
# File 'lib/nowpayments/api/payouts.rb', line 47

def create_payout(withdrawals:, payout_description: nil, ipn_callback_url: nil)
  params = { withdrawals: withdrawals }
  params[:payout_description] = payout_description if payout_description
  params[:ipn_callback_url] = ipn_callback_url if ipn_callback_url

  post("payout", body: params).body
end

#list_payouts(limit: 10, offset: 0) ⇒ Hash

List payouts with pagination GET /v1/payout



79
80
81
82
83
84
# File 'lib/nowpayments/api/payouts.rb', line 79

def list_payouts(limit: 10, offset: 0)
  get("payout", params: {
        limit: limit,
        offset: offset
      }).body
end

#min_payout_amount(currency:) ⇒ Hash

Get minimum payout amount GET /v1/payout/min-amount



90
91
92
# File 'lib/nowpayments/api/payouts.rb', line 90

def min_payout_amount(currency:)
  get("payout/min-amount", params: { currency: currency }).body
end

#payout_fee(currency:, amount:) ⇒ Hash

Get payout fee estimate GET /v1/payout/fee



99
100
101
102
103
104
# File 'lib/nowpayments/api/payouts.rb', line 99

def payout_fee(currency:, amount:)
  get("payout/fee", params: {
        currency: currency,
        amount: amount
      }).body
end

#payout_status(payout_id) ⇒ Hash

Get payout status GET /v1/payout/:payout_id



70
71
72
# File 'lib/nowpayments/api/payouts.rb', line 70

def payout_status(payout_id)
  get("payout/#{payout_id}").body
end

#validate_payout_address(address:, currency:, extra_id: nil) ⇒ Hash

Validate payout address POST /v1/payout/validate-address



20
21
22
23
24
25
26
27
28
# File 'lib/nowpayments/api/payouts.rb', line 20

def validate_payout_address(address:, currency:, extra_id: nil)
  params = {
    address: address,
    currency: currency
  }
  params[:extra_id] = extra_id if extra_id

  post("payout/validate-address", body: params).body
end

#verify_payout(batch_withdrawal_id:, verification_code:) ⇒ Hash

Verify payout with 2FA code POST /v1/payout/:batch_withdrawal_id/verify



60
61
62
63
64
# File 'lib/nowpayments/api/payouts.rb', line 60

def verify_payout(batch_withdrawal_id:, verification_code:)
  post("payout/#{batch_withdrawal_id}/verify", body: {
         verification_code: verification_code
       }).body
end