1. Go to this page and download the library: Download akashic/akashic-pay library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
akashic / akashic-pay example snippets
use Akashic\AkashicPay;
use Akashic\AkashicPay;
use Akashic\Constants\Environment;
use Akashic\Constants\ACNode;
use Akashic\Constants\ACDevNode;
$akashicPay = new AkashicPay([
// in development, you will use our testnet and testnet L1 chains
'environment' => getenv('environment') === 'production' ? Environment::PRODUCTION : Environment::DEVELOPMENT,
// optional, the SDK will try to find the fastest node if omitted
'targetNode' => getenv('environment') === 'production' ? ACNode::SINGAPORE_DAI : ACDevNode::SINGAPORE_1,
// use whatever secret management tool you prefer to load the private key
// from your AkashicLink account. It should be of the form:
// `"0x2d99270559d7702eadd1c5a483d0a795566dc76c18ad9d426c932de41bfb78b7"`
// In development, each developer could have their own, or omit this (and
// the l2Address), in which case the SDK will create and use a new pair.
// you can instead use your Akashic Link account's 12-word phrase, using the
// argument `recoveryPhrase`
'privateKey' => getenv('akashicKey'),
// this is the address of your AkashicLink account. Of the form "AS1234..."
'l2Address' => getenv('l2Address'),
]);
use Akashic\AkashicPay;
use Akashic\Constants\Environment;
// production is the default environment.
// And in production, an otk must be specified
$akashicPay = new AkashicPay([
'environment' => Environment::DEVELOPMENT,
]);
// for security reasons, this would throw if the environment was production
// but you can use this in development to record and re-use your otk
$keyPair = $akashicPay->getKeyBackup();
print('my testing L2 address: ' . $keyPair['l2Address'] . ' and private key: ' . $keyPair['privateKey']);
use Akashic\AkashicPay;
use Akashic\Constants\Environment;
// production is the default environment.
// And in production, an otk must be specified
$akashicPay = new AkashicPay([
'environment' => Environment::DEVELOPMENT,
'privateKey' => getenv('akashicKey'),
'l2Address' => getenv('l2Address'),
]);
use Akashic\Constants\NetworkSymbol;
$address = $akashicPay->getDepositAddress(NetworkSymbol::TRON_SHASTA, 'EndUser123');