Skip to content

TaariamTechnologie/CinetPay

Repository files navigation

:package_description

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads


CinetPay Laravel Package

Introduction

Ce package permet d'intégrer facilement l'SDK CinetPay dans un projet Laravel. Il fournit une interface simple pour initier et gérer les paiements via CinetPay.

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require taariam/cinetpay

You can publish and run the migrations with:

php artisan vendor:publish --tag=":package_slug-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="cinetpay"

This is the contents of the published config file:

return [
	'api_key' => env('CINETPAY_API_KEY'),
    'site_id' => env('CINETPAY_SITE_ID'),
    'base_url' => env('CINETPAY_BASE_URL', 'https://api.cinetpay.com/v1/'),
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="cinetpay-views"

Usage Controller

namespace App\Http\Controllers;

use VotreNom\Cinetpay\Cinetpay;

class PaymentController extends Controller
{
    public function initiatePayment()
    {
        $cinetpay = app('cinetpay');

        // Configurer le paiement
        $paymentData = [
            'amount' => 1000,
            'transaction_id' => '123456789',
            'currency' => 'XOF',
            'description' => 'Payment description',
            'return_url' => route('payment.success'),
            'notify_url' => route('payment.notify')
        ];

        // Initier le paiement
        $response = $cinetpay->makePayment($paymentData);

        return redirect($response['payment_url']);
    }
}

Usage Controller

use App\Http\Controllers\PaymentController;

Route::get('initiate-payment', [PaymentController::class, 'initiatePayment'])->name('payment.initiate');
Route::get('payment-success', function () {
    return 'Payment was successful!';
})->name('payment.success');
Route::post('payment-notify', function () {
    // Logique pour gérer la notification de paiement
})->name('payment.notify');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Cinetpay for laravel easy integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages