Overview
Integrating LoyalPro with your POS system allows you to automatically award points when customers make purchases. This guide covers the integration flow for common POS scenarios.
Integration Flow:
- 1Customer presents loyalty card (QR code or phone number) at checkout
- 2POS looks up customer in LoyalPro
- 3Transaction is completed on POS
- 4POS sends transaction data to LoyalPro to award points
- 5Customer receives SMS/push notification with points earned
Customer Lookup
Look up customers by phone number, email, or loyalty card ID.
Customer Lookup
// Look up by phone number
const customer = await loyalpro.customers.search({
phone: "+234 801 234 5678"
});
// Look up by loyalty card ID (from QR scan)
const customer = await loyalpro.customers.retrieve("cus_abc123");
// Look up by email
const customer = await loyalpro.customers.search({
email: "customer@example.com"
});
// Display to cashier
console.log(`Customer: ${customer.name}`);
console.log(`Points Balance: ${customer.points_balance}`);
console.log(`Tier: ${customer.tier.name}`);Recording Transactions
Send transaction data after checkout to award points automatically.
Record Transaction
// After checkout is complete
const transaction = await loyalpro.transactions.create({
customer_id: "cus_abc123",
amount: 15000, // ₦15,000
currency: "NGN",
reference: "POS-TXN-12345", // Your POS transaction ID
branch_id: "branch_main",
metadata: {
cashier_id: "staff_001",
terminal_id: "terminal_03"
}
});
// Points are calculated and awarded automatically
console.log(`Points earned: ${transaction.points_earned}`);
// Customer receives notification automaticallyAutomatic Calculation
LoyalPro automatically calculates points based on your earn rules and the customer's tier multiplier. No need to calculate points manually.
Handling Redemptions at POS
Process point redemptions during checkout.
Process Redemption
// Customer wants to redeem 200 points for ₦1,000 off
const redemption = await loyalpro.points.redeem({
customer_id: "cus_abc123",
points: 200,
reward_id: "rwd_discount_1000"
});
// Apply discount to POS transaction
const discount = redemption.discount_amount; // 1000
console.log(`Apply ₦${discount} discount`);
// After payment, record the transaction with redemption
await loyalpro.transactions.create({
customer_id: "cus_abc123",
amount: 14000, // ₦15,000 - ₦1,000 discount
redemption_id: redemption.id,
reference: "POS-TXN-12346"
});