Account routes: payout, sweep
The Account Verbs payout, sweep as api.sb routes, with inputs, result, refusals and an example.
Reference for Account, one group of Account routes.
Account.payout
Payout sends available cash from the payments balance to the owner’s bank and lists every Transaction the payout carries. Verb page.
POST /{namespace}/ accounts/ {account}/ payoutPath: account. Body, as JSON: the other inputs. Emits Account.paidOut.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
account | Account | required | The payments balance: the cash Account held at payments. |
amount | money | How much to send. Defaults to everything available. | |
instant | boolean | True to send it within minutes to an eligible debit card or bank, for Stripe’s instant payout cost. | |
schedule | string | Sets the Account’s payoutSchedule from now on, in place of sending a payout now. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
account | Account | required | The payments balance after the payout. |
transaction | Transaction | required | The payout, a Transaction of kind payout. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ accounts/ acct_nV4f0K7dTw/ payout \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"{
"api": "https: //api.sb/ leaseline.app",
"account": {
"$id": "https: //api.sb/ leaseline.app/ accounts/ acct_nV4f0K7dTw",
"$type": "Account",
"class": "cash"
},
"transaction": {
"$id": "https: //api.sb/ leaseline.app/ transactions/ txn_XoxtZe3CQI",
"$type": "Transaction",
"kind": "charge",
"amount": {
"amount": 29,
"currency": "USD"
}
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Account.payout",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}Account.sweep
Sweep moves cash between two cash Accounts of the same owner, once or on a standing rule, within the Treasurer’s Limit. Verb page.
POST /{namespace}/ accounts/ {from}/ sweepPath: from. Body, as JSON: the other inputs. Emits Account.swept.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
from | Account | required | The cash Account the money leaves. |
to | Account | required | The cash Account it lands in. |
amount | money | How much to move. Leave it out and set keep to move everything above a floor. | |
keep | money | Leave this much in from and move the rest. | |
repeat | string | Turns the move into a standing rule that sweeps on this schedule. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
account | Account | required | The to Account, with the money landed. |
transaction | Transaction | required | The move, reconciled on both Accounts. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ accounts/ acct_nV4f0K7dTw/ sweep \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"to": "acct_nV4f0K7dTw"}'{
"api": "https: //api.sb/ leaseline.app",
"account": {
"$id": "https: //api.sb/ leaseline.app/ accounts/ acct_nV4f0K7dTw",
"$type": "Account",
"class": "cash"
},
"transaction": {
"$id": "https: //api.sb/ leaseline.app/ transactions/ txn_XoxtZe3CQI",
"$type": "Transaction",
"kind": "charge",
"amount": {
"amount": 29,
"currency": "USD"
}
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Account.sweep",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}