mike182uk / paypal-ipn-listener

A PayPal IPN (Instant Payment Notification) listener for PHP
MIT License
89 stars 31 forks source link

I can´t get running #5

Closed zamarrong closed 10 years ago

zamarrong commented 10 years ago

Hello i have a problem with this, i dont know if the listener are working im using Laravel 4.1 and my code is this: I have a route like this: Route::post('pago/paypal', array('uses' => 'PagosController@pagopp')); And in my controller i have this: public function pagopp(){

    $request = new PayPal\Ipn\Request\Curl();

    $listener = new PayPal\Ipn\Listener($request);

    $listener->setMode('sandbox');

    try {
        $status = $listener->verifyIpn();
    }
    catch (Exception $e) {
        $error = $e->getMessage();
        $status = false;
    }

    if ($status) {
        $data = $_POST;
        $id_cotizacion = $data['item_number'];
        $cantidad =  $data['mc_gross'];
        $pago = new Pago;
        $pago->movimiento = $data['txn_id'];
        $pago->id_cliente = $data['custom'];
        $pago->id_cotizacion =  $id_cotizacion;
        $pago->cantidad =  $cantidad
        $pago->save();
        $cotizacion = Cotizacion::find($id_cotizacion);
        $cotizacion->saldo = $cotizacion->saldo - $cantidad);
        if (($cotizacion->saldo - $cantidad) <= 0) {
            $cotizacion->estado = 'C';
        }
        $cotizacion->save();
    } else {
        $report = $listener->getReport();
    }

}

but nothing hapen y checked the ipn request from ipn history in my sandbox account and all the fields are fine.

mike182uk commented 10 years ago

@zamarrong is there an exception being thrown? if so what is the value of $e->getMessage(). Also what is the value of $listener->getReport()? That method should contain details of the request / response.

zamarrong commented 10 years ago

Where are saved the errors or the reports from the ipn listener?

mike182uk commented 10 years ago

@zamarrong see the last paragraph of the readme. Log::info($listener->getReport());?

zamarrong commented 10 years ago

yes i read the documentation, i cant make works and i dont know whats happend in the ipn i send a eCheck complete ipn but this say: We're sorry, we could not send an IPN.

mike182uk commented 10 years ago

@zamarrong Unfortunately, if you cant get the output of $e->getMessage() or $listener->getReport() i cannot help you any further. Either log these to a file or email them yourself from your controller.