Oxxo Pay

V1.1.0 now adds the Oxxo pay functionality.

To create a new order that shall be paid with Oxxo Pay, you have to create an order:

$order = $user->createOrder()->addProduct($product);Lenguaje del código: PHP (php)

And then, add the Oxxo pay as payment method:

$order->withOxxoPay();Lenguaje del código: PHP (php)

And finally, perform the charge:

$payment = $order->charge();Lenguaje del código: PHP (php)

This will return the same instance of \Danielmlozano\LaravelConekta\Payment class, only this time, you can access to the order reference for your customer:

$payment->__get(‘charges’)[0]->payment_method->reference;

Conekta webhook

When the customer pays the order in any Oxxo store, Conekta will send to your application the notification via webhook. LaravelConekta will handle this for you and will dispatch a \Danielmlozano\LaravelConekta\Events\ConektaOrderPaid event instance that holds the order property with the final ConektaOrder payment.

You can add a listener for this event:

<?php
 namespace App\Listeners;
 use Danielmlozano\LaravelConekta\Events\ConektaOrderPaid;

 class ConektaOrderPaidListener
 {
     /**
      * Create the event listener.
      *
      * @return void
      */
     public function __construct()
     {
         //
     }

    /**
      * Handle the event.
      *
      * @param  Danielmlozano\LaravelConekta\Events\ConektaOrderPaid  $event
      * @return void
      */
     public function handle(ConektaOrderPaid $event)
     {
         // $event->order->__get('id');
     }

 
 }Lenguaje del código: HTML, XML (xml)
Was this page helpful?
Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.