1. Go to this page and download the library: Download overtrue/laravel-payment library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// config/app.php
'aliases' => [
'LaravelPayment' => Overtrue\LaravelPayment\Facade::class, // This is default in laravel 5.5
],
// config/payments.php
// The default gateway name which configured in `gateways` section.
'default_gateway' => 'paypal',
// The default options for every gateways.
'default_options' => [
'test_mode' => true,
// ...
],
/*
* The gateways, you can config option by camel case or snake_case name.
*
* the option name is followed from gateway class, for example:
*
* $gateway->setMchId('overtrue');
*
* you can configured as:
* 'mch_id' => 'overtrue',
* or:
* 'mchId' => 'overtrue',
*/
'gateways' => [
'paypal' => [
'driver' => 'PayPal_Express',
'options' => [
'username' => env('PAYPAL_USERNAME'),
'password' => env('PAYPAL_PASSWORD'),
'signature' => env('PAYPAL_SIGNATURE'),
'test_mode' => env('PAYPAL_TEST_MODE'),
],
],
// other gateways
],
LaravelPayment::gateway('GATEWAY NAME'); // GATEWAY NAME is key name of `gateways` configuration.
LaravelPayment::gateway('alipay');
LaravelPayment::gateway('paypal');