morpara / morpos-magento2
MorPOS Payment Gateway for Magento 2 - Accept secure credit and debit card payments through MorPOS payment gateway
Package info
github.com/morpara/morpos-magento2
Type:magento2-module
pkg:composer/morpara/morpos-magento2
Requires
- php: >=7.0.0
- magento/framework: >=100.0.0
- magento/module-checkout: >=100.0.0
- magento/module-payment: >=100.0.0
- magento/module-quote: >=100.0.0
- magento/module-sales: >=100.0.0
README
MorPOS Payment Gateway for Magento 2 is a secure and easy-to-use payment gateway extension that integrates the Morpara MorPOS payment system with Magento 2 stores. Customers can complete their orders through a secure Hosted Payment Page (HPP) flow or use an Embedded Payment Form for a seamless checkout experience.
โจ Features
- ๐ Magento 2 Integration: Seamlessly adds MorPOS as a payment method for Magento 2.2+
- ๐ Secure Payments: Hosted Payment Page (HPP) and Embedded Payment Form options
- ๐ Multi-Currency: Supports TRY, USD, EUR currencies
- ๐ณ Multiple Payment Options: Credit cards, debit cards, and installment payments
- ๐งช Sandbox Mode: Complete test environment for development
- ๐ง Easy Configuration: Simple admin panel setup with connection testing
- ๐ก๏ธ Security Features: HMAC-based signature validation, CSP compliance, encrypted credentials
- ๐ช Multi-Store: Configure per store/website with different settings
- ๐ค Guest Checkout: Full support for guest orders
- ๐ Multi-Language: Supports Turkish and English (extensible)
๐ Requirements
Server Requirements
| Component | Minimum | Recommended |
|---|---|---|
| Magento | 2.2 | 2.4.8 |
| PHP | 7.2 | 8.1+ |
| TLS | 1.2 | 1.3 |
PHP Extensions
cURL- Required for API communicationjson- Required for data processinghash- Required for security signaturesopenssl- Required for secure connections
Magento Features
- Admin Panel Access: Required for module configuration
- Database Access: For conversation tracking table
- HTTPS: Required for production environments
๐ Installation
Method 1: Via Composer (Recommended)
-
Require the Package
composer require morpara/morpos-magento2
-
Enable the Module
php bin/magento module:enable MorPOS_PaymentGateway
-
Run Setup Commands
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento cache:flush
Method 2: Manual Installation
-
Download the Module
- Download the latest release from GitHub Releases
-
Extract to Magento
# Create directory structure mkdir -p app/code/MorPOS/PaymentGateway # Extract module files unzip morpos-magento.zip -d app/code/MorPOS/PaymentGateway
-
Enable the Module
php bin/magento module:enable MorPOS_PaymentGateway
-
Run Setup Commands
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento cache:flush
Method 3: FTP Upload
- Download the module files from GitHub
- Extract the ZIP file
- Using your FTP client, upload the contents to
app/code/MorPOS/PaymentGateway/ - Connect to your server via SSH and run the setup commands from Method 2
โ๏ธ Configuration
1. Access Settings
Navigate to Stores โ Configuration โ Sales โ Payment Methods โ MorPOS Payment Gateway
2. Required Settings
Fill in the following mandatory fields:
| Field | Description | Example |
|---|---|---|
| Merchant ID | Your unique merchant identifier from MorPOS | 12345 |
| Client ID | OAuth client identifier from MorPOS | your_client_id |
| Client Secret | OAuth client secret from MorPOS | your_client_secret |
| API Key | Authentication key for API requests | your_api_key |
Where to get credentials? Contact Morpara Support or visit MorPOS Documentation to obtain your merchant credentials.
3. Environment Settings
Sandbox Mode
- โ Enable for development/testing
- Uses sandbox endpoints
- No real transactions processed
- Test card numbers accepted
Form Type Choose your payment interface:
- Hosted Payment Page (Redirect): Redirect to MorPOS payment page (recommended)
- More secure
- PCI compliance handled by MorPOS
- Professional payment interface
- Embedded Payment Form (Modal): Payment form within your site
- Seamless checkout experience
- Requires SSL certificate
Order Status Settings
- New Order Status: Status to set when payment succeeds (e.g., "Processing")
Advanced Settings
- Payment from Applicable Countries: Choose "All Allowed Countries" or "Specific Countries"
- Payment from Specific Countries: Select countries if using specific countries option
- Minimum Order Total: Optional minimum order amount
- Maximum Order Total: Optional maximum order amount
- Sort Order: Display order in payment methods list
4. Connection Test
After entering credentials:
- Click Test Connection button in the admin panel
- Wait for the connection test to complete
- Verify success message appears
- If test fails, check credentials and sandbox mode setting
5. Enable the Payment Method
- Set Enabled to Yes
- Click Save Config to activate MorPOS on your store
- Clear cache:
php bin/magento cache:flush
๐ง Payment Flow
Customer Checkout Process
- Cart Review: Customer reviews items in cart
- Checkout: Customer proceeds to checkout
- Payment Selection: Customer selects MorPOS as payment method
- Payment Initiation:
- System validates cart and creates order
- Payment session initiated with MorPOS API
- Unique conversation ID generated for tracking
- Payment Processing:
- Hosted Mode: Customer redirected to MorPOS payment page
- Embedded Mode: Payment form loads in modal popup
- Payment Completion:
- Customer completes payment
- MorPOS sends callback to store
- Order status updated automatically
- Confirmation: Customer sees success/failure page
Security Features
The module implements multiple security layers:
- Credential Encryption: Client Secret and API Key are encrypted in database
- Conversation Tracking: Each payment gets unique tracking ID with HMAC-SHA256
- Signature Verification: All API requests are signed
- CSP Compliance: Automatic Content Security Policy configuration
- HTTPS Only: All API communication uses secure connections
- No Sensitive Logging: Request/response bodies are never logged
Content Security Policy (CSP)
The module automatically whitelists MorPOS domains for iframe embedding:
- Production:
https://sale-gateway.morpara.com - Sandbox:
https://finagopay-pf-sale-api-gateway.prp.morpara.com
No additional CSP configuration is required.
๐ณ Test Cards
Test Cards (Sandbox Mode Only):
Refer to MorPOS Documentation for test card numbers and sandbox testing guidelines.
Testing Checklist:
- โ Successful payment flow
- โ Failed payment handling
- โ Network error scenarios
- โ Currency conversion (if applicable)
- โ Installment options
- โ Order status updates
- โ Guest checkout
- โ Registered customer checkout
๐ Troubleshooting
Common Issues
Payment method not showing at checkout
Causes & Solutions:
-
Module Not Enabled
- Check that the module is enabled: Stores โ Configuration โ Sales โ Payment Methods
- Verify "Enabled" is set to "Yes"
-
Currency Not Supported
- Verify currency is supported (TRY, USD, EUR only)
- Configure your store to use one of the supported currencies
-
Order Total Restrictions
- Check minimum/maximum order total settings
- Ensure order total falls within configured range
-
Country Restrictions
- Verify country restrictions in configuration
- Check customer's billing country is allowed
-
Cache Issues
- Clear cache:
php bin/magento cache:flush - Clear generated files:
rm -rf generated/code/*
- Clear cache:
"Unable to initialize payment" error
Causes & Solutions:
-
Incorrect Credentials
- Verify Merchant ID, Client ID, Client Secret, and API Key
- Use Test Connection feature to validate
-
Environment Mismatch
- Ensure Sandbox Mode setting matches your credentials (test vs production)
-
TLS Requirements
- Server must support TLS 1.2 or higher
- Check OpenSSL version:
php -r "echo OPENSSL_VERSION_TEXT;"
-
cURL Issues
- Verify cURL extension is installed:
php -m | grep curl
- Verify cURL extension is installed:
Order not created after successful payment
Causes & Solutions:
-
Callback URL Issues
- Check callback URL is accessible from internet
- Verify server firewall allows incoming connections from MorPOS
-
Quote Expiration
- Ensure quote has not expired during payment process
-
Server Errors
- Review logs for callback processing errors
- Check
var/log/system.logfor details
Connection Test Fails
-
Firewall/Network Issues
# Test connectivity to MorPOS API curl -I https://sale-gateway.morpara.com -
DNS Resolution
# Verify DNS resolution nslookup sale-gateway.morpara.com -
Server Time
- Ensure server time is accurate (NTP recommended)
Logging
The module logs to Magento's standard logging system:
- File:
var/log/system.log - Level: Info for normal operations, Error for failures
- Content: No sensitive data is logged (security)
Enable Detailed Logging:
php bin/magento config:set dev/debug/debug_logging 1
Check Logs:
tail -f var/log/system.log | grep -i morpos
๐ Internationalization
The module supports multiple languages:
- Turkish (tr_TR): Native support
- English (en_US): Default language
Adding New Translations
-
Create Language File:
# Copy existing translation file cp app/code/MorPOS/PaymentGateway/i18n/en_US.csv \ app/code/MorPOS/PaymentGateway/i18n/de_DE.csv -
Translate Strings: Edit the CSV file and translate the strings
-
Deploy Static Content:
php bin/magento setup:static-content:deploy de_DE php bin/magento cache:flush
๐ Developer Information
Module Structure
MorPOS/PaymentGateway/
โโโ Api/ # API interfaces
โโโ Block/ # UI blocks
โโโ Controller/ # Frontend controllers
โโโ Gateway/ # Payment gateway infrastructure
โโโ Helper/ # Helper classes
โโโ Model/ # Business logic and data models
โโโ Plugin/ # Magento plugins
โโโ Setup/ # Database installation scripts
โโโ etc/ # Configuration files
โโโ i18n/ # Translations
โโโ view/ # Templates, layouts, static assets
Database Tables
| Table | Description |
|---|---|
morpara_morpos_conversation |
Tracks payment attempts and status |
Events
The module integrates with Magento's standard payment events and does not dispatch custom events.
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/morpos/payment/start |
POST | Initiates payment session |
/morpos/payment/callback |
POST | Handles MorPOS callbacks |
/morpos/payment/success |
GET | Success redirect handler |
/morpos/payment/cancel |
GET | Cancel redirect handler |
๐ค Contributing
We welcome contributions! Here's how to get started:
Development Setup
-
Fork the Repository
git clone https://github.com/your-username/morpos-magento.git cd morpos-magento -
Set Up Local Environment
- Install Magento 2 locally
- Link or copy module to
app/code/MorPOS/PaymentGateway/ - Enable developer mode:
php bin/magento deploy:mode:set developer
-
Make Changes
- Follow Magento coding standards
- Add PHPDoc comments
- Test thoroughly
-
Submit Pull Request
- Create feature branch:
git checkout -b feature/your-feature - Commit changes:
git commit -m "Add your feature" - Push to branch:
git push origin feature/your-feature - Open pull request on GitHub
- Create feature branch:
Coding Standards
- Follow Magento Coding Standards
- Use PSR-4 autoloading for PHP classes
- Include PHPDoc comments for functions and classes
- Write meaningful commit messages
Testing Guidelines
Before submitting a pull request, test:
-
Installation/Uninstallation
- Clean installation works
- Uninstallation removes all data
- Upgrade from previous version
-
Payment Flows
- Successful payment (hosted & embedded)
- Failed payment handling
- Callback processing
- Network errors
-
Multi-Currency
- TRY, USD, EUR transactions
- Currency display in admin and frontend
-
Compatibility
- Magento 2.2, 2.3, 2.4
- PHP 7.3, 7.4, 8.0, 8.1, 8.2
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
Documentation
- MorPOS Documentation: https://docs.morpara.com/
- MorPOS Dashboard: https://merchant.morpara.com/
- Magento Documentation: https://developer.adobe.com/commerce/
Issue Reporting
- GitHub Issues: Report a Bug
- Include:
- Magento version
- PHP version
- Module version
- Error messages / logs
- Steps to reproduce
Commercial Support
- Morpara Support: Contact Support
- Email: support@morpara.com
Magento-Specific Issues
- Check Magento logs:
var/log/system.log - Run diagnostics:
php bin/magento setup:di:compile - Verify module status:
php bin/magento module:status MorPOS_PaymentGateway
๐ Acknowledgments
- Adobe/Magento Team - For the excellent e-commerce platform
- Magento Community - For the robust ecosystem and support
- Morpara - For the secure payment infrastructure
๐ Security
If you discover a security vulnerability, please email security@morpara.com instead of using the issue tracker. All security vulnerabilities will be promptly addressed.
Security Features
- โ TLS 1.2+ encrypted communication
- โ Signed API requests with HMAC-SHA256
- โ Encrypted credential storage
- โ Conversation ID tracking
- โ Content Security Policy (CSP) compliance
- โ SQL injection prevention (Magento ORM)
- โ XSS protection (output escaping)
- โ CSRF protection (Magento form keys)
- โ No sensitive data logging
๐ Changelog
Version 1.0.0
- Initial release
- Hosted payment page support
- Embedded payment form support
- Multi-currency support (TRY, USD, EUR)
- Sandbox mode
- Multi-store configuration
- Guest checkout support
- Turkish and English translations
Made with โค๏ธ by Morpara
For more information about MorPOS payment solutions, visit morpara.com or check the documentation.
