PHP code example of davmixcool / coinpayments

1. Go to this page and download the library: Download davmixcool/coinpayments 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/ */

    

davmixcool / coinpayments example snippets


use Davmixcool\CoinPayments;

/** Scenario: Retrieve basic user account information.**/

try {
    $cps_api = new CoinPayments($private_key, $public_key, 'json');
    $information = $cps_api->GetBasicInfo();
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
    exit();
}

// Check for success of API call
if ($cps_api['error'] == 'ok') {
    // Prepare output

} else {
    // Throw an error if both API calls were not successful

}