# getDepositAddress

> **NB!!** You *MUST* be signed up on AkashicPay.com before creating wallets. Otherwise they will not be recognized even though you might get an address in return.

Given a network and a user-identifier, this function will create a wallet on the specified network via AkashicChain for the user to deposit into. To read more about the purpose of the `identifier`, see the [next page](/guides/identifier-and-referenceid.md).

`referenceId` is optional in deposit request. It allows you to identify individual transactions if you require more detailed control over deposits. See the [next page](/guides/identifier-and-referenceid.md) for more information.

`requestedAmount` and `requestedCurrency` are optional in deposit request. It allows you to identify individual transactions based on these. See [Requested amount & currency](/guides/requested-amount-and-currency.md)for more information.

Note: Deposit addresses are permanently assigned on AkashicPay. That means, any subsequent call to `getDepositAddress` with the same parameters (Network and identifier) will return the *same* address. This means it is easy to keep track of the 1-to-1 mapping between identifier and address, and  - if the identifier represent a user - impossible for the user to become confused about where to deposit into.

## <mark style="color:blue;">Example</mark>

Creates a Tron-wallet for `user123`

{% tabs %}
{% tab title="TypeScript" %}

```javascript
const { address, identifier } = await akashicPay.getDepositAddress(
  NetworkSymbol.Tron, // Network
  'user123', // identifier
  'order1' // optional referenceId
);
​
// with requestedAmount, requestedCurrency and markupPercentage
const { address, identifier } = await akashicPay.getDepositAddressWithRequestedValue(
  NetworkSymbol.Tron, // Network
  'user123', // identifier
  'orderId', // referenceId
  Currency.USD, // requested currency
  "1000", // requested amount
  TokenSymbol, // optional token symbol, omit if native coin
  1, // optional mark up percentage on exchange rate
);
```

{% endtab %}

{% tab title="PHP" %}

```php
$depositAddress = $akashicPay->getDepositAddress(
  NetworkSymbol::Tron, // Network
  'user123', // identifier
  'order1' // optional referenceId
);
​
// with requestedAmount, requestedCurrency and markupPercentage
$depositAddress = $akashicPay->getDepositAddressWithRequestedValue(
  NetworkSymbol::Tron, // Network
  'user123', // identifier
  'order1', // referenceId
  Currency::USD, // requested currency
  '1000', // requested amount
  TokenSymbol::USDT, // optional token symbol, omit if native coin
  1, // optional mark up percentage on exchange rate
);
```

{% endtab %}

{% tab title="Java" %}

```java
APDepositAddressResult depositAddress = akashicPay.getDepositAddress(
  APNetworkSymbol.TRX, // Network
  'user123', // identifier
  'order1' // optional referenceId
);

// with requestedAmount, requestedCurrency and markupPercentage
APDepositAddressWithRequestedValueRequest request = APDepositAddressWithRequestedValueRequest.builder()
   .network(APNetworkSymbol.TRX) // Network
   .identifier("user123") // identifier
   .referenceId("order1") // referenceId
   .requestedCurrency(APCurrencySymbol.USD) // requested currency
   .requestedAmount(1000.0) // requested amount
   .token(APTokenSymbol.USDT) // optional token symbol, omit if native coin
   .markupPercentage(1.0) // optional mark up percentage on exchange rate
   .build();

APExtendedDepositAddressResult depositAddress = sdk.getDepositAddressWithRequestedValue(request);
```

{% endtab %}

{% tab title="C#" %}
{% code overflow="wrap" %}

```csharp
var trxDepositAddress = await akashicPay.GetDepositAddressAsync(
  TronShastaNetworkSymbol.Value, // Network
  "user123", // identifier
  "order1" // optional referenceId
);

// with requestedAmount, requestedCurrency and markupPercentage
var request = new ApDepositAddressWithRequestedValueRequest.Builder()
  .SetNetwork(TronShastaNetworkSymbol.Value)
  .SetIdentifier("user123") //identifier
  .SetReferenceId("order1") //referenceId
  .SetRequestedCurrency(ApCurrencySymbol.USD) // requested currency
  .SetRequestedAmount(1000.0) // requested amount
  .SetToken(ApTokenSymbol.Usdt) // optional token symbol, omit if native coin
  .SetMarkupPercentage(10.0) // optional mark up percentage on exchange rate
  .Build();
  
var result = await sdk.GetDepositAddressWithRequestedValueAsync(request);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code overflow="wrap" %}

```go
dA, err = ap.getDepositAddress(
  akashicpay.Tron,  // Network
  "user123",  // identifier
  "order1" // optional referenceId
)

// with requestedAmount, requestedCurrency and markupPercentage
dA, err = ap.GetDepositAddressWithRequestedValue(
  akashicpay.Tron, // Network 
  "user123", // identifier 
  "order1", // referenceId 
  akashicpay.CurrencyUSD, // requested currency
  "1000",  // requested amount
  "", // optional token symbol, omit if native coin 
  0 // optional mark up percentage on exchange rate
)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## <mark style="color:blue;">Return Example</mark>

{% tabs %}
{% tab title="TypeScript" %}

```javascript
{
address: 'TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU',
identifier: 'user123'
// with requestedAmount and requestedCurrency
referenceId: 'order1',
requestedAmount: '1000',
requestedCurrency: 'USD',
network: 'TRX-SHASTA',
token: undefined, // or TokenSymbol
exchangeRate: '264.23123',
amount: '3.78',
expires: '2025-07-01T00:00:00.000Z',
markupPercentage: undefined // or string
}
```

{% endtab %}

{% tab title="PHP" %}

```php
[
    "address" => "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
    "identifier" => "user123",
    // with requestedAmount and requestedCurrency
    "referenceId" => "order1",
    "requestedAmount" => "1000",
    "requestedCurrency" => "USD",
    "network" => "TRX-SHASTA",
    "exchangeRate" => "264.23123",
    "amount" => "3.78"
]
```

{% endtab %}

{% tab title="Java" %}

```java
{
address: 'TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU',
identifier: 'user123'
// with requestedAmount and requestedCurrency
referenceId: 'order1',
requestedAmount: '1000',
requestedCurrency: 'USD',
network: 'TRX-SHASTA',
exchangeRate: '264.23123',
amount: '3.78'
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
{
Address: "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
Identifier: "user123"
// with requestedAmount and requestedCurrency
referenceId: "order1",
requestedAmount: "1000",
requestedCurrency: "USD",
network: "TRX-SHASTA",
exchangeRate: "264.23123",
amount: "3.78"
}
```

{% endtab %}

{% tab title="Go" %}

```go
{
Address: "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
Identifier: "user123"
// below if with requestedAmount and requestedCurrency (otherwise zero-valued)
ReferenceId: "order1",
RequestedAmount: "1000",
RequestedCurrency: "USD",
Network: "TRX-SHASTA",
Token: "USDT",
ExchangeRate: "264.23123",
Amount: "3.78",
Expires: "2025-07-01T00:00:00.000Z"
MarkupPercentage: "0"
}
```

{% endtab %}
{% endtabs %}

## <mark style="color:blue;">Errors</mark>

| Error                                                                               | Explanation                                                                                                                                                               |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AkashicError.KeyCreationFailure` - 'Failed to generate new wallet. Try again.'     | AkashicChain had an issue and could not generate the requested wallet. Normally should resolve shortly                                                                    |
| `AkashicError.UnHealthyKey` - 'New wallet was not created safely, please re-create' | Wallet was created but it was not verified to be 100% healthy. E.g. one of the nodes may not have been able to write its part of the data correctly. Try again right away |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.akashicpay.com/sdk/functions/getdepositaddress.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
