justdmitry/PassKitHelper

How to Expire a Pass

safermgmt-bfoster opened this issue · 2 comments

Hi @justdmitry,
Now that I'm able to update the passes using the push notification successfully. I have a request to have the card automatically "expire". This could be through the push request or by setting some expiration date on the card. Is there a way to put an expiration date on the card or even add some sort of watermark on the card saying "cancelled" or "expired"?

I've looked into Apple's documentation, but I was not able to find it.

Any help would be appreciated.

Thanks for pointing me to this. This works like a charm!
For anyone else searching for how to do this, here is some sample code that I hope helps.

 if (!string.IsNullOrEmpty(request.ExpirationDate))
  {
      var expireDate = DateTime.Parse(request.ExpirationDate);
      DateTimeOffset dateTimeOffset = DateTime.SpecifyKind(expireDate, DateTimeKind.Utc);

      pass.ExpirationKeys
          .ExpirationDate(dateTimeOffset);
  }