SiftScienceNet is a .NET class library that provides an easy-to-use interface for the SiftScience SiftScience web api.
##Initializing
SiftScienceClient siftClient = new SiftScienceClient("<Your Api key>");
##Sending events to Siftscience
###Create Order
var response = siftClient.CreateOrder(new Order
{
Amount = 1000000,
BillingAddress = new Address
{
Address1 = "190 Mulhouse street",
Address2 = "Unit 5",
City = "Sydney",
Country = "AU",
FullName = "Mathieu Kempe",
Region = "NSW",
ZipCode = "2021"
},
ShippingAddress = new Address
{
Address1 = "address1",
Address2 = "address2",
City = "Sydney",
Country = "AU",
FullName = "Mathieu kempe",
Region = "NSW",
ZipCode = "2021"
},
CurrencyCode = "USD",
Items = new List<Item>
{
new Item
{
Category = "digital",
CurrencyCode = "USD",
Tags = new List<string> { "tag1", "tag2", "tag3" },
Quantity = 4,
Brand = "brand",
Color = "red",
Isbn = "isbn",
ItemId = "12334",
Manufacturer = "rebok",
Price = 100000000,
ProductTitle = "Some product",
Size = "Large",
Sku = "V4C3D5R2Z6",
Upc = "654321",
}
},
UserId = "[email protected]",
UserEmail = "[email protected]",
OrderId = "12234",
SellerUserId = "4",
ExpeditedShipping = false,
PaymentMethods = new List<PaymentMethod>{new PaymentMethod
{
CardBin = "123456",
CardLast4 = "1234",
PaymentType = PaymentType.CreditCard
}},
});
###Transaction
var response = siftClient.Transaction(new Transaction
{
Amount = 100.ToMicros(),
BillingAddress = new Address
{
Address1 = "312 Mulhouse street",
Address2 = "Unit 123",
City = "Sydney",
Country = "AU",
FullName = "Mathieu kempe",
Region = "NSW",
ZipCode = "2021"
},
CurrencyCode = "AUD",
UserId = "1",
OrderId = "234423",
SessionId = "u4ryixmnkwxm1aviiyq4yez1",
ShippingAddress = new Address
{
Address1 = "312 Mulhouse street",
Address2 = "Unit 123",
City = "Sydney",
Country = "AU",
FullName = "Mathieu kempe",
Region = "NSW",
ZipCode = "2021"
},
PaymentMethod = new PaymentMethod
{
CardBin = "123456",
CardLast4 = "1234",
PaymentType = PaymentType.CreditCard,
AvsResultCode = "T",
PaymentGateway = PaymentGateway.Paypal,
},
Status = TransactionStatus.Success,
TransactionType = TransactionType.Capture,
UserEmail = "[email protected]",
TransactionId = "234423"
});
###Create account
siftClient.CreateAccount(new Account
{
UserId = "1",
UserEmail = "[email protected]",
SessionId = "54f3ds25423523gfdsgf4gfds",
Name = "Mathieu Kempe",
SocialSignOn = SocialSignOn.Facebook,
BillingAddress = new Address
{
City = "Mulhouse",
Country = "FR"
}
});
###Update account
siftClient.UpdateAccount(new Account
{
UserId = "1",
UserEmail = "[email protected]",
SessionId = "54f3ds25423523gfdsgf4gfds",
Name = "Mathieu Kempe",
BillingAddress = new Address
{
Address1 = "address1",
Address2 = "address2",
City = "Sydney",
Country = "AU",
FullName = "Mathieu kempe",
Region = "NSW",
ZipCode = "2021"
},
ChangedPassword = true
});
###Add item to cart
siftClient.AddItemToCart("1",new Item
{
Category = "digital",
CurrencyCode = "USD",
Tags = new List<string> { "tag1", "tag2", "tag3" },
Quantity = 4,
Brand = "brand",
Color = "red",
Isbn = "isbn",
ItemId = "12334",
Manufacturer = "reebok",
Price = 100000000,
ProductTitle = "Some product",
Size = "Large",
Sku = "2342",
Upc = "234423",
},"54f3ds25423523gfdsgf4gfds");
###Remove item from cart
siftClient.RemoveItemToCart("1", new Item
{
Category = "digital",
CurrencyCode = "USD",
Tags = new List<string> { "tag1", "tag2", "tag3" },
Quantity = 4,
Brand = "brand",
Color = "red",
Isbn = "isbn",
ItemId = "12334",
Manufacturer = "reybok",
Price = 100000000,
ProductTitle = "Some product",
Size = "Large",
Sku = "2342",
Upc = "234423",
},1,"54f3ds25423523gfdsgf4gfds");
###Send message
siftClient.SendMessage("1", "4", "some subject", "hello ");
###Login (Success)
siftClient.Login("1", "u4ryixmnkwxm1aviiyq4yez1", true);
###Login (Failure)
siftClient.Login("1", "u4ryixmnkwxm1aviiyq4yez1", false);
###Logout
siftClient.Logout("1");
###Link user to session
siftClient.LinkSessionToUser("1", "u4ryixmnkwxm1aviiyq4yez1");
##Label users in Siftscience
siftClient.Label("1", true, new List<Reason> { Reason.Chargeback, Reason.Funneling });
##User score from Siftscience
ScoreResponse scoreResponse = siftClient.GetSiftScore("1");
##Sending Historical data
SiftScience sending historical data
Order, Transaction and Account have a Time property
var response = siftClient.CreateOrder(new Order
{
Time = DateTime.Now.AddDays(-4).ToUnixTime()
...