michaelstivala/omnipay-etherscan

Etherscan driver for the Omnipay payment processing library

1.8 2022-03-03 10:17 UTC

This package is auto-updated.

Last update: 2024-04-29 04:47:44 UTC


README

Etherscan.io driver for the Omnipay PHP payment processing library.

Installation

composer require financialplugins/omnipay-etherscan

Usage

Initialize

This step is required before using other methods.

$gateway = Omnipay::create('Etherscan');
   
$gateway->initialize([
    'api_key' => '...',
    'network' => 'main' // kovan or ropsten can also be used
]);

Fetch Address Balance

$response = $gateway->fetchBalance(['address' => '0xAAAAAAAAAA...'])->send();

if ($response->isSuccessful()) {
    $data = $response->getData();
} else {
    $errorMessage = $response->getMessage();
}

Fetch Contract (ERC20 token) Address Balance

$response = $gateway->fetchTokenBalance([
    'address' => '0xAAAAAAAAAA...',
    'contract_address' => '0xAAAAAAAAAA...'
])->send();

if ($response->isSuccessful()) {
    $data = $response->getData();
} else {
    $errorMessage = $response->getMessage();
}

Fetch Transaction Info

$response = $gateway->fetchTransaction(['transactionReference' => '0xAAAAAAAAAA...'])->send();

if ($response->isSuccessful()) {
    $data = $response->getData();
} else {
    $errorMessage = $response->getMessage();
}

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.