PHP code example of rinzlerch / omnipay-coinpayments

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

    

rinzlerch / omnipay-coinpayments example snippets


$gateway = Omnipay::create('Coinpayments');

$gateway->initialize(array(
    'publicKey' => '',
    'privateKey => ''
));

$response = $gateway->transaction([
    'amount' => 10.00,
    'currency1' => 'USD',
    'currency2' => 'BTC',
    //'address' => '', // leave blank send to follow your settings on the Coin Settings page
    'item_name' => 'Test Item/Order Description',
    'ipn_url' => 'https://yourserver.com/ipn_handler.php',
])->send();

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

$gateway = Omnipay::create('Coinpayments');

$gateway->initialize(array(
    'publicKey' => '',
    'privateKey => ''
));

$response = $gateway->withdrawal([
    'amount' => 0.1,
    'currency' => 'BTC',
    'address' => '1LC9Tn7ekRXhMTzh7ZJnZ55XUBM4ZGuLhJ'
])->send();

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