Usage of Paybox System

The bundle includes a sample controller SampleController.php with two actions.

...useSymfony\Component\Routing\Generator\UrlGeneratorInterface;/** * Sample action to call a payment. * It create the form to submit with all parameters.*/publicfunctioncallAction(){$paybox=$this->get('lexik_paybox.request_handler');$paybox->setParameters(array('PBX_CMD'=>'CMD'.time(),'PBX_DEVISE'=>'978','PBX_PORTEUR'=>'test@paybox.com','PBX_RETOUR'=>'Mt:M;Ref:R;Auto:A;Erreur:E','PBX_TOTAL'=>'1000','PBX_TYPEPAIEMENT'=>'CARTE','PBX_TYPECARTE'=>'CB','PBX_EFFECTUE'=>$this->generateUrl('lexik_paybox_sample_return', array('status'=>'success'), UrlGeneratorInterface::ABSOLUTE_URL),'PBX_REFUSE'=>$this->generateUrl('lexik_paybox_sample_return', array('status'=>'denied'), UrlGeneratorInterface::ABSOLUTE_URL),'PBX_ANNULE'=>$this->generateUrl('lexik_paybox_sample_return', array('status'=>'canceled'), UrlGeneratorInterface::ABSOLUTE_URL),'PBX_RUF1'=>'POST','PBX_REPONDRE_A'=>$this->generateUrl('lexik_paybox_ipn', array('time'=>time()), UrlGeneratorInterface::ABSOLUTE_URL), ));return$this->render('LexikPayboxBundle:Sample:index.html.twig',array('url'=>$paybox->getUrl(),'form'=>$paybox->getForm()->createView(), ) );}.../** * Sample action of a confirmation payment page on witch the user is sent * after he seizes his payment informations on the Paybox's platform. * This action must only containts presentation logic.*/publicfunctionresponseAction($status){return$this->render('LexikPayboxBundle:Sample:return.html.twig',array('status'=>$status,'parameters'=>$this->getRequest()->query, ) );}...

The getUrl() method silently does a server check and throws an exception if the destination server does not respond.

The payment confirmation in your business logic must be done when the instant payment notification (IPN) occurs.
The plugin contains a controller with an action that manages this IPN and triggers an event.
The event contains all data transmetted during the request and a boolean that tells if signature verification was successful.

The bundle contains a listener example that simply create a file on each ipn call.