# Buyer

{% hint style="info" %}
The buyer entity is automatically created when the buyer commits for the first time.
{% endhint %}

A buyer participates in exchanges.

Buyer's funds management is described in [deposit-and-withdraw](https://docs.bosonprotocol.io/using-the-protocol/dacp-tools/finances/deposit-and-withdraw "mention").

### Solidity

{% tabs %}
{% tab title="Create buyer" %}
Creates a new buyer account

```solidity
IBosonAccountHandler bosonProtocol = IBosonAccountHandler(_bosonProtocolAddress);

BosonTypes.Buyer memory buyer = BosonTypes.Buyer({
    id: 0, // will be ignored and auto-assigned
    wallet: payable(buyerWalletAddress),
    active: true
});

bosonProtocol.createBuyer(buyer);
```

{% endtab %}

{% tab title="Update buyer" %}
Updates an existing buyer account.

{% hint style="info" %}
Only the wallet address of the buyer entity can perform this action.
{% endhint %}

```solidity
IBosonAccountHandler bosonProtocol = IBosonAccountHandler(_bosonProtocolAddress);

BosonTypes.Buyer memory buyer = BosonTypes.Buyer({
    id: 1, // buyer ID we would like to update
    wallet: payable(newWalletAddress),
    active: true
});

bosonProtocol.updateBuyer(buyer);
```

{% endtab %}
{% endtabs %}
