- Product Description
- We Also Recommend
- Change Log
- Installation guide
- Product Comparison
- Product's Review
- Contact Us
Details
J2T Reward API, allow access and modification of points within Magento® web service!
Note that this module only works with J2T Points & Rewards 1.5.20 or greater.
How convenient is it to be able to add or remove points to a customer from any application that can use web services and make web services calls. For example, you could have a physical store and would like to add points to a customer that buys from your store, check the available points the customer has and even remove points to the customer account when he or she uses the points from the physical store!
Intrunctions
Create an webservice access user and connect to Magento® webservice
$proxy = new SoapClient('http://your_magento_url/api/soap/?wsdl');
$sessionId = $proxy->login('api_login', 'api_key');
How to get customer points
Note that if points are configured to be used in global scope, results will be similar on all stores
$customerId = 1;
$storeId = 1;
var_dump($proxy->call($sessionId, 'j2trewardapi.info', array($customerId, $storeId)));
>> return value will be:
array(5) { ["current"]=> string(2) "96" //points that the customer can use ["received"]=> string(3) "146" //points history total amount ["spent"]=> string(2) "50" //points used by the customer ["waiting"]=> string(1) "0" //points waiting for validation ["lost"]=> string(1) "0" // points lost (out of date) }
How to get customer points
$storeId = 1;
$filter = array("main_table.customer_id" => "1");
var_dump($proxy->call($sessionId, 'j2trewardapi.list', array($storeId, $filter)));
How to add points
$customer_id = 1;
$storeIds = "1,2";
$points = 20;
$proxy->call($sessionId, 'j2trewardapi.add', array($customer_id, $points, $storeIds));
How to remove points
$customer_id = 1;
$storeIds = "1,2";
$points = 50;
$proxy->call($sessionId, 'j2trewardapi.remove', array($customer_id, $points, $storeIds));
Custom points allocation
You may want to add points with specific order id to the system. This can be done as the following. Note that you will need to use incremental order id. The date must be in the following format: YYYY-DD-MM
$customer_id = 1;
$storeIds = "1,2";
//to add points
$proxy->call($sessionId, 'j2trewardapi.create', array(array('customer_id' => '1', 'order_id' => '12345', 'date_start' => '2012-23-03', 'points_current' => '20', 'store_id' => '1,2')));
//to remove points
$proxy->call($sessionId, 'j2trewardapi.create', array(array('customer_id' => '1', 'order_id' => '12345', 'date_start' => '2012-23-03', 'points_spent' => '20', 'store_id' => '1,2')));
You may also be interested in the following product(s)
![]() J2T Points & Rewards
€49.99
|
1.0.x versions
* 1.0.3: update for J2T Points & Rewards 1.8.x compatibility
* 1.0.2: update of J2t_All
* 1.0.1: Code improvements
* 1.0.0: first release
- Check if you have properly installed J2T Points & Rewards first
- Uncompress module folder to your Magento® root directory
- Create a web service user (if this has not been already done)
- Flush your Magento® cache
- Log out and log back to admin
- start using the module
Contact Us
You might also like
