我目前正在建立一个网站的非现场支付解决方案。我使用CI-Merchant (我尝试使用Omnipay,但使用Composer对我不起作用)。
我目前正在做这件事(在我的控制器的一个方法中)。还请注意,我使用的是CI-Merchant的调整版本,以允许将客户的购物车发送到PayPal。我只做了以下更改:https://github.com/guillermofr/ci-merchant/commit/70ea1a2864971078b3b67e5ca1051be174f23fa0
在我的控制器文件中:
//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);稍后,在我的控制器的另一个方法(付款完成时调用的方法,即return_url)中:
$this->merchant->initialize($this->APISettings);
$params = array(
'amount' => 100.00,
'currency' => 'EUR',
'items' => $this->session->userdata('order'),
'return_url' => base_url().'api/reservation/validation_commande',
'cancel_url' => base_url().'api/reservation/annulation_commande'
);
$response = $this->merchant->authorize_return($params);
var_dump($response);
$gateway_reference = $response->reference();我想要的只是保留卡片的足迹,所以这就是为什么我得到了参考资料。
问题是,如果我想稍后获取付款,我该如何做?我知道要调用的方法是$this->merchant->capture();但我不知道要在参数中传递什么。
提前谢谢你,
干杯
发布于 2013-07-18 17:25:20
好吧,不要紧。我成功地安装了Omnipay (这是一个非常好的库),为此,我简单地获得了$params数组,并将transactionReference通过
$response->getTransactionReference();然后你只需要调用:
$response = $gateway->capture($params)->send();而且响应也是正常的!
https://stackoverflow.com/questions/17676031
复制相似问题