The Official PassKit C# wrapper class released

Patrick Kosterman

Patrick Kosterman

Need a bespoke wallet solution? Patrick works with clients to deliver exactly what they need.
Share on facebook
Share on twitter
Share on linkedin

Important Note: This article is now superseded

PassKit released the all new PassKit Platform in early 2020. This platform incorporates decades of experience designing, developing and implementing world class mobile wallet solutions for some of the biggest international brands. And at the same time, working with small businesses all over the world to help them access the cool capabilities of Apple Wallet and Google Pay passes. We have combined these rich learnings, proven best practices and ever growing knowledge, to deliver you the very best mobile wallet management platform. A platform where you can extend your mobile reach by quickly integrating Apple Wallet and Google Pay Passes into your business. Into your processes. Into your systems. And most importantly into your customer experience.
PassKit now delivers dedicated modules to solve your specific business use cases. No longer do you need to waste time learning about ‘passes’ language. No longer do you need to study mobile wallet terminology. You now work with Mobile Wallet API’s designed around your business processes; your language. A language you are already familiar with. The latest platform currently covers:

TRY THE NEW PASSKIT PLATFORM FOR FREE – UNLIMITED TEST PASSES

Click here for the latest documentation and details on using Postman with the PassKit API.

The official PassKit C# wrapper class is now available. This makes it even quicker and easier to access the PassKit API via C#.
Follow the 10 Easy steps to create a new C# Project with PassKit API Wrapper support:

  1. Download & unzip the contents of ‘PassKit CSharp API Wrapper v0.2.zip’ into a (new) folder;
  2. Create a new Project in Visual Studio;
  3. Open solution explorer;
  4. Right click ‘References’;
  5. Click ‘Add Reference’;
  6. Click ‘Browse’;
  7. Go to the folder where you unzipped the files in step 1;
  8. Add references to both ‘PassKitAPIWrapper.dll’ & ‘RestSharp.dll’;
  9. Make sure you add ‘using PassKitAPIWrapper;’ to the top of your CSharp file;
  10. Good to go!;

Examples:
List templates

string apiAccount = 'accountname';
string apiSecret = 'apisecret';
PassKit pk = new PassKit(apiAccount, apiSecret);
PassKitResponse result = pk.GetTemplates();
// Do something with result Dictionary

Get passes for template

string apiAccount = 'accountname';
string apiSecret = 'apisecret';
PassKit pk = new PassKit(apiAccount, apiSecret);
PassKitResponse result = pk.GetPasses("Lesson package");
// Do something with result Dictionary

Update template

string apiAccount = 'accountname';
string apiSecret = 'apisecret';
// Create Dictionary with template fields you want to update
Dictionary fields = new Dictionary();
fields["Terms_label"] = "Terms & Sausages";
PassKit pk = new PassKit(apiAccount, apiSecret);
PassKitResponse result = pk.UpdateTemplate("Lesson package", fields);
// Do something with result Dictionary

Issue pass for template

string apiAccount = 'accountname';
string apiSecret = 'apisecret';
// Create Dictionary with pass fields
Dictionary fields = new Dictionary();
fields["Student name"] = "Test student";
fields["Balance"] = "10";
fields["Issue date"] = "2013-03-26";
fields["Expiry date"] = "2014-03-26";
PassKit pk = new PassKit(apiAccount, apiSecret);
PassKitResponse result = pk.IssuePass("Lesson package", fields);
// Do something with result Dictionary

Get pass details (via template & serial)

string apiAccount = 'accountname';
string apiSecret = 'apisecret';
PassKit pk = new PassKit(apiAccount, apiSecret);
PassKitResponse result = pk.GetPassDetails("Lesson package", "12345678900000");
// Do something with result Dictionary

Get pass details (via unique pass-id)

string apiAccount = 'accountname';
string apiSecret = 'apisecret';
PassKit pk = new PassKit(apiAccount, apiSecret);
PassKitResponse result = pk.GetPassDetails("JCecLdsk9mmC");
// Do something with result Dictionary

Update pass (via template & serial)

// Create Dictionary with pass fields
Dictionary fields = new Dictionary();
fields["Balance"] = "5";
PassKit pk = new PassKit(apiAccount, apiSecret);
PassKitResponse result = pk.UpdatePass("Lesson package", "12345678900000", fields);
// Do something with result Dictionary

Update pass (via unique pass-id)

// Create Dictionary with pass fields
Dictionary fields = new Dictionary();
fields["Balance"] = "5";
PassKit pk = new PassKit(apiAccount, apiSecret);
PassKitResponse result = pk.UpdatePass("JCecLdsk9mmC", fields);
// Do something with result Dictionary

The C# API Wrapper currently only supports the basic methods. Support for the other API methods will be added on regular basis.
Check readme.txt in ‘PassKit CSharp API Wrapper v0.2.zip‘ for a list of supported methods.
Full code repository with example project can be found at our Google code-base.
We trust you find this wrapper useful and please leave any feedback or comments below.

Join The Cause

Your subscription could not be saved. Please try again.
Your subscription has been successful.

Related Posts