omnipay
omnipay copied to clipboard
PayU Issue : Call to a member function getBillingLastName() on null
$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' => '[email protected]',
'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(); }
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.