问题
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