lyrasoft / shopgo-ecpay
ShopGo Ecpay package
Installs: 633
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 4
Type:shopgo-package
pkg:composer/lyrasoft/shopgo-ecpay
Requires
- php: >=8.4.6
- ecpay/sdk: ^1.2
- lyrasoft/shopgo: 0.*
README
Installation
Install from composer
composer require lyrasoft/shopgo-ecpay
Register to shopgo config:
use Lyrasoft\ShopGo\Ecpay\EcpayPayment; use Lyrasoft\ShopGo\Ecpay\EcpayShipping; return [ //... 'shipping' => [ 'types' => [ // ... 'ecpay' => EcpayShipping::class, // <-- Add this ] ], 'payment' => [ 'types' => [ // ... 'ecpay' => EcpayPayment::class, // <-- Add this ] ],
Session
As ShopGo may need to redirect to outside Payment service to process checkout, you must disable SameSite cookie policy
and set secure as TRUE.
// etc/packages/session.php return [ 'session' => [ // ... 'cookie_params' => [ // ... 'secure' => true, // <-- Set this to TRUE // ... 'samesite' => CookiesInterface::SAMESITE_NONE, // Set this to `SAMESITE_NONE` ],
CSRF
Since Ecpay may call back to out website, you must exclude 2 routes from CSRF at front.route.php:
// front.route.php ->middleware( CsrfMiddleware::class, excludes: [ 'front::backup', 'front::shipping_task', 'front::payment_task', ] )
JS
After composer install, Wil automatically install the required JS packages.
"@lyrasoft/shopgo-ecpay": "portal:./vendor/lyrasoft/shopgo-ecpay/assets"
Run:
yarn install
Then add this to front/main.ts after useShopGoCatalog()
// front/main.ts +import { useShopGoEcpay } from '@lyrasoft/shopgo-ecpay'; // ... useShopGoCatalog(); +useShopGoEcpay();