Leat Loyalty for Magento 2 is a comprehensive integration package that connects your Magento 2 store with the Piggy.eu loyalty platform. This integration enables powerful loyalty features including points earning, rewards redemption, prepaid balance, gift products, and referral systems.
The package consists of five modules that work together to provide a complete loyalty solution:
- Leat_Loyalty: Core functionality for Leat loyalty integration
- Leat_LoyaltyFrontend: Frontend components and widgets
- Leat_LoyaltyAdminUI: Admin interfaces and backend functionality
- Leat_LoyaltyAsync: Asynchronous integration with Piggy.eu
- Leat_AsyncQueue: Robust asynchronous job processing system
- PHP 8.3 or higher
- Magento 2.4.7+ (framework >=103.0.7) with the Magento repository (repo.magento.com) configured
- Piggy PHP SDK ^3.12
- Composer
- Require the package:
composer require leat/magento2-loyalty- Enable the modules:
bin/magento module:enable Leat_Loyalty Leat_LoyaltyFrontend Leat_LoyaltyAdminUI Leat_LoyaltyAsync Leat_AsyncQueue- Run Magento setup upgrade:
bin/magento setup:upgrade- Compile Magento (production mode):
bin/magento setup:di:compile- Deploy static content (production mode):
bin/magento setup:static-content:deploy- Clear the cache:
bin/magento cache:clean
bin/magento cache:flush- Navigate to Stores > Configuration > Leat Loyalty > Leat Loyalty > Connection
- Enter your Leat API credentials:
- Personal Access Token: Your Leat API key
- Shop UUID: Your Leat shop identifier
- Test the connection using the "Test Connection" button
- Save the configuration
- Navigate to Stores > Configuration > Leat Loyalty > Leat Loyalty > General Configuration
- Enable Leat Connection
- Select which customer groups should be integrated with Leat
- Save the configuration
- Credits Display: Configure under Stores > Configuration > Leat Loyalty > Leat Loyalty > Credits Display
- Order Configuration: Configure under Stores > Configuration > Leat Loyalty > Leat Loyalty > Order Configuration
- Prepaid Balance: Configure under Stores > Configuration > Leat Loyalty > Leat Loyalty > Prepaid Balance
- Refer a Friend: Configure under Stores > Configuration > Leat Loyalty > Leat Loyalty > Refer a Friend
The core module that provides the foundation for the Leat loyalty integration:
- Customer synchronization with Leat contacts
- Order synchronization and credit calculation
- Prepaid balance management
- Coupon/rewards redemption
- Gift product cart price rules
Provides frontend components and widgets for customer interaction:
- Loyalty page with activity log
- Prepaid balance slider in checkout
- Referral system with sharing options
- Gift products display in cart
- Your Coupons widget
Extends Magento's admin area with Leat-specific features:
- Data synchronization interface
- Connection testing system
- Gift product cart price rule UI
- Leat coupon type integration
- Validation framework for data integrity
Handles asynchronous communication between Magento and Leat:
- Specialized queue types for Leat API operations
- Builder services for common integrations
- Retry logic and error reporting
- Performance optimization
Provides a robust asynchronous job processing system:
- Job and request management
- Sequential processing
- Retry handling with progressive delays
- Performance optimization
The integration automatically synchronizes customer data with Leat:
- Creates Leat contacts for Magento customers
- Syncs customer profile updates (name, email, address)
- Stores contact UUID for reliable identification
Orders are automatically synchronized to Leat:
- Transactions created for each order item
Allows customers to use their loyalty balance as payment:
- Interactive slider in checkout
- Real-time total recalculation
- Validation to prevent overuse
- Complete integration with Magento checkout
Enhanced cart price rules for gift products:
- Add gift products to cart based on rules
- Support for both simple and configurable products
- Percentage-based discounts
- Quantity limits based on rule settings
Complete referral functionality:
- Personalized referral links
- Social sharing options
- Referral popup for new visitors
- Email notifications
Rich set of frontend components:
- Loyalty widget with authentication
- Activity log showing transaction history
- Your Coupons widget for reward redemption
- Progress button component for visual feedback
The integration sets up several cron jobs:
- Order Export: Exports new orders to Leat (hourly)
- Contact Update: Updates contact information (daily)
- Queue Processing: Processes the async queue (every 15 minutes)
- Queue Alert: Sends alerts for queue errors (Monday at 10 AM)
- Queue Cleanup: Cleans up successful jobs (monthly)
If you experience connection issues with the Leat API:
- Verify your API credentials in the configuration
- Test the connection using the "Test Connection" button
- Check your server's outbound connectivity to api.piggy.eu
- Check the log files in the
var/log/leat/directory for specific error messages
If jobs are not being processed:
- Ensure cron is properly configured and running
- Check the log files in the
var/log/leat/directory for errors - Verify the queue tables in the database are not corrupted
- Run
bin/magento cron:run --group=leat_async_queueandbin/magento cron:run --group=leat_integrationmanually to test
If customer or order data is not syncing:
- Check if the stores are properly configured in the Leat settings
- Verify the customer has a contact UUID assigned
- Check the log files in the
var/log/leat/directory for synchronization errors
The integration writes log files to the var/log/leat/ directory. These logs contain detailed information about:
- Loyalty operations
- API communications
- Queue processing
- Error messages and exceptions
You can check these logs for troubleshooting and monitoring the integration's activities.
- GitHub Repository: Piggy-Loyalty/magento
- Technical Support: development@leat.com
- Documentation: Refer to individual module README files for detailed documentation
MIT License - see composer.json for details.