Skip to content
An Apple Wallet Passbook library in C#/.NET
C#
Branch: master
Clone or download
Latest commit fc2dc59 Nov 10, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src v1.1.1 Nov 10, 2016
.editorconfig Clean up whitespace Nov 1, 2016
.gitignore nuget settings Nov 2, 2016
.travis.yml Restructure project and add some initial mspec tests Oct 31, 2016
PassSharp.sln nuget settings Nov 2, 2016
appveyor.yml Set nuget api key Nov 2, 2016
changelog.md v1.1.1 Nov 10, 2016
license Restructure project and add some initial mspec tests Oct 31, 2016
readme.md add more info about creating passes Nov 4, 2016

readme.md

PassSharp

Travis CIBuild Status AppVeyor Build Status NuGet

An Apple Wallet Passbook Library in C#/.NET supporting iOS 6+

Install PassSharp

PM> Install-Package PassSharp

or

$ nuget install PassSharp

Creating Passes

You will need to use the Pass class to set the necessary fields for the type of pass you want to create. (See Apple's Pass Design and Creation documentation)

var pass = new Pass {
  type = PassType.generic,
  passTypeIdentifier = "pass.com.my.pass",
  description = "example pass",
  organizationName = "acme corp",
  "serialNumber" = "abc123456",
  teamIdentifier = "U1234567",
  icon = new Asset("path/to/icon"),
  icon2x = new Asset("path/to/icon2x"),
  icon3x = new Asset("path/to/icon3x"),
  logo = new Asset("path/to/logo"),
  logo2x = new Asset("path/to/logo2x"),
  logo3x = new Asset("path/to/logo3x")
};

You can now set more general fields (such as location, barcode, etc.).

pass.addLocation({ longitude: 10.0000, latitude: -10.0000 });
pass.addBarcode(new Barcode {
  message = "1234",
  format = BarcodeFormat.PKBarcodeFormatPDF417
});
pass.addField(FieldType.Header,
  new Field {
    key = "pass-field",
    label = "pass-field-label",
    value = "pass-field-value"
  }
);
pass.addField(FieldType.Primary,
  new Field {
    key = "pass-field2",
    label = "pass-field-label2",
    value = "pass-field-value2"
  }
);

Writing Passes & Certificates

In order to create passes you will need to download the Apple WWDR intermediate certificate, and to generate your own pass id certificate from the Apple developers portal.

You can then write passes by including the Apple WWDR certificate, and the pass id certificate that you previously generated.

var myPass = new Pass { ... };
using(var myStream = new MemoryStream()) {
  PassWriter.Write(myPass, myStream,
    new X509Certificate2("../path/to/appleWWDRCertificate"),
    new X509Certificate2("../path/to/passCertificate"));
}
You can’t perform that action at this time.