delower186/twocheckout

2checkout payment gateway integration for laravel application.

v1.0.3 2022-09-10 10:09 UTC

This package is auto-updated.

Last update: 2024-06-10 14:07:34 UTC


README

GitHub issues GitHub forks GitHub stars GitHub license

2checkout package for Laravel application

Providing Simple 2Checkout Payment Gateway Integration for Laravel applications

Requirements

  • Laravel >= 5.5

Installation

  • Use following command to install:
composer require delower186/twocheckout
  • Add the service provider to your if Laravel version is below 5.5 $providers array in config/app.php file like:
Delower186\Twocheckout\TwocheckoutServiceProvider
Delower186\Twocheckout\TwocheckoutServiceProvider::class
  • Add the alias to your $aliases array in config/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

Usage

Configuration

  • after creating 2checkout account add merchant code to .env file
MERCHANT_CODE='your merchant code here'

Options

  • 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

Customization

  • 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=