I am creating one app that has create and add loyalty cards to the apple wallet.
I am creating one pass.json file into root directory of my project Code for pass.json
{
"formatVersion" : 1,
"passType": "boardingPass",
"passTypeIdentifier" : "pass.com.jump.juice",
"serialNumber" : "gT6zrHkaW",
"teamIdentifier" : "89K99U6GYU",
"webServiceURL" : "https://example.com/passes/",
"authenticationToken" : "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc",
"relevantDate" : "2012-07-22T14:25-08:00",
"locations" : [
{
"longitude" : -122.3748889,
"latitude" : 37.6189722
}
],
"barcode" : {
"message" : "SFOJFK JOHN APPLESEED LH451 2012-07-22T14:25-08:00",
"format" : "PKBarcodeFormatPDF417",
"messageEncoding" : "iso-8859-1"
},
"organizationName" : "Skyport Airways",
"description" : "Skyport Boarding Pass",
"logoText" : "Skyport Airways",
"foregroundColor" : "rgb(22, 55, 110)",
"backgroundColor" : "rgb(50, 91, 185)",
"expirationDate": "2023-12-31T23:59-07:00",
"boardingPass" : {
"transitType" : "PKTransitTypeAir",
"headerFields" : [
{
"label" : "GATE",
"key" : "gate",
"value" : "23",
"changeMessage" : "Gate changed to %@."
}
],
"primaryFields" : [
{
"key" : "depart",
"label" : "SAN FRANCISCO",
"value" : "SFO"
},
{
"key" : "arrive",
"label" : "NEW YORK",
"value" : "JFK"
}
],
"secondaryFields" : [
{
"key" : "passenger",
"label" : "PASSENGER",
"value" : "John Appleseed"
}
],
"auxiliaryFields" : [
{
"label" : "DEPART",
"key" : "boardingTime",
"value" : "2:25 PM",
"changeMessage" : "Boarding time changed to %@."
},
{
"label" : "FLIGHT",
"key" : "flightNewName",
"value" : "815",
"changeMessage" : "Flight number changed to %@"
},
{
"key" : "class",
"label" : "DESIG.",
"value" : "Coach"
},
{
"key" : "date",
"label" : "DATE",
"value" : "7/22",
}
],
"backFields" : [
{
"key" : "passport",
"label" : "PASSPORT",
"value" : "Canadian/Canadien"
},
{
"key" : "residence",
"label" : "RESIDENCE",
"value" : "999 Infinite Loop, Apartment 42, Cupertino CA"
}
]
}
}
This is code i write in my app.tsx file onpress of addCardToWallet
const passString = JSON.stringify(boardingPass);
const passBytes = fromByteArray(new TextEncoder().encode(passString));
PassKit.addPass(passBytes).then(() => {
console.log('Pass added successfully');
}).catch((error: any) => {
console.log('Failed to add pass:', error);
});
I got the error... Failed to add pass:Failed to create pass
I am using react-native-passkit-wallet. In this library, there is no method to create a custom pass. I followed all the steps to create the certificate but there is no way to create .pkpass file.