<?php

require '../src/coinPayments/coinPayments.class.php';
// test httpauth and hmac then publish to github bb
// You need to set a callback URL if you want the IPN to work
$callbackUrl = '';
// Create an instance of the class
$CP = new \MineSQL\coinPayments();
// Set the merchant ID and secret key (can be found in account settings on CoinPayments.net)
$CP->setMerchantId('');
$CP->setSecretKey('');
// Create a payment button with item name, currency, cost, custom variable, and the callback URL
$form = $CP->createPayment('Test Product', 'btc', 5.0E-5, '123', $callbackUrl);
// Display the button
echo $form;
Exemple #2
0
<?php

require '../src/coinPayments/coinPayments.class.php';
$CP = new \MineSQL\coinPayments();
// Set your Merchant ID
$CP->setMerchantId('');
// Set your secret IPN Key (in Account Settings on Coinpayments)
$CP->setSecretKey('');
// Payment Validator. Usually you would call this
// from a database to fetch the billing information based on the $_POST['custom'] variable
//
if ($CP->validatePayment(5.0E-5, 'btc')) {
    // The payment is successful and passed all security measures
}
// The payment for some reason did not successfully complete
// All the errors generated are gathered into an array and can be accessed by $CP->getErrors();
$file = fopen("ipn_log.txt", 'w');
fwrite($file, print_r($CP->getErrors()));
fclose($file);