PHPackages                             yorchi/laravel-conekta-webhooks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. yorchi/laravel-conekta-webhooks

ActiveLibrary

yorchi/laravel-conekta-webhooks
===============================

Package for handling Conekta webhooks API

v1.0.0(7y ago)11861[1 PRs](https://github.com/Yorchi/laravel-conekta-webhooks/pulls)MITPHPPHP ^7.1

Since Apr 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Yorchi/laravel-conekta-webhooks)[ Packagist](https://packagist.org/packages/yorchi/laravel-conekta-webhooks)[ Docs](https://github.com/yorchi/laravel-conekta-webhooks)[ RSS](/packages/yorchi-laravel-conekta-webhooks/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

Handle Conekta webhooks in a Laravel application
================================================

[](#handle-conekta-webhooks-in-a-laravel-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3689668da0f1f2e76377896bd8a9d65660932277feae9d2b270367f1b8d332fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796f726368692f6c61726176656c2d636f6e656b74612d776562686f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yorchi/laravel-conekta-webhooks)[![Build Status](https://camo.githubusercontent.com/059b7fdb3c0fb07d89da26f6492905c835d00306c36e56947dd5208b8919a8de/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f796f726368692f6c61726176656c2d636f6e656b74612d776562686f6f6b732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/yorchi/laravel-conekta-webhooks)[![Quality Score](https://camo.githubusercontent.com/74682d8d6dd81fcff50c9355361c2266cd9dc8c66de22f591a941d679915717f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f796f726368692f6c61726176656c2d636f6e656b74612d776562686f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yorchi/laravel-conekta-webhooks)[![Total Downloads](https://camo.githubusercontent.com/9708abc1fab3576587acefe52a91fd68304e983423adc1ea256f425f5c12767f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796f726368692f6c61726176656c2d636f6e656b74612d776562686f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yorchi/laravel-conekta-webhooks)

*Conekta* can notify your application of events using webhooks. This package can help you handle those webhooks. You can easily define jobs or events that should be dispatched when specific events hit your app.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require yorchi/laravel-conekta-webhooks
```

The service provider will automatically register itself.

You must publish the config file with:

```
$ php artisan vendor:publish --provider="\Yorchi\LaravelConektaWebhooks\LaravelConektaWebhooksServiceProvider" --tag="config"
```

This is the content of the config file that will be published ar `config/conekta-webhooks.php`:

```
return [
    /*
     * Here you can define the job that should be run when a certain webhook hits your
     * application.
     *
     * You can find a list of Conekta webhook types here:
     * https://developers.conekta.com/api#events
     */
    'jobs' => [
        // 'chargeCreated' => \App\Jobs\LaravelWebhooks\HandleCreatedCharge::class,
        // 'chargePaid' => \App\Jobs\LaravelWebhooks\HandlePaidCharge::class,
        // ...
    ],
];
```

Finally, take care of the routing: At the Conekta notification settings you must configure at what url Conekta webhooks should hit your app. In the routes file of your app you must pass that route to `Route::conektaWebhooks`:

```
Route::conektaWebhooks('webhook-route-configured-at-the-conekta-dashboard');
```

Behind the scenes this will register a *POST* route to a controller provided by this package. Because Conekta has no way of getting a csrf-token, you must add that route to the *except* array of the *VerifyCsrfToken* middleware:

```
protected $except = [
    'webhook-route-configured-at-the-conekta-dashboard',
];
```

Usage
-----

[](#usage)

Conekta will send out webhooks for several event types. You can find the full list of events types in the Conekta documentation.

Unless something wrong, this package will respond with a 200 to webhook requests. Sending a 200 will prevent Conekta from resending the same event again.

There are two ways this package enables you to handle webhook requests: you can opt to queue a job or listen to the events the package will fire.

Handling webhook requests using jobs
------------------------------------

[](#handling-webhook-requests-using-jobs)

```
namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Yorchi\LaravelConektaWebhooks\ConektaWebhookCall;

class HandleCreatedCharge implements ShouldQueue
{
    use InteractsWithQueue, Queueable, SerializesModels;

    /** @var  \Yorchi\LaravelConektaWebhooks\ConektaWebhookCalll */
    public $webhookCall;

    public function __construct(ConektaWebhookCalll $webhookCall)
    {
        $this->webhookCall = $webhookCall;
    }

    public function handle()
    {
        // do your work here

        // you can access the payload of the webhook call with $this->webhookCall->payload
    }
}
```

We highly recommend that you make this job queueable, because this will minimize the response time of the webhook requests. This allows you to handle more oh dear webhook requests and avoid timeouts.

After having created your job you must register it at the jobs array in the conekta-webhooks.php config file. The key should be the name of the conekta event type. The value should be the fully qualified classname.

```
// config/conekta-webhooks.php

'jobs' => [
    'chargeCreated' => \App\Jobs\ConektaWebhooks\HandleCreatedCharge::class,
],
```

**Note**: The event type who Conekta send out is `charge.created`, all the event types, qill be converted to camelCase strings.

Handling webhook requests using events
--------------------------------------

[](#handling-webhook-requests-using-events)

Instead of queueing jobs to perform some work when a webhook request comes in, you can opt to listen to the events this package will fire. Whenever a valid request hits your app, the package will fire a conekta-webhooks:: event.

The payload of the events will be the instance of ConektaWebhookCalll that was created for the incoming request.

Let's take a look at how you can listen for such an event. In the EventServiceProvider you can register listeners.

```
/**
 * The event listener mappings for the application.
 *
 * @var  array
 */
protected $listen = [
    'conekta-webhooks::chargeCreated' => [
        App\Listeners\MailOperators::class,
    ],
];
```

Here's an example of such a listener:

```
namespace App\Listeners;

use Illuminate\Contracts\Queue\ShouldQueue;
use Yorchi\LaravelConektaWebhooks\ConektaWebhookCall;

class MailOperators implements ShouldQueue
{
    public function handle(ConektaWebhookCalll $webhookCall)
    {
        // do your work here

        // you can access the payload of the webhook call with `$webhookCall->payload`
    }
}
```

We highly recommend that you make the event listener queueable, as this will minimize the response time of the webhook requests. This allows you to handle more Oh Dear webhook requests and avoid timeouts.

Using the ConektaWebhookCalll
-----------------------------

[](#using-the-conektawebhookcalll)

Like mentioned above your events or jobs will receive an instance of `Yorchi\LaravelConektaWebhooks\ConektaWebhookCall`

You can access the raw payload by calling:

```
$webhookCall->payload; // returns an array;
```

Or you can opt to get more specific information:

```
$webhookCall->rawType(); // returns the type of the webhook (eg: 'charge.created');
$webhookCall->type(); // returns the parsed type of the webhook (eg: 'chargeCreated');
$webhookCall->data(); // returns an array with all the data of the event;
$webhookCall->object(); // returns an array with all the attribute of the current object (eg: 'charge');
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jorge Andrade](https://github.com/yorchi)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2588d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5d0f7ef298a8212f962af789337d790ba61cf2d849609c66618ec86ad2422bb7?d=identicon)[Yorchi](/maintainers/Yorchi)

---

Top Contributors

[![Yorchi](https://avatars.githubusercontent.com/u/4969895?v=4)](https://github.com/Yorchi "Yorchi (3 commits)")

---

Tags

conektalaravelwebhooksconektayorchilaravel-conekta-webhooks

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yorchi-laravel-conekta-webhooks/health.svg)

```
[![Health](https://phpackages.com/badges/yorchi-laravel-conekta-webhooks/health.svg)](https://phpackages.com/packages/yorchi-laravel-conekta-webhooks)
```

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[konekt/html

HTML and Form Builders for the Laravel Framework

24403.2k5](/packages/konekt-html)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
