thephpleague / omnipay

A framework agnostic, multi-gateway payment processing library for PHP 5.6+
http://omnipay.thephpleague.com/
MIT License
5.94k stars 927 forks source link

PayU Issue : Call to a member function getBillingLastName() on null #421

Open ridislam opened 7 years ago

ridislam commented 7 years ago

$gateway = Omnipay::create('PayU'); $gateway->setMerchantId('JBZaLc'); $gateway->setSecretKey('GQs7yium'); $gateway->setTestMode(true);

              $params = [
                    'txnid'       => 'A_UNIQUE_TRANSACTION_ID',
                    'amount'      => 10.50,
                    'productinfo' => 'A book',
                    'firstname'   => 'Peter',
                    'email'       => 'abc@example.com',
                    'phone'       => '1234567890',
                    'returnUrl'        => route('invoice.cancel', $invoice->id),
                    'cancelUrl'        => route('invoice.success', $invoice->id),
                ];
         $gateway->purchase($params)->send();

                if ($response->isSuccessful()) {

// // payment was successful: update database dd("ok"); } elseif ($response->isRedirect()) { // redirect to offsite payment gateway $response->redirect(); } else { // payment failed: display message to customer echo $response->getMessage(); }

delatbabel commented 7 years ago

It's not clear from the above exactly where that happened.

The getBillingLastName() function is in the CreditCard class. Maybe a null card object is being used?

Also this is a problem with the gateway that you're using, not omnipay itself. Which fork of the PayU gateway are you using? Best raise this issue there.