Download the PHP package coinpaymentsnet/coinpayments-php without Composer
On this page you can find all versions of the php package coinpaymentsnet/coinpayments-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Short Description A PHP wrapper for the CoinPayments.net v1 API.
All versions of coinpayments-php with dependencies
Informations about the package coinpayments-php
CoinPayments.net PHP API Wrapper.
It's recommended to use a newer version of PHP. This library was written in a PHP v7.2.8-1+ environment. The minimum version we've tested the code against is PHP v 5.5+. Our PHP version compatibility test used a combination of PHP CodeSniffer and PHP Compatability.
A CoinPayments.net account with an API keys pair setup (public & private). For the latest instructions visit our online API documentation to learn how to setup your API Keys and get a link to your account API Keys page.
See the testing section below for additional requirements to test certain commands with LTCT or mainnet coins.
Note this wrapper assumes the format requested for API responses is JSON. The alternative is XML but the XML format is not documented or supported by this wrapper. By default every API call will return JSON unless otherwise specified.
This CoinPayments.net API wrapper can be downloaded directly or cloned with GitHub. To use it in your project either clone this repository or download a ZIP to the directory of your choosing.
The minimum files required for usage are those in the source folder,
CoinpaymentsCurlRequest.php. A 4th required file for usage of predefined API keys and testing variables is
keys.php. There is a
keys_example.php file which can be populated and renamed to
keys.php. This keys file is used to pass your public and private API keys to the wrapper in order to make calls to the Coinpayments.net Platform. You can also manually pass your keys to the
CoinpaymentsAPI class if you prefer, instead of using a
keys.php file. The
keys.php file should be placed in the
To install with composer run the following command
composer require coinpaymentsnet/coinpayments-php
and then include the following line in your project where you want to use the wrapper's classes.
/examples directory does not use composer autoloading.
When using composer to autoload classes you should define your
keys.php file outside of your
vendor directory, as not to overwrite it when upgrading packages. See src/keys_example.php as an example
Previewing the scripts in the
/examples directory in your browser is possible once you have setup the public and private keys in the
keys.php file. This obviously requires the ability to serve these example PHP files with a web server like Apache. See additional testing notes below for interacting with these examples and your account. Some examples require you to populate initial variables in the example file in order to execute the scripts found within.
The simplest example is retrieving basic account information.
A full population of the
keys.php file is required in order to run the
PHPUnit tests in the test folder and preview the scripts in the
/examples directory. The different requirements for testing commands are described below with the commands shown in the format:
With only the public and private keys populated, the following commands can be tested. Balances and deposit addresses require their respective resources to have been deposited (funds), updated (coin acceptance settings) or created (addresses) on your CoinPayments.net account in order for their commands to return non-empty results.
Note that the
get_callback_address command and functions above would also need an
IPN URL setup in your account or passed with the command should you wish to test your server being notified of payment to the returned address. More information is available here in our documentation for the Instant Payment Notification (IPN) system.
The additional variables (those below the API keys) require setting up a second developer CoinPayments.net account to test the following commands, assuming the currency is LTCT. Alternatively these commands could also be tested with access other addresses or wallets capable of receiving and sending the currency you are testing with, as long as that currency is supported by the CoinPayments.net platform. See supported coins here.
CreateMassWithdrawal()* using address only, not
$PayByName, see below.
Currently our API does not allow for testing of the coin conversion or
$PayByNamecommands without access to production assets, so the following commands do require production environment data on the platform to be available. For example, unclaimed and claimed
$PayByNametags or currency in two convertible coins. These tests have been run by our development team with the production environment data (assets) to include these commands in code testing coverage. It is still recommended these commands be tested with the production environment before being published as part of any integration. This would require small amounts of mainnet coins for converting and the purchase of at least one
$PayByNametag to claim, send funds to and retrieve information on (for the testing of all possible commands).
$PayByNameinstead of address
To run the tests from the /tests directory, run this command:
with your chosen flags for output type. Alternatively you can configure an IDE, like PHPStorm to run the tests in
CoinpaymentsAPITest.php for you. In development of this wrapper we used PHPUnit v7.3.1.
Test transactions done with any mainnet coin incur regular transaction and network fees, which is why we highly recommend using LiteCoin Testnet (LTCT) when testing your API integration.
If during your work with this wrapper you encounter a bug or have a suggestion to help improve it for others, you are welcome to open a Github issue on this repository and it will be reviewed by one of our development team members. The CoinPayments.net bug bounty does not cover this wrapper.
MIT - see LICENSE.md