PHPackages                             leat/magento2-loyalty - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. leat/magento2-loyalty

ActiveMagento2-component[Utility &amp; Helpers](/categories/utility)

leat/magento2-loyalty
=====================

Magento 2 module for Leat loyalty program

v1.2.0(1mo ago)01441[1 issues](https://github.com/leat-api/magento/issues)MITPHPPHP ^8.3

Since Apr 16Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/leat-api/magento)[ Packagist](https://packagist.org/packages/leat/magento2-loyalty)[ RSS](/packages/leat-magento2-loyalty/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (5)Used By (0)

Leat Loyalty for Magento 2
==========================

[](#leat-loyalty-for-magento-2)

Overview
--------

[](#overview)

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

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- Magento 2.4.7+ (framework &gt;=103.0.7) with the Magento repository (repo.magento.com) configured
- [Piggy PHP SDK](https://github.com/Piggy-Loyalty/piggy-php-sdk) 3.12.7
- Composer

Installation
------------

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

1. Require the package:

```
composer require leat/magento2-loyalty
```

2. Enable the modules:

```
bin/magento module:enable Leat_Loyalty Leat_LoyaltyFrontend Leat_LoyaltyAdminUI Leat_LoyaltyAsync Leat_AsyncQueue
```

3. Run Magento setup upgrade:

```
bin/magento setup:upgrade
```

4. Compile Magento (production mode):

```
bin/magento setup:di:compile
```

5. Deploy static content (production mode):

```
bin/magento setup:static-content:deploy
```

6. Clear the cache:

```
bin/magento cache:clean
bin/magento cache:flush
```

Configuration
-------------

[](#configuration)

### API Credentials

[](#api-credentials)

1. Navigate to **Stores &gt; Configuration &gt; Leat Loyalty &gt; Leat Loyalty &gt; Connection**
2. Enter your Leat API credentials:
    - **Personal Access Token**: Your Leat API key
    - **Shop UUID**: Your Leat shop identifier
3. Test the connection using the "Test Connection" button
4. Save the configuration

### Store Configuration

[](#store-configuration)

1. Navigate to **Stores &gt; Configuration &gt; Leat Loyalty &gt; Leat Loyalty &gt; General Configuration**
2. Enable Leat Connection
3. Select which customer groups should be integrated with Leat
4. Save the configuration

### Additional Settings

[](#additional-settings)

- **Credits Display**: Configure under **Stores &gt; Configuration &gt; Leat Loyalty &gt; Leat Loyalty &gt; Credits Display**
- **Order Configuration**: Configure under **Stores &gt; Configuration &gt; Leat Loyalty &gt; Leat Loyalty &gt; Order Configuration**
    - Export mode: Disabled, Order API, or Legacy Transaction-based
    - Order API options: include tax as charge, include shipping as charge, separate shipping tax
- **Credit Memo Configuration**: Configure under **Stores &gt; Configuration &gt; Leat Loyalty &gt; Leat Loyalty &gt; Credit Memo Configuration**
    - Export positive adjustment as return line items (Order API mode only)
- **Prepaid Balance**: Configure under **Stores &gt; Configuration &gt; Leat Loyalty &gt; Leat Loyalty &gt; Prepaid Balance**
- **Refer a Friend**: Configure under **Stores &gt; Configuration &gt; Leat Loyalty &gt; Leat Loyalty &gt; Refer a Friend**

Module Descriptions
-------------------

[](#module-descriptions)

### Leat\_Loyalty

[](#leat_loyalty)

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

[Detailed Documentation](src/module-loyalty/README.md)

### Leat\_LoyaltyFrontend

[](#leat_loyaltyfrontend)

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

[Detailed Documentation](src/module-loyalty-frontend/README.md)

### Leat\_LoyaltyAdminUI

[](#leat_loyaltyadminui)

Extends Magento's admin area with Leat-specific features:

- Data synchronization interface with live status blocks (connection ping, attribute, category, and product sync)
- Connected Shop selector populated from the Leat API (BusinessProfiles)
- Order export mode selector (Disabled / Order API / Legacy Transaction-based)
- Connection testing system
- Gift product cart price rule UI
- Leat coupon type integration
- Validation framework for data integrity

[Detailed Documentation](src/module-loyalty-admin-ui/README.md)

### Leat\_LoyaltyAsync

[](#leat_loyaltyasync)

Handles asynchronous communication between Magento and Leat:

- Specialized queue types for Leat API operations
- `OrderApiBuilder` - builds full order payloads for the Leat Order API (line items, charges, discounts, payments)
- `ReturnApiBuilder` - builds return payloads from Magento credit memos for the Leat Returns API
- Builder services for common integrations (contact, giftcard, legacy transactions)
- Retry logic and error reporting
- Performance optimization

[Detailed Documentation](src/module-loyalty-async/README.md)

### Leat\_AsyncQueue

[](#leat_asyncqueue)

Provides a robust asynchronous job processing system:

- Job and request management
- Sequential processing
- Retry handling with progressive delays
- Performance optimization

[Detailed Documentation](src/module-async-queue/README.md)

Key Features
------------

[](#key-features)

### Customer Synchronization

[](#customer-synchronization)

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

### Order Synchronization

[](#order-synchronization)

Orders are automatically synchronized to Leat. Two export modes are available:

- **Order API mode**: Exports full order payloads (line items, discounts, charges, payments) via the Leat Order API. Supports configurable tax and shipping charge inclusion.
- **Legacy Transaction mode**: Exports individual per-item credit transactions (original behaviour).

### Prepaid Balance

[](#prepaid-balance)

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

### Gift Product Promotions

[](#gift-product-promotions)

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

### Referral System

[](#referral-system)

Complete referral functionality:

- Personalized referral links
- Social sharing options
- Referral popup for new visitors
- Email notifications

### Frontend Widgets

[](#frontend-widgets)

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

Cron Jobs
---------

[](#cron-jobs)

The integration sets up several cron jobs:

- **Order Export**: Exports new orders to Leat (every minute, self-throttled by status tracking)
- **Return Export**: Exports credit memos as returns to Leat (every minute, 6-hour retrieval window)
- **Data Export**: Orchestrates product and category export (every minute, runs at most weekly per shop)
- **Product Export**: Exports catalog products to Leat in batches of 100
- **Category Export**: Exports categories to Leat in batches of 250
- **Contact Update**: Updates contact information (daily)
- **Queue Processing**: Processes the async queue (every minute)
- **Queue Alert**: Sends alerts for queue errors (Monday at 10 AM)
- **Queue Cleanup**: Cleans up successful jobs (monthly)

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

#### Connection Issues

[](#connection-issues)

If you experience connection issues with the Leat API:

1. Verify your API credentials in the configuration
2. Test the connection using the "Test Connection" button
3. Check your server's outbound connectivity to api.piggy.eu
4. Check the log files in the `var/log/leat/` directory for specific error messages

#### Queue Processing Issues

[](#queue-processing-issues)

If jobs are not being processed:

1. Ensure cron is properly configured and running
2. Check the log files in the `var/log/leat/` directory for errors
3. Verify the queue tables in the database are not corrupted
4. Run `bin/magento cron:run --group=leat_async_queue` and `bin/magento cron:run --group=leat_integration` manually to test

#### Synchronization Issues

[](#synchronization-issues)

If customer or order data is not syncing:

1. Check if the stores are properly configured in the Leat settings
2. Verify the customer has a contact UUID assigned
3. Check the log files in the `var/log/leat/` directory for synchronization errors

### Logging

[](#logging)

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.

Support and Resources
---------------------

[](#support-and-resources)

- **GitHub Repository**: Piggy-Loyalty/magento
- **Technical Support**:
- **Documentation**: Refer to individual module README files for detailed documentation

License
-------

[](#license)

MIT License - see composer.json for details.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance89

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~217 days

Total

3

Last Release

54d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12659917?v=4)[Mike Edinger](/maintainers/EdingerMike)[@EdingerMike](https://github.com/EdingerMike)

---

Top Contributors

[![boldsidney](https://avatars.githubusercontent.com/u/26161010?v=4)](https://github.com/boldsidney "boldsidney (7 commits)")[![martijn-tl](https://avatars.githubusercontent.com/u/133650941?v=4)](https://github.com/martijn-tl "martijn-tl (6 commits)")[![EdingerMike](https://avatars.githubusercontent.com/u/12659917?v=4)](https://github.com/EdingerMike "EdingerMike (5 commits)")[![boldbart](https://avatars.githubusercontent.com/u/23316917?v=4)](https://github.com/boldbart "boldbart (1 commits)")[![rensnitert](https://avatars.githubusercontent.com/u/82369811?v=4)](https://github.com/rensnitert "rensnitert (1 commits)")

---

Tags

magento2loyaltypiggyleat

### Embed Badge

![Health badge](/badges/leat-magento2-loyalty/health.svg)

```
[![Health](https://phpackages.com/badges/leat-magento2-loyalty/health.svg)](https://phpackages.com/packages/leat-magento2-loyalty)
```

###  Alternatives

[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

69362.0k](/packages/run-as-root-magento2-prometheus-exporter)[myparcelnl/magento

A Magento 2 module that creates MyParcel labels

1861.2k](/packages/myparcelnl-magento)[smile/module-store-locator

Smile Store Locator

51537.6k5](/packages/smile-module-store-locator)[mage-os/module-llm-txt

AI-powered LLMs.txt generation for Magento 2 / Mage-OS stores. Help AI systems understand your store with OpenAI-generated content.

245.7k](/packages/mage-os-module-llm-txt)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1015.1k29](/packages/loki-magento2-components)[angeo/module-llms-txt

Magento 2 module for AI Engine Optimization (AEO). Generates spec-compliant llms.txt and llms-full.txt per llmstxt.org standard, plus streaming JSONL for vector indexing. Multi-store, multi-website, CLI, cron, async admin UI, Page Builder-aware sanitization, customer-group pricing, atomic writes, ETag/Cache-Control, .md mirrors.

132.2k](/packages/angeo-module-llms-txt)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
