Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Ci商户-自动调整大小并稍后使用PayPal Express捕获付款_Php_Codeigniter_Codeigniter 2_Ci Merchant - Fatal编程技术网

Php Ci商户-自动调整大小并稍后使用PayPal Express捕获付款

Php Ci商户-自动调整大小并稍后使用PayPal Express捕获付款,php,codeigniter,codeigniter-2,ci-merchant,Php,Codeigniter,Codeigniter 2,Ci Merchant,我目前正在为一个网站构建一个非现场支付解决方案。我正在使用CI Merchant(我尝试使用Omnipay,但使用Composer对我不起作用) 我目前正在这样做(在我的控制器的方法)。还请注意,我使用了一个经过调整的CI Merchant版本,允许向PayPal发送客户的购物车。我只是做了这些改变: 在我的控制器文件中: //The library and the settings are initialized before $this->merchant->initialize

我目前正在为一个网站构建一个非现场支付解决方案。我正在使用CI Merchant(我尝试使用Omnipay,但使用Composer对我不起作用)

我目前正在这样做(在我的控制器的方法)。还请注意,我使用了一个经过调整的CI Merchant版本,允许向PayPal发送客户的购物车。我只是做了这些改变:

在我的控制器文件中:

//The library and the settings are initialized before
$this->merchant->initialize($this->APISettings);

$order = array(
           array(
              'name' => 'Voyage 1',
              'desc' => 'Relais du Plessis',
              'amt' => 50.00,
              'qty' => 1
           ),
           array(
              'name' => 'Voyage 2',
              'desc' => 'Domaine St-Hilaire',
              'amt' => 50.00,
              'qty' => 1
           )
);

$this->session->set_userdata('order',$order);

$params = array(
            'amount' => 100.00,
            'currency' => 'EUR',
            'items' => $order,
            'return_url' => base_url().'api/reservation/validation_commande',
            'cancel_url' => base_url().'api/reservation/annulation_commande'
);

$this->merchant->authorize($params);
稍后,在我的控制器的另一种方法中(付款完成时调用的方法,返回url):

我想要的只是在卡片上留下一个脚印,这就是为什么我要得到参考资料

问题是,如果我想稍后捕获付款,我该怎么做?我知道要调用的方法是$this->merchant->capture();但我不知道在参数中传递什么

提前感谢,


干杯

好的,没关系。我成功地安装了Omnipay(这是一个非常好的库),为此,我只需获得$params数组,我通过

$response->getTransactionReference();
那么你只需要打电话:

$response = $gateway->capture($params)->send();

回复是好的

叶:没错。CI merchant的工作方式基本相同,您可以获得$response->reference(),并将其传递给$gateway->capture()。但是使用Omnipay是一个更好的主意,不再支持CI merchant。感谢Adrian提供的这些很棒的库,并感谢您的批准。
$response = $gateway->capture($params)->send();