Php omnipay的CodeIgniter自定义值
我试图通过PayPal-OmniPay将自定义值传递给付款 以下是我使用的代码:Php omnipay的CodeIgniter自定义值,php,codeigniter,paypal,omnipay,Php,Codeigniter,Paypal,Omnipay,我试图通过PayPal-OmniPay将自定义值传递给付款 以下是我使用的代码: $response = $gateway->purchase( array( 'cancelUrl'=>base_url().'checkout/cancel', 'returnUrl'=>base_url().'checkout/confirm', 'amount' => number_format($retn['invoiceDa
$response = $gateway->purchase(
array(
'cancelUrl'=>base_url().'checkout/cancel',
'returnUrl'=>base_url().'checkout/confirm',
'amount' => number_format($retn['invoiceDatas']['price'], 2, '.', ''),
'description' => 'Facture #'.$id,
'currency' => 'EUR',
'transactionid'=> $id,
'custom' => $id,
'description' => 'Facture'
)
)->send();
$response->redirect();
以下是签出页面的代码:
$response = $gateway->completePurchase(array('amount' => 75.00, 'currency' => 'EUR'))->send();
$data = $response->getData(); // this is the raw response object
echo '<pre>';
print_r($data);
echo '</pre>';
$response=$gateway->completePurchase(数组('amount'=>75.00,'currency'=>'EUR'))->send();
$data=$response->getData();//这是原始响应对象
回声';
打印(数据);
回声';
但是在数据打印数组中,我有很多信息,但没有关于“transactionID”或“custom”变量的信息
请帮忙。谢谢我想你应该用大写字母传递
'transactionID'=>$id,
,而不是'transactionID'=>$id,
在Omnipay/PayPal中没有自定义的参数
您应该将此数据存储在数据库中,然后根据transactionId进行查找。参数
由于PayPal不会将此返回给您,因此最简单的解决方案是创建一个自定义的returnUrl
。例如:
然后,当您的客户登录returnUrl时,您可以根据第3段(交易ID)从数据库中查找交易,并将其标记为已支付。现在我遇到了“致命错误:未捕获异常‘Omnipay\Common\exception\RuntimeException’,消息为‘此响应不支持重定向。’我不明白你的问题是什么。你的代码看起来不错。贝宝付款成功吗?好主意!谢谢你:)
'returnUrl' => base_url().'checkout/confirm/'.$id,