|
| 1 | +# Payouts |
| 2 | + |
| 3 | +```ruby |
| 4 | +payouts_api = client.payouts |
| 5 | +``` |
| 6 | + |
| 7 | +## Class Name |
| 8 | + |
| 9 | +`PayoutsApi` |
| 10 | + |
| 11 | +## Methods |
| 12 | + |
| 13 | +* [List Payouts](../../doc/api/payouts.md#list-payouts) |
| 14 | +* [Get Payout](../../doc/api/payouts.md#get-payout) |
| 15 | +* [List Payout Entries](../../doc/api/payouts.md#list-payout-entries) |
| 16 | + |
| 17 | + |
| 18 | +# List Payouts |
| 19 | + |
| 20 | +Retrieves a list of all payouts for the default location. |
| 21 | +You can filter payouts by location ID, status, time range, and order them in ascending or descending order. |
| 22 | +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. |
| 23 | + |
| 24 | +```ruby |
| 25 | +def list_payouts(location_id: nil, |
| 26 | + status: nil, |
| 27 | + begin_time: nil, |
| 28 | + end_time: nil, |
| 29 | + sort_order: nil, |
| 30 | + cursor: nil, |
| 31 | + limit: nil) |
| 32 | +``` |
| 33 | + |
| 34 | +## Parameters |
| 35 | + |
| 36 | +| Parameter | Type | Tags | Description | |
| 37 | +| --- | --- | --- | --- | |
| 38 | +| `location_id` | `String` | Query, Optional | The ID of the location for which to list the payouts.<br>By default, payouts are returned for the default (main) location associated with the seller. | |
| 39 | +| `status` | [`String (Payout Status)`](../../doc/models/payout-status.md) | Query, Optional | If provided, only payouts with the given status are returned. | |
| 40 | +| `begin_time` | `String` | Query, Optional | The timestamp for the beginning of the payout creation time, in RFC 3339 format.<br>Inclusive. Default: The current time minus one year. | |
| 41 | +| `end_time` | `String` | Query, Optional | The timestamp for the end of the payout creation time, in RFC 3339 format.<br>Default: The current time. | |
| 42 | +| `sort_order` | [`String (Sort Order)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payouts are listed. | |
| 43 | +| `cursor` | `String` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).<br>If request parameters change between requests, subsequent results may contain duplicates or missing records. | |
| 44 | +| `limit` | `Integer` | Query, Optional | The maximum number of results to be returned in a single page.<br>It is possible to receive fewer results than the specified limit on a given page.<br>The default value of 100 is also the maximum allowed value. If the provided value is<br>greater than 100, it is ignored and the default value is used instead.<br>Default: `100` | |
| 45 | + |
| 46 | +## Response Type |
| 47 | + |
| 48 | +[`List Payouts Response Hash`](../../doc/models/list-payouts-response.md) |
| 49 | + |
| 50 | +## Example Usage |
| 51 | + |
| 52 | +```ruby |
| 53 | +location_id = 'location_id4' |
| 54 | +status = 'PAID' |
| 55 | +begin_time = 'begin_time2' |
| 56 | +end_time = 'end_time2' |
| 57 | +sort_order = 'DESC' |
| 58 | +cursor = 'cursor6' |
| 59 | +limit = 172 |
| 60 | + |
| 61 | +result = payouts_api.list_payouts(location_id: location_id, status: status, begin_time: begin_time, end_time: end_time, sort_order: sort_order, cursor: cursor, limit: limit) |
| 62 | + |
| 63 | +if result.success? |
| 64 | + puts result.data |
| 65 | +elsif result.error? |
| 66 | + warn result.errors |
| 67 | +end |
| 68 | +``` |
| 69 | + |
| 70 | + |
| 71 | +# Get Payout |
| 72 | + |
| 73 | +Retrieves details of a specific payout identified by a payout ID. |
| 74 | +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. |
| 75 | + |
| 76 | +```ruby |
| 77 | +def get_payout(payout_id:) |
| 78 | +``` |
| 79 | + |
| 80 | +## Parameters |
| 81 | + |
| 82 | +| Parameter | Type | Tags | Description | |
| 83 | +| --- | --- | --- | --- | |
| 84 | +| `payout_id` | `String` | Template, Required | The ID of the payout to retrieve the information for. | |
| 85 | + |
| 86 | +## Response Type |
| 87 | + |
| 88 | +[`Get Payout Response Hash`](../../doc/models/get-payout-response.md) |
| 89 | + |
| 90 | +## Example Usage |
| 91 | + |
| 92 | +```ruby |
| 93 | +payout_id = 'payout_id6' |
| 94 | + |
| 95 | +result = payouts_api.get_payout(payout_id: payout_id) |
| 96 | + |
| 97 | +if result.success? |
| 98 | + puts result.data |
| 99 | +elsif result.error? |
| 100 | + warn result.errors |
| 101 | +end |
| 102 | +``` |
| 103 | + |
| 104 | + |
| 105 | +# List Payout Entries |
| 106 | + |
| 107 | +Retrieves a list of all payout entries for a specific payout. |
| 108 | +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. |
| 109 | + |
| 110 | +```ruby |
| 111 | +def list_payout_entries(payout_id:, |
| 112 | + sort_order: nil, |
| 113 | + cursor: nil, |
| 114 | + limit: nil) |
| 115 | +``` |
| 116 | + |
| 117 | +## Parameters |
| 118 | + |
| 119 | +| Parameter | Type | Tags | Description | |
| 120 | +| --- | --- | --- | --- | |
| 121 | +| `payout_id` | `String` | Template, Required | The ID of the payout to retrieve the information for. | |
| 122 | +| `sort_order` | [`String (Sort Order)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payout entries are listed. | |
| 123 | +| `cursor` | `String` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).<br>If request parameters change between requests, subsequent results may contain duplicates or missing records. | |
| 124 | +| `limit` | `Integer` | Query, Optional | The maximum number of results to be returned in a single page.<br>It is possible to receive fewer results than the specified limit on a given page.<br>The default value of 100 is also the maximum allowed value. If the provided value is<br>greater than 100, it is ignored and the default value is used instead.<br>Default: `100` | |
| 125 | + |
| 126 | +## Response Type |
| 127 | + |
| 128 | +[`List Payout Entries Response Hash`](../../doc/models/list-payout-entries-response.md) |
| 129 | + |
| 130 | +## Example Usage |
| 131 | + |
| 132 | +```ruby |
| 133 | +payout_id = 'payout_id6' |
| 134 | +sort_order = 'DESC' |
| 135 | +cursor = 'cursor6' |
| 136 | +limit = 172 |
| 137 | + |
| 138 | +result = payouts_api.list_payout_entries(payout_id: payout_id, sort_order: sort_order, cursor: cursor, limit: limit) |
| 139 | + |
| 140 | +if result.success? |
| 141 | + puts result.data |
| 142 | +elsif result.error? |
| 143 | + warn result.errors |
| 144 | +end |
| 145 | +``` |
| 146 | + |
0 commit comments