Welcome Guest, Not a member yet? Register   Sign In
CoinpaymentsAPI
#1

hello . I am presenting a problem since when activating a Coinpayment library I am carrying out the process but it throws me error # 64 I am using it with the manual but it throws me the same error

PHP Code:
<?php

namespace App\Controllers\Admin;

use 
App\Controllers\BaseController;
use 
App\Libraries\coinpayments\src\CoinpaymentsAPI;

class 
Prueba extends BaseController
{
    public function index()
    {
        $private_key '94CF8xxxxxxxxxxxxxxxxxxxxxxxx';
        $public_key '57cd7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
      
        
try {
            $cps_api = new CoinpaymentsAPI($private_key$public_key'json');
            $information $cps_api->GetBasicInfo();
        } catch (Exception $e) {
            echo 'Error: ' $e->getMessage();
            exit();
        }
        
    
}

ErrorException #64
Cannot declare class CoinpaymentsAPI, because the name is already in use
APPPATH\Libraries\coinpayments\src\CoinpaymentsAPI.php at line 23
Code:
16  *
17  * The commands for converting coins and getting coin conversion information rely on mainnet transactions of a
18  * non-testing currency and are excluded from the capabilities of LTCT in the CoinPayments API.
19  *
20  * $PayByName tag commands also rely on having available or claimed tags on the production CoinPayments.net website to
21  * manipulate.
22  */
23 class CoinpaymentsAPI
24 {
25     private $private_key = '';
26     private $public_key = '';
27     private $request_handler;
28     private $format;
29
30     /**
Reply
#2

PHP Code:
use App\Libraries\coinpayments\src\CoinpaymentsAPI
This means that the class not only needs to be in this path, but also has a corresponding namespace.

It looks like you are using an official API wrapper.
You need to use loading via classmap.
PHP Code:
public $classmap = [
        
'CoinpaymentsAPI' => APPPATH 'Libraries/coinpayments/src/CoinpaymentsAPI.php',
    ]; 

PHP Code:
use  CoinpaymentsAPI;
....
new 
CoinpaymentsAPI(...); 
Reply
#3

(01-12-2022, 12:24 AM)iRedds Wrote:
PHP Code:
use App\Libraries\coinpayments\src\CoinpaymentsAPI
This means that the class not only needs to be in this path, but also has a corresponding namespace.

It looks like you are using an official API wrapper.
You need to use loading via classmap.
PHP Code:
    public $classmap = [
        'CoinpaymentsAPI' => APPPATH 'Libraries/coinpayments/src/CoinpaymentsAPI.php',
    ]; 

PHP Code:
use  CoinpaymentsAPI;
....
new 
CoinpaymentsAPI(...); 
Thanks for the answer that was the only thing I was missing the classmap Smile
Reply
#4

(01-12-2022, 12:24 AM)iRedds Wrote:
PHP Code:
use App\Libraries\coinpayments\src\CoinpaymentsAPI
This means that the class not only needs to be in this path, but also has a corresponding namespace.

It looks like you are using an official API wrapper.
You need to use loading via classmap.
PHP Code:
    public $classmap = [
        'CoinpaymentsAPI' => APPPATH 'Libraries/coinpayments/src/CoinpaymentsAPI.php',
    ]; 

PHP Code:
use  CoinpaymentsAPI;
....
new 
CoinpaymentsAPI(...); 


question to upload to localhost works without problem but when uploading from a server it throws an error Class 'CoinpaymentsAPN' not found


public $classmap = [
        'CoinpaymentsAPN' => APPPATH .'Libraries\coinpayments\src\CoinpaymentsAPI.php'
    ];


<?php

namespace App\Controllers;
use App\Controllers\BaseController;
use CoinpaymentsAPN;

Error
Class 'Coinpaymentsapn' not found
APPPATH/Controllers/Dashboard.php at line 300


Code:
300                         $cps_api = new Coinpaymentsapn($private_key, $public_key, 'json');

Reply
#5

Coinpaymentsapn !== CoinpaymentsAPN !== CoinpaymentsAPI
Reply
#6

(02-08-2022, 08:08 PM)iRedds Wrote: Coinpaymentsapn !== CoinpaymentsAPN !== CoinpaymentsAPI
I already changed it to

public $classmap = [
        'Coinpayments' => APPPATH .'Libraries\coinpayments\src\Coinpayments.php'
    ];



<?php

namespace App\Controllers;
use App\Controllers\BaseController;
use \Coinpayments;

class Dashboard extends BaseController
{




$cps_api = new Coinpayments($private_key, $public_key, 'json');



Error
Class 'Coinpayments' not found search →
APPPATH/Controllers/Dashboard.php at line 300

same error
Reply
#7

(02-08-2022, 05:36 PM)Z4K7 Wrote:
(01-12-2022, 12:24 AM)iRedds Wrote:
PHP Code:
use App\Libraries\coinpayments\src\CoinpaymentsAPI
This means that the class not only needs to be in this path, but also has a corresponding namespace.

It looks like you are using an official API wrapper.
You need to use loading via classmap.
PHP Code:
    public $classmap = [
        'CoinpaymentsAPI' => APPPATH 'Libraries/coinpayments/src/CoinpaymentsAPI.php',
    ]; 

PHP Code:
use  CoinpaymentsAPI;
....
new 
CoinpaymentsAPI(...); 


question to upload to localhost works without problem but when uploading from a server it throws an error Class 'CoinpaymentsAPN' not found


public $classmap = [
        'CoinpaymentsAPN' => APPPATH .'Libraries\coinpayments\src\CoinpaymentsAPI.php'
    ];


<?php

namespace App\Controllers;
use App\Controllers\BaseController;
use CoinpaymentsAPN;

Error
Class 'Coinpaymentsapn' not found
APPPATH/Controllers/Dashboard.php at line 300


Code:
300                         $cps_api = new Coinpaymentsapn($private_key, $public_key, 'json');



In a server make sure
Code:
Capital later Small Later Cp(sensitive)
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#8

What is the name of the class in the library file?
Reply
#9

(This post was last modified: 02-10-2022, 03:42 PM by Z4K7.)

(02-09-2022, 03:40 AM)iRedds Wrote: What is the name of the class in the library file?
[*]app /
[*]Librarie... /
[*]coinpayments

(02-10-2022, 03:26 PM)Z4K7 Wrote:
(02-09-2022, 03:40 AM)iRedds Wrote: What is the name of the class in the library file?
[*]app /
[*]Librarie... /
[*]coinpayments
[*]

This is the result, the only thing I changed was the ThirdParty folder

been ok
Reply




Theme © iAndrew 2016 - Forum software by © MyBB