Use passninja-cs as an .Net module.
Install via Package Manager:
Install-Package passninja.dll -Version 1.0.0
This function returns a newly created PassNinjaClient object. Make sure to pass your user credentials to make any authenticated requests.
using passninja;
private const string AccountId = "90f0629f-2960-4c20-ac8d-d6e6e389ac73";
private const string ApiKey = "PEMsFSPv2H3O9e8iPW4oO96mqpSChzek7omQGjdY";
PassNinjaClient passNinjaClient = new PassNinjaClient(AccountId, ApiKey);
We've placed our demo user API credentials in this example. Replace it with your actual API credentials to test this code through your PassNinja account and don't hesitate to contact PassNinja with our built in chat system if you'd like to subscribe and create your own custom pass type(s).
For more information on how to use passninja-cs
once it loads, please refer to
the PassNinja JS API reference
This library currently supports methods for creating, getting, updating, and deleting passes via the PassNinja api. The methods are outlined below. Note that each method returns a promise.
var createResponse = passNinjaClient.CreatePass("demo.coupon", new PassData()
{
discount = "50%",
memberName = "Test User1"
});
Console.WriteLine("Create Pass response");
Console.WriteLine(createResponse.url);
Console.WriteLine(createResponse.passType);
Console.WriteLine(createResponse.serialNumber);
var getResponse = passNinjaClient.GetPass("demo.coupon", "ed669b28-9b87-485b-8df6-8b04158d53c1");
Console.WriteLine(getResponse.url);
Console.WriteLine(getResponse.passType);
Console.WriteLine(getResponse.serialNumber);
var putResponse = passNinjaClient.PutPass("demo.coupon", "ed669b28-9b87-485b-8df6-8b04158d53c1", new PassData()
{
discount = "50%",
memberName = "Test User2"
});
var deleteResponse = passNinjaClient.DeletePass("demo.coupon", "e56b4857-5bf6-4829-a6c3-951aee5d3a15");
Console.WriteLine("Delete Pass response");