Providing Simple 2Checkout Payment Gateway Integration for Laravel applications
- Laravel >= 5.5
- Use following command to install:
composer require delower186/twocheckout
- Add the service provider to your if Laravel version is below 5.5
$providers
array inconfig/app.php
file like:
Delower186\Twocheckout\TwocheckoutServiceProvider
Delower186\Twocheckout\TwocheckoutServiceProvider::class
- Add the alias to your
$aliases
array inconfig/app.php
file like:
'Twocheckout' => Delower186\Twocheckout\Facades\Twocheckout
'Twocheckout' => Delower186\Twocheckout\Facades\Twocheckout::class
- Run the following command to publish configuration:
php artisan vendor:publish
- after creating 2checkout account add merchant code to .env file
MERCHANT_CODE='your merchant code here'
- Migrate database if you want to see demo / use built in system then go to the following link
http://127.0.0.1:8000/twocheckout
- Otherwise include the following facade to your controller which will enable you to use 2 static methods loadScripts() and buyNow($price)
use Delower186\Twocheckout\Facades\Twocheckout;
Twocheckout::loadScripts() // use this method in the bottom of product page
Twocheckout::buyNow($price) //use this method as buyNow button product price as parameter, it can be customized using css classes
Twocheckout::store($request) //use this method to store order info sent by 2checkout, publish views & migrations to customize
- these are optional customization options can be added to .env file
#DEFAULT PRODUCT TYPE IS "DYNAMIC" only for now
PRODUCT_TYPE=
#DEFAULT CURRENCY "USD"
CURRENCY_CODE=
#DEFALT TEXT "BUY NOW"
BUTTON_TEXT=
#CSS CLASSES SEPARATED BY SPACE
CSS_CLASSES=
#CART NAME (DEFAULT 'Total Price')
CART_NAME=