arca/payment-gateways

payment gateway integration in laravel

v0.1.9-beta 2024-03-28 19:51 UTC

README

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

This package seeks to implement Chilean payment gateways and in general for Laravel allowing easy payment integration.

Payment gateways added:

  • Webpay
  • Getnet
  • PayPal

Support us

If you want another payment gateway, write without problem and I will try to implement it.

Installation

You can install the package via composer:

composer require arca/payment-gateways

You can install the package via git: add in composer.json section require

"arca/payment-gateways": "dev-main",

And repositories

"repositories": [
  {
    "type": "composer",
    "url": "https://repositorios.arca.cl"
  }
]

You can publish and run the migrations with:

php artisan vendor:publish --tag="payment-gateways-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="payment-gateways-config"

This is the contents of the published config file:

return [
    'getnet' => [
        'commerce_name' => 'Getnet Nombre de Comercio',
        'login' => env('GETNET_LOGIN', '7ffbb7bf1f7361b1200b2e8d74e1d76f'),
        'tranKey' => env('GETNET_TRAN_KEY', 'SnZP3D63n3I9dH9O'),
        'baseUrl' => env('GETNET_BASE_URL', 'https://checkout.test.getnet.cl'),
        'controller' => \Arca\PaymentGateways\Http\Controllers\GetnetController::class,
    ],
    'webpay' => [
        'commerce_name' => 'Webpay Nombre de Comercio',
        'commerce_code' => env('WEBPAY_CODE', ''),
        'commerce_api_key' => env('WEBPAY_API_KEY', ''),
        'controller' => \Arca\PaymentGateways\Http\Controllers\WebpayController::class,
    ],
    'paypal' => [
        'commerce_name' => 'Paypal Nombre de Comercio',
        'base_url' => env('PAYPAL_CLIENT_URL', 'https://api-m.sandbox.paypal.com'),
        'client_id' => env('PAYPAL_CLIENT_ID', ''),
        'client_secret' => env('PAYPAL_CLIENT_SECRET', ''),
        'controller' => \Arca\PaymentGateways\Http\Controllers\PaypalController::class,
    ],
];

You can publish the assets file with:

php artisan vendor:publish --tag="payment-gateways-assets"

Optionally, you can publish the views using

php artisan vendor:publish --tag="payment-gateways-views"

Events

 php artisan make:listener YourListenerClass --event=PaymentApproved
 php artisan make:listener Your2ListenerClass --event=PaymentRejected

EventServiceProvider

protected $listen = [        
        PaymentApproved::class => [
            YourListenerClass::class,
        ],
        PaymentRejected::class => [
            Your2ListenerClass::class,
        ],
    ];

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.