# llTransferLindenDollars

*LSL function*

```lsl
key key llTransferLindenDollars(key destination, integer amount);
```

- `key destination`: UUID of the destination avatar.
- `integer amount`: Quantity of L$ to transfer (must be greater than 0).

- Returns: `key`
- Energy: 10
- Permission: `PERMISSION_DEBIT`

Transfer **amount** of L$ money from script owner to **destination** avatar.

If you aren't going to use the return value or the resulting [transaction_result](/events/transaction_result/) event consider using [llGiveMoney](/functions/llGiveMoney/) instead of this function.

Returns a [key](https://wiki.secondlife.com/wiki/key) used in a matching [transaction_result](/events/transaction_result/) event for the success or failure of the transfer. If the transaction is successful, this key will show in the [transaction history](https://secondlife.com/my/account/transactions.php).

```lsl title="How to use" frame="terminal"
key result = llTransferLindenDollars(NULL_KEY, 0);
```

## Caveats

- An object cannot pay another object.
- Objects deeded to groups cannot give money (the permission cannot be granted).
- Use is limited to 30 payments in a 30 second interval for all scripts owned by that resident on a region. Sustained overage will produce a script error and halt payments while the rate remains excessive. Historically, faster payments have failed intermittently.
- Once a script has the [PERMISSION_DEBIT](/constants/PERMISSION_DEBIT/) permission it can empty an account of L$.
  - Fraud & theft are both violations and crimes. Misuse this function and you risk being banned and legal action. In addition LL may freeze the accounts of anyone the money is transferred to and restore it to it's rightful owners. This may involve retrieving it from third party exchanges and accounts on those exchanges being frozen. The system is not designed to be friendly towards fraud.

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={1-31, 37-55}
// Pay 100 L$ to Fred Bloggs when he touches this prim
// Die if the transfer of funds was successful, else keep running

string  Recipient = "Fred Bloggs";      // Authorised recipient
integer Amount = 100;                   // Amount to pay Fred when he touches the prim

integer DebitPerms;
key     TransactionID=NULL_KEY;

default
{
    state_entry()
    {
        // Ask the owner for permission to debit their account
        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
    }

    run_time_permissions (integer perm)
    {
        if  (perm & PERMISSION_DEBIT)
            DebitPerms = TRUE;
    }

    touch_start(integer num_detected)
    {
        if (!DebitPerms)
            return;  // Cannot proceed - debit permissions not granted
        if (llDetectedName(0) != Recipient)
            return;  // unauthorised person is touching - ignore
        if (TransactionID != NULL_KEY)
            return;  // waiting on previous transaction to complete/fail

        key id = llDetectedKey(0);
        TransactionID = llTransferLindenDollars(id, Amount);
    }

    transaction_result(key id, integer success, string data)
    {
        if (id != TransactionID)
            return;          // Ignore if not the expected transaction

        if (success)
        {
            llOwnerSay( "Transfer of L$ to " + Recipient + " was successful");
            llSleep(1.0);
            llDie();          // Die so Fred can't keep taking money
        }
        else
        {
            llOwnerSay( "Transfer of L$ failed");
            TransactionID = NULL_KEY;
            // Keep the script running so Fred can try again, clear TransactionID to allow a new attempt
        }
    }
}
```

</details>

## Notes

- released on main server channel on 3-Dec-2011

## History

Date of Release [03/12/2011](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/11#11-12-03-246118)

## Known issues

From the issue templates included by the wiki article:

- VWR-28201 (bug): llTransferLindenDollars & the viewer displaying negative values
- SVC-7623 (bug): transaction_result event indicates failure SERVICE_ERROR although transaction is actually successful

## See also

### Functions

- [llGiveMoney](/functions/llGiveMoney/)
- [llSetPayPrice](/functions/llSetPayPrice/)

### Events

- [transaction_result](/events/transaction_result/)
- [money](/events/money/)

---

*Source: [LlTransferLindenDollars](https://wiki.secondlife.com/wiki/LlTransferLindenDollars) on the Second Life Wiki. Content from the Second Life Wiki articles LlTransferLindenDollars (revision 1194335, 2015-01-22), Template:LSL Function/permission (revision 1200093, 2016-05-12), Template:LSL Function/avatar (revision 1179236, 2013-06-15), Template:Issues/VWR-28201 (revision 1162055, 2012-01-25) and Template:Issues/SVC-7623 (revision 1162054, 2012-01-25), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llTransferLindenDollars/
