{"_id":"@capacitor-pay/stripe","name":"@capacitor-pay/stripe","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@capacitor-pay/stripe","version":"0.0.1","description":"Capacitor plugin wrapping the Stripe Terminal SDK for card reader and Tap to Pay checkout. Stripe provider for capacitor-pay.","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"Alessio Spanu"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/capacitor-pay/capacitor-pay-stripe.git"},"keywords":["capacitor","plugin","native","stripe","stripe-terminal","payments"],"scripts":{"build":"npm run clean && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","prepublishOnly":"npm run build"},"devDependencies":{"@capacitor/core":"^8.1.0","rimraf":"^6.0.1","rollup":"^4.30.1","typescript":"~5.6.3"},"peerDependencies":{"@capacitor/core":">=7.0.0"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"gitHead":"738c511320aa5b6117e38c2364f765a21c2d3ad3","_id":"@capacitor-pay/stripe@0.0.1","bugs":{"url":"https://github.com/capacitor-pay/capacitor-pay-stripe/issues"},"homepage":"https://github.com/capacitor-pay/capacitor-pay-stripe#readme","_nodeVersion":"25.7.0","_npmVersion":"11.10.1","dist":{"integrity":"sha512-dEkcxME6EJnYlNZk8vbCXN9M+oRwVMVgP0o0QDU2a16C/dg8FrjMn5j2PlwpvIXGGu3eWYZDD7qcECVZ1QiEEA==","shasum":"6b877efe0f5dcdfa3887636fd72ffe10b5555bea","tarball":"https://registry.npmjs.org/@capacitor-pay/stripe/-/stripe-0.0.1.tgz","fileCount":22,"unpackedSize":73236,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAjkFB9zKlZqf6Mtq5EYXjyjvM0mlUG7rORTMemj/hPlAiBAkC9OPrlBMzU4OSSX8ATSlp9/a1aK6FLBoc7josK0MA=="}]},"_npmUser":{"name":"spanu18","email":"alessio.spanu03@gmail.com"},"directories":{},"maintainers":[{"name":"spanu18","email":"alessio.spanu03@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/stripe_0.0.1_1781530051262_0.7414173174834733"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-15T13:27:31.027Z","0.0.1":"2026-06-15T13:27:31.402Z","modified":"2026-06-15T13:27:31.729Z"},"maintainers":[{"name":"spanu18","email":"alessio.spanu03@gmail.com"}],"description":"Capacitor plugin wrapping the Stripe Terminal SDK for card reader and Tap to Pay checkout. Stripe provider for capacitor-pay.","homepage":"https://github.com/capacitor-pay/capacitor-pay-stripe#readme","keywords":["capacitor","plugin","native","stripe","stripe-terminal","payments"],"repository":{"type":"git","url":"git+https://github.com/capacitor-pay/capacitor-pay-stripe.git"},"author":{"name":"Alessio Spanu"},"bugs":{"url":"https://github.com/capacitor-pay/capacitor-pay-stripe/issues"},"license":"MIT","readme":"# capacitor-pay-stripe\n\nStripe provider plugin for [`@capacitor-pay/core`](https://github.com/capacitor-pay/capacitor-pay), wrapping the [Stripe Terminal SDK](https://stripe.com/docs/terminal) for card reader and Tap to Pay checkout. Can also be used standalone without `@capacitor-pay/core`.\n\n## ⚠️ Verification status\n\nUnlike `@capacitor-pay/sumup` (whose native code was compiled and verified against the real SumUp SDK), **the native iOS and Android code in this plugin has not been compiled against the real Stripe Terminal SDKs** - those SDK artifacts aren't available in this environment. The TypeScript layer (`src/`) builds and type-checks cleanly.\n\nThe overall structure, method names, and call flow (connection token → discover → connect → create/collect/confirm PaymentIntent) follow Stripe's documented SDK patterns. The parts most likely to need small fixes when you first build against the real SDKs are called out with `NOTE:` comments in:\n\n- `ios/Plugin/StripePlugin.swift` - Tap to Pay class/enum names (`TapToPayDiscoveryConfigurationBuilder`, `TapToPayConnectionConfigurationBuilder`, `TapToPayReaderDelegate`, `DeviceType.appleBuiltIn`, `DiscoveryMethod.tapToPay`), which have been renamed across SDK major versions (formerly \"Local Mobile\").\n- `android/src/main/java/com/capacitorpay/stripe/StripePlugin.java` - `DiscoveryMethod.LOCAL_MOBILE`, `DeviceType.COTS_DEVICE`, `ConnectionConfiguration.LocalMobileConnectionConfiguration`, and the full `BluetoothReaderListener` method set.\n\nTreat this as a solid starting point to iterate on with a real Stripe test account, following the same approach used for `capacitor-pay-sumup/test-app` (a minimal Capacitor app with both platforms added, building until the native SDKs compile cleanly).\n\n## How this differs from `@capacitor-pay/sumup`\n\nSumUp's SDK presents its own checkout UI and handles reader pairing internally - one `checkout()` call does everything. Stripe Terminal is lower-level: **you must explicitly discover and connect to a reader before calling `checkout()`**, and Stripe requires your own backend to issue \"connection tokens\" (short-lived credentials the SDK uses to talk to Stripe).\n\n## Install\n\n```bash\nnpm install @capacitor-pay/stripe\nnpx cap sync\n```\n\n## Backend requirement: connection token endpoint\n\nStripe Terminal SDKs never use your secret key directly - they authenticate via a **connection token** that your backend creates server-side:\n\n```\nPOST /v1/terminal/connection_tokens   (using your Stripe secret key)\n```\n\nExpose an endpoint in your own backend that calls this and returns the result as-is, e.g.:\n\n```json\n{ \"secret\": \"pst_test_...\" }\n```\n\nPass this endpoint's URL as `connectionTokenUrl` in `setup()`. The plugin calls it itself (with any `headers` you provide, e.g. for your app's auth) every time the SDK needs a new token.\n\n## iOS setup\n\nAdd to your `ios/App/Podfile`:\n\n```ruby\npod 'CapacitorPayStripe', :path => '../../node_modules/@capacitor-pay/stripe'\n```\n\nThen run `pod install`. This pulls in the `StripeTerminal` pod (`~> 3.7`, see `CapacitorPayStripe.podspec`).\n\n### Tap to Pay on iPhone\n\nTap to Pay on iPhone requires:\n\n- The `com.apple.developer.proximity-reader.payment.acceptance` entitlement (granted by Apple on request).\n- iPhone XS or later, iOS 16.7+.\n- `NSLocationWhenInUseUsageDescription` in `Info.plist` (the SDK uses location to verify the device is in a supported region).\n\n`discoverReaders({ method: 'tapToPay' })` (the default) looks for the device's own NFC reader; `connectReader` then connects to it directly - no separate hardware is needed.\n\n## Android setup\n\nThe Stripe Terminal Android SDK is on Maven Central, so no extra repository is needed beyond `google()`/`mavenCentral()` (already present in a default Capacitor project).\n\nLike `@capacitor-pay/sumup`, consuming apps need core library desugaring enabled in `android/app/build.gradle`:\n\n```groovy\nandroid {\n    compileOptions {\n        coreLibraryDesugaringEnabled true\n    }\n}\ndependencies {\n    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'\n}\n```\n\nAdd the runtime permissions Stripe Terminal needs to `android/app/src/main/AndroidManifest.xml`:\n\n```xml\n<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\" />\n<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />\n<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />\n<uses-permission android:name=\"android.permission.NFC\" />\n```\n\n`BLUETOOTH_SCAN`/`BLUETOOTH_CONNECT`/`ACCESS_FINE_LOCATION` are runtime (\"dangerous\") permissions on Android 12+ - your app must request them before calling `discoverReaders({ method: 'bluetoothScan' })`.\n\n### Tap to Pay on Android\n\nTap to Pay on Android (`method: 'tapToPay'`, internally a \"local mobile\"/COTS reader) requires Android 11+ (API 30) and a device on Stripe's supported list, plus Stripe enabling Tap to Pay for your account.\n\n## API\n\n<docgen-index>\n\n* [`setup(...)`](#setup)\n* [`discoverReaders(...)`](#discoverreaders)\n* [`connectReader(...)`](#connectreader)\n* [`getConnectionStatus()`](#getconnectionstatus)\n* [`disconnectReader()`](#disconnectreader)\n* [`checkout(...)`](#checkout)\n* [`cancelCheckout()`](#cancelcheckout)\n* [`checkTapToPay()`](#checktaptopay)\n\n</docgen-index>\n\n### setup(...)\n\n```ts\nsetup(options: StripeSetupOptions) => Promise<{ success: boolean }>\n```\n\nConfigure the SDK with your publishable key and connection token endpoint. Call once on startup.\n\n| Param         | Type                                                          |\n| ------------- | -------------------------------------------------------------- |\n| **`options`** | <code><a href=\"#stripesetupoptions\">StripeSetupOptions</a></code> |\n\n---\n\n### discoverReaders(...)\n\n```ts\ndiscoverReaders(options?: DiscoverReadersOptions) => Promise<{ readers: StripeReader[] }>\n```\n\nScan for nearby readers. Resolves once the scan finishes (after `timeout`, default 5000ms) with whatever readers were found.\n\n| Param         | Type                                                                          |\n| ------------- | -------------------------------------------------------------------------------- |\n| **`options`** | <code><a href=\"#discoverreadersoptions\">DiscoverReadersOptions</a></code> |\n\n---\n\n### connectReader(...)\n\n```ts\nconnectReader(options: ConnectReaderOptions) => Promise<{ success: boolean; reader?: StripeReader; }>\n```\n\nConnect to a reader returned by `discoverReaders`.\n\n| Param         | Type                                                                |\n| ------------- | ---------------------------------------------------------------------- |\n| **`options`** | <code><a href=\"#connectreaderoptions\">ConnectReaderOptions</a></code> |\n\n---\n\n### getConnectionStatus()\n\n```ts\ngetConnectionStatus() => Promise<StripeConnectionStatus>\n```\n\nGet the currently connected reader, if any.\n\n---\n\n### disconnectReader()\n\n```ts\ndisconnectReader() => Promise<{ success: boolean }>\n```\n\nDisconnect from the currently connected reader.\n\n---\n\n### checkout(...)\n\n```ts\ncheckout(options: StripeCheckoutOptions) => Promise<StripeCheckoutResult>\n```\n\nCreate a PaymentIntent for `amount`/`currency`, collect a payment method from the connected reader, and confirm the payment. Requires a reader to be connected via `connectReader` first.\n\n| Param         | Type                                                              |\n| ------------- | ---------------------------------------------------------------------- |\n| **`options`** | <code><a href=\"#stripecheckoutoptions\">StripeCheckoutOptions</a></code> |\n\n---\n\n### cancelCheckout()\n\n```ts\ncancelCheckout() => Promise<{ success: boolean }>\n```\n\nCancel an in-progress `checkout` (e.g. while waiting for a card tap).\n\n---\n\n### checkTapToPay()\n\n```ts\ncheckTapToPay() => Promise<StripeTapToPayStatus>\n```\n\nCheck whether Tap to Pay is available on this device and whether a Tap to Pay reader is currently connected.\n\n---\n\n### Interfaces\n\n#### StripeSetupOptions\n\n| Prop                     | Type                          | Description                                                                                                                                                                                                              |\n| ------------------------ | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **`publishableKey`**     | <code>string</code>          | Stripe publishable key, e.g. \"pk_live_...\".                                                                                                                                                                              |\n| **`connectionTokenUrl`** | <code>string</code>          | URL of your backend endpoint that creates and returns a Stripe Terminal connection token, e.g. `{ \"secret\": \"pst_test_...\" }`.                                                                                          |\n| **`headers`**            | <code>Record&lt;string, string&gt;</code> | Optional extra headers sent with the connection token request, e.g. for authentication.                                                                                                                  |\n\n#### DiscoverReadersOptions\n\n| Prop            | Type                                                  | Description                                                                |\n| --------------- | -------------------------------------------------------- | --------------------------------------------------------------------------------- |\n| **`method`**    | <code><a href=\"#stripereaderdiscoverymethod\">StripeReaderDiscoveryMethod</a></code> | Defaults to `tapToPay`.                                     |\n| **`simulated`** | <code>boolean</code>                                  | Discover simulated readers instead of real hardware. Defaults to `false`. |\n| **`timeout`**   | <code>number</code>                                   | How long to scan for readers, in milliseconds. Defaults to 5000.          |\n\n#### StripeReader\n\n| Prop               | Type                  |\n| ------------------ | --------------------- |\n| **`id`**           | <code>string</code>  |\n| **`label`**        | <code>string \\| null</code> |\n| **`serialNumber`** | <code>string \\| null</code> |\n| **`deviceType`**   | <code>string \\| null</code> |\n| **`batteryLevel`** | <code>number \\| null</code> |\n| **`simulated`**    | <code>boolean</code> |\n\n#### ConnectReaderOptions\n\n| Prop             | Type                 | Description                                                                                                                |\n| ---------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| **`readerId`**   | <code>string</code> | The `id` of a reader returned by `discoverReaders`.                                                                       |\n| **`locationId`** | <code>string</code> | The Stripe Location ID (`tml_...`) this reader belongs to. Required for `tapToPay`/`bluetoothScan` readers. |\n\n#### StripeConnectionStatus\n\n| Prop            | Type                                                        |\n| --------------- | ------------------------------------------------------------ |\n| **`connected`** | <code>boolean</code>                                       |\n| **`reader`**    | <code><a href=\"#stripereader\">StripeReader</a></code> |\n\n#### StripeCheckoutOptions\n\n| Prop           | Type                          | Description                                                                  |\n| -------------- | ------------------------------- | ------------------------------------------------------------------------------- |\n| **`amount`**   | <code>number</code>          | Amount to charge, in the major currency unit (e.g. 12.50 for €12.50).        |\n| **`currency`** | <code>string</code>          | ISO 4217 currency code, e.g. \"EUR\".                                          |\n| **`title`**    | <code>string</code>          | Optional description, attached to the PaymentIntent's `metadata.title`.     |\n| **`metadata`** | <code>Record&lt;string, string&gt;</code> | Arbitrary key/value pairs attached to the PaymentIntent.        |\n\n#### StripeCheckoutResult\n\n| Prop                | Type                  | Description                                                          |\n| ------------------- | --------------------- | --------------------------------------------------------------------------- |\n| **`success`**       | <code>boolean</code> |                                                                       |\n| **`paymentIntentId`** | <code>string</code> | ID of the PaymentIntent (`pi_...`) created for this checkout.      |\n| **`status`**        | <code>string</code> | Final PaymentIntent status, e.g. \"succeeded\" or \"requiresCapture\".   |\n\n#### StripeTapToPayStatus\n\n| Prop            | Type                  | Description                                          |\n| --------------- | --------------------- | ----------------------------------------------------------- |\n| **`available`** | <code>boolean</code> |                                                       |\n| **`activated`** | <code>boolean</code> | Whether a Tap to Pay reader is currently connected.  |\n\n### Type Aliases\n\n#### StripeReaderDiscoveryMethod\n\nHow the SDK should look for a reader. `tapToPay` uses the phone's own NFC reader.\n\n<code>'tapToPay' | 'bluetoothScan'</code>\n","readmeFilename":"README.md","_rev":"1-ce1c44a810f4b14931cad62aa681ced5"}