J2T Reward API

29.99

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
– remove points to the customer account when he or she uses the points from the physical store!

IMPORTANT: version 1.0.3 or greater will only be compatible with J2T Point & Rewards v1.8.0 or greater

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’)));

files

J2T Reward API 1.0.3 (CE & EE)