CodeIgniter custom value with omnipay

限于喜欢 提交于 2020-01-05 04:11:08

问题


I'm trying to pass a custom value to a payment with PayPal - OmniPay

Here is the code I use :

$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>';

But in the data printed array I've a lot of informations but no informations about "transactionID" or "custom" variable..

Please help. Thanks


回答1:


There is no such thing as a custom parameter in Omnipay/PayPal.

You should store this data in your database, then look it up based on the transactionId. parameter.

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,

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.




回答2:


I think you should pass 'transactionID'=> $id, with capitals, instead of 'transactionid'=> $id,.



来源:https://stackoverflow.com/questions/24108899/codeigniter-custom-value-with-omnipay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!