使用OmniPay的CodeIgniter自定义值 [英] CodeIgniter custom value with omnipay
问题描述
我正在尝试将自定义值传递给使用PayPal-OmniPay的付款
I'm trying to pass a custom value to a payment with PayPal - OmniPay
这是我使用的代码:
$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();
这是结帐页面上的代码:
And here is the code from checkout page :
$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>';
但是在数据打印数组中,我有很多信息,但没有有关"transactionID"或"custom"变量的信息.
But in the data printed array I've a lot of informations but no informations about "transactionID" or "custom" variable..
请帮助.谢谢
推荐答案
Omnipay/PayPal中没有custom
参数.
There is no such thing as a custom
parameter in Omnipay/PayPal.
您应该将此数据存储在数据库中,然后根据transactionId查找它.参数.
You should store this data in your database, then look it up based on the transactionId. parameter.
由于PayPal不会将其传递给您,因此最简单的解决方案是创建自定义returnUrl
.例如:
Since PayPal does not pass this back to you, the easiest solution is to create a custom returnUrl
. For example:
'returnUrl' => base_url().'checkout/confirm/'.$id,
然后,当客户登陆returnUrl时,您可以基于第3段(交易ID)从数据库中查找交易,并将其标记为已付款.
Then when your customer lands on the returnUrl, you can look up the transaction from your database based on segment 3 (the transaction ID), and mark it as paid.
这篇关于使用OmniPay的CodeIgniter自定义值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!