PHPackages                             zampou/cinetpay - 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. [Payment Processing](/categories/payments)
4. /
5. zampou/cinetpay

ActiveLibrary[Payment Processing](/categories/payments)

zampou/cinetpay
===============

CinetPay laravel package

1.0.0(3y ago)012MITPHP

Since Dec 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/zampou-spec/cinetpay)[ Packagist](https://packagist.org/packages/zampou/cinetpay)[ RSS](/packages/zampou-cinetpay/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Laravel CinetPay
================

[](#laravel-cinetpay)

### Installation

[](#installation)

```
composer require zampou/cinetpay

```

### 1. Installation du Service Provider

[](#1-installation-du-service-provider)

Tous les fournisseurs de services sont enregistrés dans le fichier de configuration suivant `config/app.php`.

```
'providers' => [
    /*
    * Package Service Providers...
    */
    Zampou\CinetPay\Providers\CinetPayProvider::class,
],
```

### 2. Configurer

[](#2-configurer)

Configuration du fichier `.env`

```
CINETPAY_SITE_ID=votre_site_id
CINETPAY_API_KEY=votre_cle_api

```

*Exécutez `php artisan vendor:publish --provider="Zampou\CinetPay\Providers\CinetPayProvider" --tag="cinetpay"` pour le fichier de configuration complet.*

Config : `config/cinetpay.php`

```
return [
    'CINETPAY_API_KEY' => env('CINETPAY_API_KEY'),
    'CINETPAY_SITE_ID' =>  env('CINETPAY_SITE_ID')
];
```

### 3. IPN et CSRF Token

[](#3-ipn-et-csrf-token)

Désactiver la vérification CSRF sur la route ipn de CinetPay, toutes les routes excluent sont dans le fichier suivant `app/Http/Middleware/VerifyCsrfToken.php`.

```
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        '/cinetpay-ipn'
    ];
```

### 4. Usage

[](#4-usage)

Cree une transaction

```
use Zampou\CinetPay\Facades\CinetPay;

$transactionLink = CinetPay::generatePaymentLink([
    'amount' => '100',
    'currency' => 'XOF',
    'customer_name' => 'John',
    'customer_surname' => 'Doe',
    'transaction_id' => '123456789',
    'description' => 'Bon gbozon bien chaud de qualité',
]);

dd($transactionLink);
```

#### validation IPN

[](#validation-ipn)

Laravel CinetPay peut gérer automatiquement les IPN pour vous : Il suffit simplement à s'abonner à l'événement` Zampou\CinetPay\Events\CinetPayIPN` en creant en Listener avec la commande suivant :

```
php artisan make:listener CinetPayIPNListener

```

Il suffit ensuite de s'abonner à l'événement en ajoutant un écouteur au `App\Providers\EventServiceProvider` :

```
    use App\Listeners\CinetPayIpnListener;
    use Zampou\CinetPay\Events\CinetPayIPN;
    // ...

    /**
     * The event to listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        CinetPayIPN::class => [
            CinetPayIpnListener::class
        ]
    ];
```

Exemple de Listener d'événements :

```
