Spurr SDK Loyalty Platform
Usage
Import Spurr SDK
import 'package:spurr/sdk.dart';
Declare partnerId & partnerKey from Spurr Portal
var partnerId = "PARTNER_ID";
var partnerKey = "PARTNER_KEY";
Initialized sdk
var spurr = new SDK(partnerId, partnerKey);
Set user data after user logged-in, EMAIL
, PHONE
, COUNTRY_CODE
, FIRST NAME
, LAST NAME
spurr.setData('user@domain.com', '+62811000000', 'ID', 'User', '');
For better user experience, sdk need user location to calculate distance to particular merchant location: LAT
, LON
spurr.setLatLon(lat, lon);
- loyaltyAvailable: list available loyalties
spurr.loyaltyAvailable({}).then((response) {
if (response != null) {
for (var loyalty in response['data']) {
print(loyalty);
}
}
}).catchError((error) {
print(error);
});
- loyaltyList: list all loyalties
spurr.loyaltyList({}).then((response) {
if (response != null) {
for (var loyalty in response['data']) {
print(loyalty);
}
}
}).catchError((error) {
print(error);
});
- loyaltyQrcode: generate loyalty qrcode
spurr.loyaltyQrcode({'loyaltyId': 'LOYALTY_ID'}).then((response) {
print(response);
}).catchError((error) {
print(error);
});
- campaignList: list all campaign
spurr.campaignList({}).then((response) {
if (response != null) {
for (var promotion in response['data']) {
print(promotion);
}
}
}).catchError((error) {
print(error);
});
- campaignQrcode: generate campaign qrcode
spurr.campaignQrcode({'promotionId': 'PROMOTION_ID'}).then((response) {
print(response);
}).catchError((error) {
print(error);
});
- qrcodeStatus: get qrcode status
spurr.loyaltyQrcode({'loyaltyId': 'LOYALTY_ID'}).then((response) {
print(response);
spurr.qrcodeStatus(response['qrcodesId']).then((response) {
print(response);
}).catchError((error) {
print(error);
});
}).catchError((error) {
print(error);
});
- issue: used to approve issue point/stamp, redeem promotion, rewards & voucher by pin
spurr.issue({
'type': 'loyalty|promotion|rewards|voucher',
'amount': 'AMOUNT_SPENT',
'pin': 'STAFF_PIN',
'promotionId': 'PROMOTION_ID',
}).then((response) {
print(response);
}).catchError((error) {
print(error);
});