1

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

2 Answers2

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.

Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70
0

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

MacEncrypted
  • 184
  • 9
  • 1
    Now I have "Fatal error: Uncaught exception 'Omnipay\Common\Exception\RuntimeException' with message 'This response does not support redirection.' in " – user3720154 Jun 08 '14 at 17:56