0 purchases
spurr
Spurr SDK Loyalty Platform
Usage #
Import Spurr SDK
import 'package:spurr/sdk.dart';
copied to clipboard
Declare partnerId & partnerKey from Spurr Portal
var partnerId = "PARTNER_ID";
var partnerKey = "PARTNER_KEY";
copied to clipboard
Initialized sdk
var spurr = new SDK(partnerId, partnerKey);
copied to clipboard
Set user data after user logged-in, EMAIL, PHONE, COUNTRY_CODE, FIRST NAME, LAST NAME
spurr.setData('[email protected]', '+62811000000', 'ID', 'User', '');
copied to clipboard
For better user experience, sdk need user location to calculate distance to particular merchant location: LAT, LON
spurr.setLatLon(lat, lon);
copied to clipboard
loyaltyAvailable: list available loyalties
spurr.loyaltyAvailable({}).then((response) {
if (response != null) {
for (var loyalty in response['data']) {
print(loyalty);
}
}
}).catchError((error) {
print(error);
});
copied to clipboard
loyaltyList: list all loyalties
spurr.loyaltyList({}).then((response) {
if (response != null) {
for (var loyalty in response['data']) {
print(loyalty);
}
}
}).catchError((error) {
print(error);
});
copied to clipboard
loyaltyQrcode: generate loyalty qrcode
spurr.loyaltyQrcode({'loyaltyId': 'LOYALTY_ID'}).then((response) {
print(response);
}).catchError((error) {
print(error);
});
copied to clipboard
campaignList: list all campaign
spurr.campaignList({}).then((response) {
if (response != null) {
for (var promotion in response['data']) {
print(promotion);
}
}
}).catchError((error) {
print(error);
});
copied to clipboard
campaignQrcode: generate campaign qrcode
spurr.campaignQrcode({'promotionId': 'PROMOTION_ID'}).then((response) {
print(response);
}).catchError((error) {
print(error);
});
copied to clipboard
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);
});
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.