Class: Straddle::Resources::Payouts

Inherits:
Object
  • Object
show all
Defined in:
lib/straddle/resources/payouts.rb,
sig/straddle/resources/payouts.rbs

Overview

Payouts send money to a customer's bank account through a paykey.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Payouts

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

Parameters:



402
403
404
# File 'lib/straddle/resources/payouts.rb', line 402

def initialize(client:)
  @client = client
end

Instance Method Details

#cancel(id, reason: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PayoutResponse

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

Cancels a payout. The payout must have a status of created, scheduled, or on_hold.

Parameters:

  • id (String) —

    Path param: Unique identifier for the payout.

  • reason (String, nil) —

    Body param: Message explaining the payout status change.

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/straddle/resources/payouts.rb', line 171

def cancel(id, params = {})
  parsed, options = Straddle::PayoutCancelParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id",
    straddle_account_id: "straddle-account-id"
  }
  @client.request(
    method: :put,
    path: ["v1/payouts/%1$s/cancel", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PayoutResponse,
    options: options
  )
end

#create(amount:, currency:, description:, device:, external_id:, paykey:, payment_date:, config: nil, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PayoutResponse

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

Creates a payout to a customer's bank account. Straddle submits the payout for processing on payment_date unless the payout is on hold.

Parameters:

  • amount (Integer) —

    Body param: Amount in cents.

  • currency (String) —

    Body param: Currency code. Only USD is supported.

  • description (String, nil) —

    Body param: Description shown on the customer's bank statement where supported.

  • device (Straddle::Models::PaymentDevice) —

    Body param: Device used when the customer authorized the payout.

  • external_id (String) —

    Body param: Your unique identifier for the payout. Must be unique across payouts

  • paykey (String) —

    Body param: The paykey token that identifies the customer's bank account.

  • payment_date (Date) —

    Body param: Date when Straddle submits the payout for processing.

  • config (Straddle::Models::PayoutConfiguration) —

    Body param

  • metadata (Hash{Symbol=>String}, nil) —

    Body param: Up to 20 user-defined string key-value pairs.

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/straddle/resources/payouts.rb', line 46

def create(params)
  parsed, options = Straddle::PayoutCreateParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id",
    straddle_account_id: "straddle-account-id"
  }
  @client.request(
    method: :post,
    path: "v1/payouts",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PayoutResponse,
    options: options
  )
end

#hold(id, reason: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PayoutResponse

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

Places a payout on hold to prevent submission for processing. The payout must have a status of created or scheduled.

Parameters:

  • id (String) —

    Path param: Unique identifier for the payout.

  • reason (String, nil) —

    Body param: Message explaining the payout status change.

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/straddle/resources/payouts.rb', line 214

def hold(id, params = {})
  parsed, options = Straddle::PayoutHoldParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id",
    straddle_account_id: "straddle-account-id"
  }
  @client.request(
    method: :put,
    path: ["v1/payouts/%1$s/hold", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PayoutResponse,
    options: options
  )
end

#list_unmasked(id, correlation_id: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::UnmaskedPayoutResponse

Return a payout with its sensitive fields unmasked.

Parameters:

  • id (String) —

    Unique identifier for the payout.

  • correlation_id (String) —

    Optional client-generated identifier for tracing a series of related requests.

  • request_id (String) —

    Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    For platform requests, the embedded account UUID that sets the request scope.

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

Returns:

See Also:



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/straddle/resources/payouts.rb', line 249

def list_unmasked(id, params = {})
  parsed, options = Straddle::PayoutListUnmaskedParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/payouts/%1$s/unmask", id],
    headers:
      parsed.transform_keys(
        correlation_id: "correlation-id",
        request_id: "request-id",
        straddle_account_id: "straddle-account-id"
      ),
    model: Straddle::UnmaskedPayoutResponse,
    options: options
  )
end

#release(id, reason: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PayoutResponse

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

Releases a payout from on_hold and returns it to created for submission on payment_date.

Parameters:

  • id (String) —

    Path param: Unique identifier for the payout.

  • reason (String, nil) —

    Body param: Message explaining the payout status change.

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/straddle/resources/payouts.rb', line 290

def release(id, params = {})
  parsed, options = Straddle::PayoutReleaseParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id",
    straddle_account_id: "straddle-account-id"
  }
  @client.request(
    method: :put,
    path: ["v1/payouts/%1$s/release", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PayoutResponse,
    options: options
  )
end

#resubmit(id, description: nil, external_id: nil, payment_date: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PayoutResponse

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

Creates a new payout from a failed, reversed, or cancelled payout. The request can override description, external_id, and payment_date. Other payment details come from the original payout.

Parameters:

  • id (String) —

    Path param: Unique identifier for the payout.

  • description (String, nil) —

    Body param: Description for the resubmitted payout. Defaults to the original des

  • external_id (String, nil) —

    Body param: Your unique identifier for the resubmitted payout. Defaults to a new

  • payment_date (Date, nil) —

    Body param: Date when Straddle submits the resubmitted payout for processing. De

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/straddle/resources/payouts.rb', line 338

def resubmit(id, params = {})
  parsed, options = Straddle::PayoutResubmitParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id",
    straddle_account_id: "straddle-account-id"
  }
  @client.request(
    method: :post,
    path: ["v1/payouts/%1$s/resubmit", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PayoutResponse,
    options: options
  )
end

#retrieve(id, correlation_id: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PayoutResponse

Returns a payout by its unique identifier.

Parameters:

  • id (String) —

    Unique identifier for the payout.

  • correlation_id (String) —

    Optional client-generated identifier for tracing a series of related requests.

  • request_id (String) —

    Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    For platform requests, the embedded account UUID that sets the request scope.

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

Returns:

See Also:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/straddle/resources/payouts.rb', line 81

def retrieve(id, params = {})
  parsed, options = Straddle::PayoutRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/payouts/%1$s", id],
    headers:
      parsed.transform_keys(
        correlation_id: "correlation-id",
        request_id: "request-id",
        straddle_account_id: "straddle-account-id"
      ),
    model: Straddle::PayoutResponse,
    options: options
  )
end

#update(id, amount:, description:, payment_date:, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PayoutResponse

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

Updates the description, amount, payment_date, or metadata. The payout must have a status of created or on_hold.

Parameters:

  • id (String) —

    Path param: Unique identifier for the payout.

  • amount (Integer) —

    Body param: Amount in cents.

  • description (String, nil) —

    Body param: Updated description for the payout.

  • payment_date (Date) —

    Body param: New date for Straddle to submit the payout for processing.

  • metadata (Hash{Symbol=>String}, nil) —

    Body param: Replacement metadata for the payout. Up to 20 user-defined string ke

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/straddle/resources/payouts.rb', line 128

def update(id, params)
  parsed, options = Straddle::PayoutUpdateParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id",
    straddle_account_id: "straddle-account-id"
  }
  @client.request(
    method: :put,
    path: ["v1/payouts/%1$s", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PayoutResponse,
    options: options
  )
end

#upload_authorization_proof(id, file:, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PayoutResponse

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

Uploads a proof-of-authorization document for a payout. A later upload adds another document and does not replace an existing one.

Parameters:

  • id (String) —

    Path param: Unique identifier for the payout.

  • file (Pathname, StringIO, IO, String, Straddle::FilePart) —

    Body param: The document file to upload as proof of authorization for this payou

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/straddle/resources/payouts.rb', line 381

def upload_authorization_proof(id, params)
  parsed, options = Straddle::PayoutUploadAuthorizationProofParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id",
    straddle_account_id: "straddle-account-id"
  }
  @client.request(
    method: :post,
    path: ["v1/payouts/%1$s/authorization", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PayoutResponse,
    options: options
  )
end