mnpy / mnpy-php-api-sdk
PHP SDK for the MNPY API.
Requires
- guzzlehttp/guzzle: ^6.3.0
Requires (Dev)
- phpmd/phpmd: @stable
- squizlabs/php_codesniffer: @stable
This package is not auto-updated.
Last update: 2024-04-28 03:19:50 UTC
README
Start accepting over hundreds cryptocurrencies without minimum costs, fixed contracts and hidden costs. At MNPY you pay for successful transactions only. Read more at MNPY.
Requirements
It's easy to start using MNPY, you need;
- PHP >7.0
- A MNPY account
- A Ethereum wallet, preferably ERC20 compliant
Installation
You are encouraged to install the PHP SDK using Composer.
$ composer require mnpy/mnpy-php-api-sdk
Optionally, you can checkout the git repository and manually load the required files.
Getting started
Require the autoloader generated by Composer (or build your own) and initialize one of the resources. In this example we will use the Transaction resource.
$transaction = new Transaction('API_KEY');
optinally, you can set the API key by calling the setApiKey
method on the resource like so;
$transaction->setApiKey('API_KEY');
Now you can create a transaction by calling the create method. The method signature is as following:
public function create(string $merchant_name, float $price, string $address, string $redirect_url, array $options);
Where the options are all the additional parameters as defined in the documentation. When taking this in account we can create a transaction like so;
$tx = $transaction->create( 'MNPY Store', 100, '0x960819D261AbaF8df1F7cc0b8Cb5CaA30410cC6f', 'https://mnpy.io/', [ 'fee' => 5, 'code' => 'VEN' ] );
If succesful, $tx
will now contain all the required transaction data.
To retrieve a transaction, you can simply do;
$tx = $transaction->get($tx->uuid); echo $tx->status;
License
BSD (Berkeley Software Distribution) License. Copyright © 2018 MNPY