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

1
  • I don't understand what your problem is. Your code looks fine. Does paypal make the payment successfully? Jun 15, 2014 at 20:31

2 Answers 2

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.

0
0

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

1
  • 1
    Now I have "Fatal error: Uncaught exception 'Omnipay\Common\Exception\RuntimeException' with message 'This response does not support redirection.' in " Jun 8, 2014 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.