I'm using coinpayments API to exchange cryptocurrency. Everything is working fine But I need to update payment status in my DB when transaction status is completed. I'm checking IPN History and it is showing correct URL of my script which handles the IPN data. Sent status is also "Yes" but it is not executing my script to update payment status in my DB.
I'm using LTCT coins for development and testing purposes. Not sure if this is causing the issue because it just testing currency. I cant check it with real currency yet. Here is my code.
require('./coinpayments.inc.php');
$cps = new CoinPaymentsAPI();
$cps->Setup('B2Ec451e6a2b0e47981336B8C63Da7f5630b613C54032198df5F807c77179eF2', 'c609b111559b6709054ea3f2f0ed300ea7932fe20c8d1f01b3bc189476e0c49c');
$req = array(
'amount' => 10.00,
'currency1' => 'USD',
'currency2' => 'LTCT',
'buyer_email' => 'email@gmail.com',
'item_name' => 'Test Item/Order Description',
'address' => '', // leave blank send to follow your settings on the Coin Settings page
'ipn_url' => 'http://btcmoney.rf.gd/ipn_handler.php',
'success_url' => 'http://btcmoney.rf.gd/success_handler.php',
);
// See https://www.coinpayments.net/apidoc-create-transaction for all of the available fields
$result = $cps->CreateTransaction($req);
if ($result['error'] == 'ok') {
$le = php_sapi_name() == 'cli' ? "
" : '<br />';
print 'Transaction created with ID: '.$result['result']['txn_id'].$le;
print 'Buyer should send '.sprintf('%.08f', $result['result']['amount']).' BTC'.$le;
print 'Status URL: '.$result['result']['status_url'].$le;
print 'Send to: '.$result['result']['address'].$le;
} else {
print 'Error: '.$result['error']."
";
}
When payment request is initiated using this code and user deposit LTCT into my wallet, it says "complete" status in coinpayments Dashboard. But IPN or success callback is not being executed. I really need to execute that script to update statuses in my DB.
To verify if script is being called or not. I'm creating a text file in that script and folder permissions are 777. Hitting that URL via web creates text field. But it should be called successfully from IPN callback.
Any help will be highly appreciated.
Regards.