Spending funds from wallets
Now that we have a wallet (and some funds in it), we can head straight to the fun part: spending funds from the wallet. In the wallets world, we spend funds by issuing a debit against the wallet through the POST /wallets/{walletId}/debit
endpoint. The debit will be issued against the wallet's balance, which will immediately be reduced by the amount of the debit.
{
"amount": {
"amount": 100,
"asset": "USD/2"
},
}
Setting the destination
By default, the debit will be issuing a transaction that recycles funds to the ledger world
account, which is the default way of representing the outside world and the account being used for sourcing funds when crediting the wallet. However, you can also specify a different destination account simply by setting the destination
field to any other ledger account address.
{
"amount": {
"amount": 100,
"asset": "USD/2"
},
"destination": {
"type": "ACCOUNT",
"identifier": "orders:1234"
}
}