Skip to content
NewRedesigned blogFeedback
Jigar Karangiya

How to get customer reward points programmatically in Magento 2?

Hello Devs, In this tutorial we will see how to get customer reward points balance programmatically in Magento 2. In Magento 2, reward points are a powerful feature designed to encourage customer loyalty and engagement.

How to get customer reward points programmatically in Magento 2?
Written by
JKJigar Karangiya
Published
Reading time
1 min read

Jigar Karangiya · · 1 min read

Hello Devs, In this tutorial we will see how to get customer reward points balance programmatically in Magento 2.

In Magento 2, reward points (opens in new tab) are a powerful feature designed to encourage customer loyalty and engagement. They provide an incentive for customers to make repeat purchases and actively participate in your online store. Reward points can be earned by customers through various actions and can be redeemed for discounts, free products, or other incentives.

You can load reward points information of customers by rewardFactory using Magento\Reward\Model\RewardFactory class.

Here is an example of how you can retrieve customer reward points balance programmatically.

php
<?php
 
namespace VendorName\ModuleName\Helper;
 
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Reward\Model\RewardFactory;
 
class Data {
    
    /** @var CustomerRepositoryInterface */
    private $customerRepository;
 
    /** @var RewardFactory */
    private $rewardFactory;
    
    public function __construct(
        CustomerRepositoryInterface $customerRepository,
        RewardFactory $rewardFactory
    ) {
        $this->customerRepository = $customerRepository;
        $this->rewardFactory = $rewardFactory;
    }
 
    public function getRewardPointBalance()
    {
        $customerId = 1;
        $customerEmail = 'jigarkkarangiya@gmail.com';
 
        /* Load Customer by Id */
        $customer = $this->customerRepository->getById($customerId);
 
        /* Load customer by email */
        //$customer = $this->customerRepository->get($customerEmail);
 
        $reward = $this->rewardFactory->create();
        $reward->setCustomerId($customer->getId());
        $reward->setWebsiteId($customer->getWebsiteId());
        $reward->loadByCustomer();
        
        /*[
            "customer_id" => "1",
            "website_id" => "1",
            "reward_id" => "1",
            "points_balance" => "2099",
            "website_currency_code" => null,
        ]*/
 
        return $reward->getPointsBalance();
 
    }
}

As shown in the above example you can retrieve the customer’s reward points balance and some other information mentioned like customer id, website id, reward id, balance, etc.

You may also like this :

How to assign a customer to a company programmatically in Magento 2 B2B?

Get Company using Customer ID programmatically Magento 2 B2B

How to delete file in magento 2 programmatically

That’s it for this tutorial. Happy Coding !!

Keep reading
All posts

01 · 10 min · Shares Adobe Commerce Core

Adobe Commerce Agentic Capabilities, Q4 2026

Five agentic releases for Adobe Commerce: LLM product discovery, Brand Visibility, the Shopper MCP server, Brand Concierge, and Experience Workspace. What each one does, which editions get it, and when.

10 min

03 · 3 min · Shares Adobe Commerce Core

Conditions for Collections in Magento 2

Collections in Magento 2 (Now Adobe Commerce), are among the most powerful tools for retrieving and manipulating data directly from the database.

3 min

Newsletter

New Magento tutorials, straight to your inbox

Code examples, performance tips, and fixes for common Magento issues. No spam.

Subscribe