@capawesome/capacitor-wallet 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +69 -3
  2. package/package.json +12 -4
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @capawesome/capacitor-wallet
1
+ # Capacitor Wallet Plugin
2
2
 
3
3
  Capacitor plugin for adding passes to [Apple Wallet](https://developer.apple.com/documentation/passkit) and [Google Wallet](https://developers.google.com/wallet).
4
4
 
@@ -18,9 +18,14 @@ Capacitor plugin for adding passes to [Apple Wallet](https://developer.apple.com
18
18
 
19
19
  Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
20
20
 
21
- ## Newsletter
21
+ ## Use Cases
22
22
 
23
- Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
23
+ The Wallet plugin is typically used to hand digital passes to the user's wallet app, for example:
24
+
25
+ - **Boarding passes**: Add flight or train boarding passes so travelers have them ready at the gate.
26
+ - **Event tickets**: Add tickets for concerts, sports events, or the cinema.
27
+ - **Loyalty cards**: Let customers store membership and loyalty cards in their wallet.
28
+ - **Coupons**: Distribute coupons and vouchers that users can redeem in store.
24
29
 
25
30
  ## Compatibility
26
31
 
@@ -66,6 +71,12 @@ No configuration required for this plugin.
66
71
 
67
72
  ## Usage
68
73
 
74
+ The following examples show how to check whether passes can be added, add passes to Apple Wallet, and save a pass to Google Wallet.
75
+
76
+ ### Check whether passes can be added
77
+
78
+ On some devices (e.g. certain iPads) or when adding passes is restricted, passes cannot be added to Apple Wallet. Use this method to gate the UI that triggers `addPasses(...)`. Only available on iOS:
79
+
69
80
  ```typescript
70
81
  import { Wallet } from '@capawesome/capacitor-wallet';
71
82
 
@@ -73,11 +84,27 @@ const canAddPasses = async () => {
73
84
  const { canAdd } = await Wallet.canAddPasses();
74
85
  return canAdd;
75
86
  };
87
+ ```
88
+
89
+ ### Add passes to Apple Wallet
90
+
91
+ Present the system add-pass sheet with one or more passes. Each pass must be a base64-encoded `.pkpass` file that was created and signed on your server (see [Creating Passes](#creating-passes)). Only available on iOS:
92
+
93
+ ```typescript
94
+ import { Wallet } from '@capawesome/capacitor-wallet';
76
95
 
77
96
  const addPasses = async (passes: string[]) => {
78
97
  // `passes` are base64-encoded `.pkpass` files that were signed on your server.
79
98
  await Wallet.addPasses({ passes });
80
99
  };
100
+ ```
101
+
102
+ ### Save a pass to Google Wallet
103
+
104
+ Open the Google Wallet "Save to Wallet" flow with a signed JWT that was created on your server (see [Creating Passes](#creating-passes)). Only available on Android:
105
+
106
+ ```typescript
107
+ import { Wallet } from '@capawesome/capacitor-wallet';
81
108
 
82
109
  const saveToGoogleWallet = async (jwt: string) => {
83
110
  // `jwt` is a signed Google Wallet JWT that was created on your server.
@@ -206,6 +233,45 @@ A pass is represented by a signed JWT. Create and sign the JWT on your server us
206
233
 
207
234
  **Note**: With the URL-based "Save to Wallet" flow used by this plugin, there is no completion signal, so `saveToGoogleWallet(...)` resolves as soon as the flow is launched, not when the pass is actually saved.
208
235
 
236
+ ## FAQ
237
+
238
+ ### How is this plugin different from other similar plugins?
239
+
240
+ It covers both Apple Wallet and Google Wallet from a single fully typed API, presenting signed `.pkpass` passes on iOS and opening the official Google Wallet "Save to Wallet" flow on Android, with an availability check to gate your UI beforehand. It keeps a clean security boundary by presenting passes only — signing stays on your server, where your keys belong — and the README links the official Apple and Google guidance for creating them. The plugin is actively maintained against the latest Capacitor and OS versions.
241
+
242
+ ### Can this plugin create passes for me?
243
+
244
+ No, this plugin only presents passes to the user. Creating and signing passes must happen on your server, because it requires private keys and certificates that must never be shipped inside your app. See [Creating Passes](#creating-passes) for details and links to the official Apple and Google documentation.
245
+
246
+ ### Which methods are available on which platform?
247
+
248
+ The `addPasses(...)` and `canAddPasses()` methods are only available on iOS, where they interact with Apple Wallet. The `saveToGoogleWallet(...)` method is only available on Android, where it opens the Google Wallet "Save to Wallet" flow.
249
+
250
+ ### Why does `saveToGoogleWallet` resolve before the pass is saved?
251
+
252
+ The plugin uses the URL-based "Save to Wallet" flow, which does not provide a completion signal. The promise therefore resolves as soon as the flow is launched, not when the pass is actually saved.
253
+
254
+ ### Do I need a special entitlement to add passes on iOS?
255
+
256
+ No, adding passes via the system add-pass sheet does not require any special entitlement. The `com.apple.developer.pass-type-identifiers` entitlement is only needed if you want to read or manage passes that your app owns, which is out of scope for this plugin.
257
+
258
+ ### Why does `canAddPasses` return false?
259
+
260
+ The `canAddPasses()` method may return `false` on some devices (e.g. certain iPads) or when adding passes is restricted. Use it to hide or disable the UI that triggers `addPasses(...)` in these cases.
261
+
262
+ ### Can I use this plugin with Ionic, React, Vue or Angular?
263
+
264
+ Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.
265
+
266
+ ## Related Plugins
267
+
268
+ - [Purchases](https://capawesome.io/docs/sdks/capacitor/purchases/): Support in-app purchases in your Capacitor app.
269
+ - [Square Mobile Payments](https://capawesome.io/docs/sdks/capacitor/square-mobile-payments/): Accept payments with the Square Mobile Payments SDK.
270
+
271
+ ## Newsletter
272
+
273
+ Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
274
+
209
275
  ## Changelog
210
276
 
211
277
  See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/wallet/CHANGELOG.md).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-wallet",
3
- "version": "0.0.1",
4
- "description": "Capacitor plugin for adding passes to Apple Wallet and Google Wallet.",
3
+ "version": "0.1.0",
4
+ "description": "Capacitor plugin for adding passes to Apple Wallet and Google Wallet on Android and iOS.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/esm/index.d.ts",
@@ -33,11 +33,19 @@
33
33
  "url": "https://opencollective.com/capawesome"
34
34
  }
35
35
  ],
36
- "homepage": "https://capawesome.io/docs/plugins/wallet/",
36
+ "homepage": "https://capawesome.io/docs/sdks/capacitor/wallet/",
37
37
  "keywords": [
38
38
  "capacitor",
39
39
  "plugin",
40
- "native"
40
+ "native",
41
+ "capacitor-plugin",
42
+ "apple wallet",
43
+ "google wallet",
44
+ "wallet pass",
45
+ "passes",
46
+ "pkpass",
47
+ "save to wallet",
48
+ "passkit"
41
49
  ],
42
50
  "scripts": {
43
51
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",