How to configure the CONFIRMATION path of Payu to update a database with PHP - LARAVEL?

0

I'm integrating the PAYU payment gateway webcheckout.

I can now send the purchase data to the payu platform through the form provided by payu webcheckout in the documentation. It's the next ...

<form method="post" action="https://sandbox.checkout.payulatam.com/ppp-web-gateway-payu/">
  <input name="merchantId"    type="hidden"  value="{{ $dataPayu['merchantId'] }}">
  <input name="accountId"     type="hidden"  value="{{ $dataPayu['accountId'] }}" >
  <input name="description"   type="hidden"  value="{{ $dataPayu['description'] }}">
  <input name="referenceCode" type="hidden"  value="{{ $dataPayu['referenceCode'] }}" >
  <input name="amount"        type="hidden"  value="{{ $dataPayu['amount'] }}"   >
  <input name="tax"           type="hidden"  value="{{ $dataPayu['tax'] }}"  >
  <input name="taxReturnBase" type="hidden"  value="{{ $dataPayu['taxReturnBase'] }}" >
  <input name="currency"      type="hidden"  value="{{ $dataPayu['currency'] }}" >
  <input name="signature"     type="hidden"  value="{{ $dataPayu['signature'] }}"  >
  <input name="test"          type="hidden"  value="{{ $dataPayu['test'] }}" >
  <input name="buyerFullName" type="hidden"  value="{{ $dataPayu['buyerFullName'] }}" >
  <input name="buyerEmail"    type="hidden"  value="{{ $dataPayu['buyerEmail'] }}" >
  <input name="telephone"    type="hidden"  value="{{ $dataPayu['telephone'] }}" >
  <input name="shippingAddress" type="hidden"  value="{{ $dataPayu['shippingAddress'] }}" >
  <input name="shippingCity"  type="hidden"  value="{{ $dataPayu['shippingCity'] }}" >
  <input name="shippingCountry" type="hidden"  value="{{ $dataPayu['shippingCountry'] }}" >
  <input name="responseUrl"   type="hidden"  value="{{ $dataPayu['responseUrl'] }}" >
  <input name="confirmationUrl" type="hidden"  value="{{ $dataPayu['confirmationUrl'] }}" >

  <section class="payment_proceso_tarjeta tarjeta_form_btn_payu">
     <button type="submit" class="btn_datos_envio">
        Pagar con 
        <img class="logo_payu" src="{{ asset('img/logos/payu.png')}}">
     </button>
  </section> 

This is my routes in Laravel.

Route::post('/confirmation', 'ConfirmationController@confirmation');

It is assumed that when payu finishes processing the payment, it sends me the confirmation data to that POST-type route, that data I capture from the ConfirmationController with the confirmation ... method as well.

 public function confirmation(Request $request) {
     //Obtengo todos los datos aqui..

     $state_pol      = $request['state_pol'];

     // Verificao el estado de la compra para hacer la insercion en la base de datos

     if($state_pol == 4) {
        App\Producto::create([
            'id_categoria' => 1,
            'descripcion' => 'PRUEBA',
            'tags' => 'PRUEBA, PRUEBA',
            'referencia' => 'PRUEBA',
            'imagen' => 'PRUEBA',
            'precio' => 0,
            'descuento' => 0,
            'tallas' => 'PRUEBA',
            'colores' => 'PRUEBA',
            'tiempo_entrega' => 'PRUEBA',
            'imagenDescripcion' => 'PRUEBA',
            'cant_disponible' => 0,
            'fecha_creado' => 'PRUEBA'
        ]);
    }
 }

I'm supposed to insert it with that, but it's not like that, I do not know what the problem is. Can you help me?

    
asked by Odannys De La Cruz 29.10.2018 в 20:47
source

0 answers