For Developers
Developer Guide
A practical technical summary. Full deep reference is in the root DEVELOPER.md file in the repository.
Architecture layers
- Core — plugin bootstrap and hook registration (
Core/Plugin.php) - Gateways — WooCommerce adapters extending
WC_Payment_Gateway - Services — external API calls and payment verification logic
- Controllers — callback and AJAX request handling
- Blocks — block checkout support classes and JS registration
Adding a new gateway
- Create a new service class under
app/Services/to handle external API communication. - Create a gateway class under
app/Gateways/extendingWC_Payment_Gateway. - Register the gateway in
GatewayManager::register(). - Add the callback hook in
Core/Plugin.php. - Add the callback handler in
Controllers/CallbackController.php. - Add a block support class and JS file if block checkout is needed.
Security checklist
- Sanitize all
$_GETand$_POSTvalues before use - Verify nonces for all admin AJAX actions
- Never trust redirect success status without independent API verification
- Store all credentials in WooCommerce settings only — never hardcode
- Log errors through WooCommerce logger, not
error_log()
Key file locations
bpgw/
├── app/
│ ├── Core/Plugin.php # Bootstrap & hooks
│ ├── Gateways/
│ │ ├── BkashGateway.php
│ │ ├── SSLCommerzGateway.php
│ │ └── Blocks/ # Block support classes
│ ├── Services/
│ │ ├── BkashService.php
│ │ └── SSLCommerzService.php
│ └── Controllers/
│ └── CallbackController.php
└── assets/js/
├── bkash-block.js
└── sslcommerz-block.js
