HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dmstechonline/crm.chaitanyahospitalvirar.com/application/libraries/Billplz_lib.php
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
 
use Billplz\API;
use Billplz\Connect;

require_once(APPPATH . 'third_party/billplz/autoload.php');

class Billplz_lib {

    private $_CI;
    public $api_config;

    function __construct() {
        $this->_CI = & get_instance();
        $this->api_config = $this->_CI->paymentsetting_model->getActiveMethod();
    }

    public function payment($parameter, $optional,$api_key) {
        $connect = (new Connect($api_key))->detectMode();
        $connect->setMode(true); // true: production | false: staging (default)
        $billplz = new API($connect);
        
        $response = $billplz->createOpenCollection($parameter, $optional);

        if($response[0]==200){
            $payment_data=json_decode($response[1]);
            header("Location: $payment_data->url");
          
        }else{
            return ($response[1]);
        }

        }
}