MNPY - PHP API SDK
MNPY | Documentation, (*1)
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., (*2)
Requirements
It's easy to start using MNPY, you need;, (*3)
- PHP >7.0
- A MNPY account
- A Ethereum wallet, preferably ERC20 compliant
Installation
You are encouraged to install the PHP SDK using Composer., (*4)
$ composer require mnpy/mnpy-php-api-sdk
Optionally, you can checkout the git repository and manually load the required files., (*5)
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., (*6)
$transaction = new Transaction('API_KEY');
optinally, you can set the API key by calling the setApiKey
method on the resource like so;, (*7)
$transaction->setApiKey('API_KEY');
Now you can create a transaction by calling the create method. The method signature is as following:, (*8)
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;, (*9)
$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., (*10)
To retrieve a transaction, you can simply do;, (*11)
$tx = $transaction->get($tx->uuid);
echo $tx->status;
License
BSD (Berkeley Software Distribution) License. Copyright © 2018 MNPY, (*12)