AkashicPay
English
English
  • Introduction
    • Overview
    • Fee Structure
    • Transaction Times
    • Terminology
  • Dashboard
    • Dashboard
    • Account
    • Transfer
    • Settings
    • Developers
  • SDK
    • Getting Started
    • Payment Flow
    • SDKs & Toolkits
    • Functions
      • getDepositAddress
      • getDepositUrl
      • Identifier & ReferenceId
      • Requested amount & currency
      • payout
      • Payout callback
      • Deposit callback
      • getTransfers
      • getBalance
      • getTransactionDetails
      • Errors
    • Supported Currencies
  • Secure Callback Endpoint
  • Guides
    • Quick Guide
    • Recommended integration flow
Powered by GitBook
On this page

Was this helpful?

  1. SDK
  2. Functions

getDepositAddress

Get an address on the specified network for users to make deposits into.

PreviousFunctionsNextgetDepositUrl

Last updated 20 days ago

Was this helpful?

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 .

referenceId is optional in deposit request. It allows you to identify individual transactions if you require more detailed control over deposits. See the for more information.

requestedAmount and requestedCurrency are optional in deposit request. It allows you to identify individual transactions based on these. See Requested amount & currencyfor 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.

Example

Creates a Tron-wallet for user123

const { address, identifier } = await akashicPay.getDepositAddress(
  NetworkSymbol.Tron, 'user123'
);

// with referenceId
const { address, identifier } = await akashicPay.getDepositAddress(
  NetworkSymbol.Tron, 'user123', 'order1'
);

// with requestedAmount and requestedCurrency
const { address, identifier } = await akashicPay.getDepositAddressWithRequestedValue(
  NetworkSymbol.Tron, 'user123', 'order1', Currency.USD, "1000"
);
$depositAddress = $akashicPay->getDepositAddress(
  NetworkSymbol::Tron, 'user123'
);

// with referenceId
$depositAddress = $akashicPay->getDepositAddress(
  NetworkSymbol::Tron, 'user123', 'order1'
);

// with requestedAmount and requestedCurrency
$depositAddress = $akashicPay->getDepositAddressWithRequestedValue(
  NetworkSymbol::Tron, 'user123', 'order1', Currency::USD, 1000
);
APDepositAddressResult depositAddress = akashicPay.getDepositAddress(
  APNetworkSymbol.TRX, 'user123'
);

// with referenceId
APDepositAddressResult depositAddress = akashicPay.getDepositAddress(
  APNetworkSymbol.TRX, 'user123', 'order1'
);

// with requestedAmount and requestedCurrency
APDepositAddressResult depositAddress = akashicPay.getDepositAddressWithRequestedValue(
  APNetworkSymbol.TRX, 'user123', 'order1', APCurrency.USD, 1000
);
var trxDepositAddress = await akashicPay.GetDepositAddressAsync(TronShastaNetworkSymbol.Value, "user123");

// with referenceId
var trxDepositAddress = await akashicPay.GetDepositAddressAsync(TronShastaNetworkSymbol.Value, "user123", "order1");

// with requestedAmount and requestedCurrency
var trxDepositAddress = await akashicPay.GetDepositAddressWithRequestedValueAsync(TronShastaNetworkSymbol.Value, "user123", "order1", Currency.USD, 1000);

Return Example

{
address: 'TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU',
identifier: 'user123'
// with requestedAmount and requestedCurrency
referenceId: 'order1',
requestedAmount: '1000',
requestedCurrency: 'USD',
network: 'TRX-SHASTA',
exchangeRate: '264.23123',
amount: '3.78'
}
[
    "address" => "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
    "identifier" => "user123",
    // with requestedAmount and requestedCurrency
    "referenceId" => "order1",
    "requestedAmount" => "1000",
    "requestedCurrency" => "USD",
    "network" => "TRX-SHASTA",
    "exchangeRate" => "264.23123",
    "amount" => "3.78"
]
{
address: 'TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU',
identifier: 'user123'
// with requestedAmount and requestedCurrency
referenceId: 'order1',
requestedAmount: '1000',
requestedCurrency: 'USD',
network: 'TRX-SHASTA',
exchangeRate: '264.23123',
amount: '3.78'
}
{
Address: "TTVkK6hGoAFhALG9NTkUDHjcFFXKmWcScU",
Identifier: "user123"
// with requestedAmount and requestedCurrency
referenceId: "order1",
requestedAmount: "1000",
requestedCurrency: "USD",
network: "TRX-SHASTA",
exchangeRate: "264.23123",
amount: "3.78"
}

Errors

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

next page
next page