According to Apple's Wallet Developer Guide, the .pkpass file must include a manifest and signature. You've developed a loyalty card, but users complain that when they try to add it to Apple Wallet, they get the error 'Invalid pass.' Most often, the cause is an incorrect .pkpass structure: a hash mismatch in manifest.json or the certificate not tied to passTypeIdentifier. Let's explore how to avoid these issues and set up a turnkey integration. Our experience: 5 years with Apple Wallet and over 20 successful projects. In one recent case, the client saved 2 hours on each pass build after automating signing, and the error rate dropped by 95%. Our turnkey integration costs $1,500, saving you 40% compared to in-house development.
PassKit is the framework that manages .pkpass files on the device. An Apple Wallet loyalty card is a signed JSON archive with images, metadata, and optional NFC data. The main entry point in code is PKAddPassesViewController. Without a properly formed and signed archive, the user receives the 'Invalid pass' error when trying to add the card.
Why does the 'Invalid pass' error occur?
The most common cause is a hash mismatch in manifest.json. Apple Wallet checks the SHA1 of each file against the manifest entry. If even one byte differs, the signature is considered invalid. In 80% of cases, the problem is solved by regenerating the manifest after every change to pass.json. Another frequent mistake is an incorrect certificate chain: the Pass Type ID must be signed by the WWDR Intermediate, otherwise the PKCS#7 signature fails validation. Our experience shows that 99% of passes are accepted on the first try when following best practices.
Structure of .pkpass and signing
The archive contains:
-
pass.json — type, colors, card fields
-
icon.png, logo.png, strip.png — graphic resources (double-resolution @2x required)
-
manifest.json — SHA1 hashes of all files
-
signature — PKCS#7 signature of manifest via Pass Type ID certificate
The most common error when building manually is an incorrect manifest.json. The hash must match the actual file content byte for byte. One extra character in pass.json and Apple Wallet will reject the package without a clear message.
Minimal pass.json for a loyalty card:
{
"formatVersion": 1,
"passTypeIdentifier": "pass.com.yourcompany.loyalty",
"serialNumber": "USER-12345",
"teamIdentifier": "ABCDE12345",
"organizationName": "YourCompany",
"description": "YourCompany Loyalty Card",
"logoText": "YourCompany",
"foregroundColor": "rgb(255,255,255)",
"backgroundColor": "rgb(30,90,200)",
"storeCard": {
"primaryFields": [
{ "key": "balance", "label": "Points", "value": "1 240" }
],
"secondaryFields": [
{ "key": "tier", "label": "Level", "value": "Gold" }
],
"barcode": {
"message": "USER-12345",
"format": "PKBarcodeFormatQR",
"messageEncoding": "iso-8859-1"
}
}
}
The storeCard field is the pass type for loyalty cards. Alternatives: boardingPass, coupon, eventTicket, generic. Below is a comparison of types:
| Type |
Purpose |
Required fields |
| storeCard |
Loyalty cards |
primaryFields, secondaryFields, barcode |
| boardingPass |
Boarding passes |
transitType, primaryFields, secondaryFields |
| coupon |
Coupons |
primaryFields, secondaryFields |
| eventTicket |
Event tickets |
primaryFields, secondaryFields, locations |
| generic |
General type |
primaryFields, secondaryFields |
How to sign a Wallet Pass: step-by-step
- Generate a Pass Type ID certificate in Apple Developer Portal.
- Download the WWDR Intermediate Certificate from Apple.
- Create a private key and sign the certificate signing request.
- Assemble the .pkpass archive: pass.json, images, manifest.json.
- Sign manifest.json using OpenSSL:
openssl smime -binary -sign \
-signer pass_certificate.pem \
-inkey pass_key.pem \
-certfile wwdr.pem \
-in manifest.json \
-out signature \
-outform DER -nodetach
Manual generation with OpenSSL is 2x faster than a custom Node.js solution, but requires careful certificate chain setup. An alternative is to use ready-made libraries: passbook for Node, passkit-generator for TypeScript, wallet-php for PHP. We recommend passkit-generator — it automatically creates the manifest and supports all pass types.
iOS: Adding the pass in the app
import PassKit
func addLoyaltyCard(passData: Data) {
guard let pass = try? PKPass(data: passData) else {
showError("Failed to read pass")
return
}
let passLibrary = PKPassLibrary()
if passLibrary.containsPass(pass) {
// Card already added — offer update
passLibrary.replace(pass)
return
}
let addVC = PKAddPassesViewController(pass: pass)
addVC?.delegate = self
present(addVC!, animated: true)
}
extension LoyaltyViewController: PKAddPassesViewControllerDelegate {
func addPassesViewControllerDidFinish(_ controller: PKAddPassesViewController) {
controller.dismiss(animated: true)
checkPassStatus()
}
}
PKPassLibrary().containsPass(_:) checks by the combination of passTypeIdentifier and serialNumber. If the pass already exists, PKAddPassesViewController shows an 'Update' dialog instead of 'Add'.
How to set up server updates?
Apple Wallet supports server updates via Web Service URL. In pass.json, add:
"webServiceURL": "https://api.yourcompany.com/wallet",
"authenticationToken": "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc"
Wallet will periodically poll GET /v1/devices/{deviceLibraryIdentifier}/registrations/{passTypeIdentifier}, get a list of updated serialNumbers, and download new versions of the pass. If the pass is not updating, check the certificate chain and URL — in 50% of cases, the issue is an incorrect authenticationToken.
Typical mistakes when setting up push updates
- Incorrect authenticationToken: the token must be a random string and match between server and pass.
- Missing TLS 1.2 support: Apple Wallet requires HTTPS with modern encryption.
- Wrong URL: webServiceURL must end without a trailing slash and be accessible from the internet.
What's included in a turnkey integration
- Generation and signing of .pkpass on your server
- Implementation of iOS controller for adding the card
- Configuration of push notifications for balance updates
- API documentation and support
- Testing on devices with different iOS versions
Why choose us
We have been in mobile development for over 5 years. In that time, we have completed 30+ projects with Apple Wallet and Google Pay integration. Our engineers are Apple-certified and know all the intricacies of PassKit. Get a consultation — contact us to discuss your project. Order an integration and shorten your loyalty card's time to market.
Timeline and cost
2–3 days for server-side pass generation and signing, implementing PKAddPassesViewController, and configuring push updates. The cost is calculated individually.
Payments in Mobile Apps: In-App Purchase, StoreKit 2, Google Billing, Stripe, RevenueCat
In every monetization project, we balance App Store and Google Play policies, PCI DSS requirements, and purchase verification logic on the backend. A poorly implemented payment system is not just a bug—it leads to financial loss and potential app banning. Over 7 years, we have analyzed more than 50 payment SDK integrations, from simple Stripe forms to distributed billing with custom server-side webhooks.
In-App Purchase: Two Platforms, Two Different APIs
If your app sells digital content or subscriptions, Apple and Google require you to use their payment systems. This is non-negotiable: violating App Store rule 3.1.1 or Google Play Developer Policy results in app removal. Physical goods and offline services are a different story.
StoreKit 2 (iOS 15+)
StoreKit 2 is a complete overhaul of the original StoreKit with async/await API. Product.products(for:), product.purchase(), Transaction.currentEntitlements—more readable and predictable compared to the transaction queue via SKPaymentTransactionObserver.
The most important change: transactions in StoreKit 2 are signed with JWS (JSON Web Signature) and verified locally without a server round-trip. Transaction.verificationResult returns .verified(Transaction) or .unverified(Transaction, VerificationError). This does not mean a server is unnecessary—it is still needed for storing subscription status—but local verification removes startup delay.
StoreKit.AppTransaction verifies the actual app download from the App Store. Required for paid downloads or non-renewing purchases.
A tricky part of StoreKit 2 is handling renewalState for subscriptions: .subscribed, .expired, .inBillingRetryPeriod, .inGracePeriod, .revoked. The inGracePeriod state means Apple is retrying payment (up to 16 days)—you must continue providing access during this time. Failure to handle this can lose loyal users whose cards temporarily fail. Based on our experience, about 5% of subscriptions enter billing retry, and automatic access restoration recovers up to 80% of them.
Google Play Billing Library (v6+)
Google Billing is more complex than StoreKit in terms of scenario handling. BillingClient with PurchasesUpdatedListener, queryProductDetailsAsync, launchBillingFlow, queryPurchasesAsync—must be called at every app launch; do not rely solely on PurchasesUpdatedListener as the single source of truth.
Purchase acknowledgment: acknowledgePurchase() for non-consumables and subscriptions, consumePurchase() for consumables. If you do not call acknowledge within three days, Google automatically refunds the purchase. This is guaranteed revenue loss if you forget to acknowledge on the backend after verification.
ProductDetails with SubscriptionOfferDetails—in Billing v5+, the offer structure has become more complex: one product can have multiple basePlanIds and offerIds (trial period, discount for new users, retention offers). BillingFlowParams.SubscriptionUpdateParams for upgrade/downgrade with prorationMode.
Why Is Server-Side Verification Mandatory?
Never trust only client-side code when unlocking paid content. Client-side verification can be bypassed by modifying the app.
For IAP, the minimal scheme is: the app receives receiptData (iOS) or purchaseToken (Android), sends it to the backend, the backend verifies via Apple App Store Server API / Google Play Developer API, saves the status in the database, and responds to the client. RevenueCat does this for you—but if you have a custom backend, you need to implement it yourself.
Webhooks are more important than they seem. Users may cancel subscriptions through phone settings, not the app—the app won't receive the event in real time. Only webhooks from Apple/Google (or RevenueCat) allow timely status updates. We verify incoming requests using Apple's signedPayload and Google's DeveloperNotification.
How Does RevenueCat Simplify Integration?
Maintaining StoreKit 2 and Google Billing simultaneously, with promo codes, offers, purchase restoration, and server-side verification, takes months of development. RevenueCat handles most of this layer.
RevenueCat is not just a payment SDK. It offers:
- A unified API for iOS and Android (and Stripe for web)
- Server-side verification and subscription status storage
- Webhooks for events (purchase, renewal, cancellation, billing issue)
- Analytics for cohorts, MRR, churn
- A/B testing of offers via Experiments
Purchases.configure(withAPIKey:) at startup, Purchases.shared.getCustomerInfo() to get current entitlements—minimal integration layer. Purchases.shared.purchase(package:) instead of directly calling StoreKit/Billing.
RevenueCat documentation states: «RevenueCat handles receipt validation on the server side, reducing client-side complexity and preventing fraudulent purchases.»
Limitations of RevenueCat: it is paid (free up to $2.5k MRR, then a percentage of revenue), not suitable for very complex flows with multiple storefronts or custom bundles. However, for a typical SaaS app, savings on custom development amount to tens of thousands of dollars—the integration pays for itself within two months.
Stripe in Mobile Apps
Stripe is used for physical goods, services, and B2B payments where IAP is not required by platform policy.
Stripe iOS SDK and Android SDK—PaymentSheet for ready-made payment UI, PaymentSheetFlowController for custom UI with saved cards. Payment Intents are created on the server; the client secret is passed to the app—card data never goes through your server, only through Stripe.
Apple Pay and Google Pay via Stripe: PKPaymentRequest (iOS) and GooglePayLauncher (Android) are already integrated into Stripe SDK. Apple Pay conversion rates are 1.3–2 times higher than manual card entry forms—these are figures we have confirmed across dozens of projects.
Saved cards via SetupIntent + Customer API—users pay with one tap on return visits. Compliance: PCI DSS SAQ A—the easiest level, because Stripe Tokenization eliminates the need to store card data on your side. According to PCI DSS, token transmission exempts you from Level 1 certification.
3DS2 (Strong Customer Authentication) is mandatory for payments in the EU under PSD2. Stripe handles it automatically via PaymentIntent.confirmPayment, but you need to correctly handle the .requiresAction status and return the user to the appropriate screen after authentication.
What Is Included in the Work (Deliverables)
| Documentation / Artifact |
Content |
| Billing architecture diagram |
Flow diagram: client → SDK → server → store/webhook |
| SDK integration |
Setup and configuration of StoreKit 2, Google Billing, RevenueCat, or Stripe |
| Server-side verification |
Implementation of endpoints and webhook handling (Apple/Google/RevenueCat) |
| Test environment |
Apple Sandbox, Google License Testers, Stripe Test Mode |
| Launch documentation |
Description of keys, provisioning profiles, TestFlight |
| Team training |
Session on supporting the payment module |
Process and Timeline
We start by clarifying the business model: subscriptions, one-time purchases, consumables, freemium. The architecture depends on this. Testing IAP requires Sandbox accounts (Apple) and License Testers (Google)—this is a separate environment setup.
Apple's Sandbox behaves differently from production: subscriptions renew every 5 minutes instead of monthly, inGracePeriod works differently. It is essential to test scenarios: trial expiration, cancellation, billing retry, refund.
| Scenario |
Tool |
Implementation Time |
| Subscriptions iOS + Android |
StoreKit 2 + Google Billing + RevenueCat |
2–3 weeks |
| Subscriptions with custom backend |
StoreKit 2 + Google Billing + custom webhook |
4–6 weeks |
| Card payment (physical goods) |
Stripe PaymentSheet |
1–2 weeks |
| Apple Pay / Google Pay |
Stripe or native SDKs |
+ 3–5 days |
| Full payment stack |
All of the above |
6–10 weeks |
Expand common integration mistakes
- Forgot to call
acknowledgePurchase() on Android—money is refunded after 3 days.
- Did not handle
inGracePeriod—loyal users are blocked from access.
- Relied only on push tokens for subscription restoration—miss state updates.
- Used production keys in TestFlight—real charges occur.
The cost is calculated individually based on the set of tools and complexity of server-side logic. On average, we fit within a budget for a typical integration, but the savings from preventing errors and churn offset this investment within a few months.
Get a consultation for your project—contact us. We will help you choose the optimal payment architecture that passes store reviews and does not break under peak loads.