Skip to content

Commit a0a0533

Browse files
committed
docs(web-sdk): update README and tags
1 parent 5a49f54 commit a0a0533

2 files changed

Lines changed: 97 additions & 13 deletions

File tree

firestore-stripe-web-sdk/README.md

Lines changed: 94 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,28 @@ other database interactions necessary to use the extension. Moreover, it provide
77
definitions for all the common object types that are used by the extension when processing
88
payments.
99

10-
# API Reference
10+
## Features
11+
12+
- 🔐 **Authentication Integration**: Seamless integration with Firebase Authentication
13+
- 🛍️ **Product Management**: List and filter products with their prices
14+
- 💳 **Subscription Handling**: Create and manage subscriptions
15+
- 🔄 **Real-time Updates**: Listen for subscription and payment changes
16+
- 🎯 **Type Safety**: Full TypeScript support with comprehensive type definitions
17+
- 🔌 **Firebase Integration**: Works with Firebase v9, v10, and v11
18+
19+
## API Reference
1120

1221
[API reference](https://github.com/stripe/stripe-firebase-extensions/blob/next/firestore-stripe-web-sdk/markdown/index.md)
1322

14-
# Example usage
23+
## Installation
24+
25+
```bash
26+
npm install @invertase/firestore-stripe-payments
27+
```
28+
29+
## Example usage
1530

16-
## Initialize the SDK
31+
### Initialize the SDK
1732

1833
Start by [initializing the Firebase web SDK](https://firebase.google.com/docs/web/setup)
1934
as usual.
@@ -33,7 +48,7 @@ const payments = getStripePayments(app, {
3348
});
3449
```
3550

36-
## List products and prices
51+
### List products and prices
3752

3853
To fetch all the active products along with their prices, call the
3954
`getProducts()` function as follows:
@@ -72,7 +87,7 @@ for (const product of products) {
7287
}
7388
```
7489

75-
## Start a subscription checkout session
90+
### Start a subscription checkout session
7691

7792
```js
7893
import { createCheckoutSession } from "@invertase/firestore-stripe-payments";
@@ -112,7 +127,7 @@ const session = await createCheckoutSession(payments, {
112127
window.location.assign(session.url);
113128
```
114129

115-
## Listen for subscription updates
130+
### Listen for subscription updates
116131

117132
Once a subscription checkout session has been created, you can listen to the
118133
Stripe subscription update events as follows:
@@ -132,24 +147,91 @@ onCurrentUserSubscriptionUpdate(
132147
);
133148
```
134149

135-
# Dependencies
150+
### Get current user's subscriptions
151+
152+
To fetch all subscriptions for the currently signed-in user:
153+
154+
```js
155+
import { getCurrentUserSubscriptions } from "@invertase/firestore-stripe-payments";
156+
157+
const subscriptions = await getCurrentUserSubscriptions(payments, {
158+
status: "active" // Optional: filter by status
159+
});
160+
```
161+
162+
## Available Examples
163+
164+
The SDK comes with three example implementations to help you get started:
165+
166+
### 1. CommonJS Example (`/examples/cjs`)
167+
A basic implementation using CommonJS modules and webpack:
168+
- Simple product listing
169+
- Basic checkout functionality
170+
- Uses webpack for bundling
171+
- Demonstrates CommonJS module usage
172+
173+
### 2. ESM Example (`/examples/esm`)
174+
A modern implementation using ES modules and Vite:
175+
- Product listing with prices
176+
- Checkout functionality
177+
- Uses Vite for fast development and building
178+
- Demonstrates ES module usage
179+
180+
### 3. ESM with Subscriptions (`/examples/esm-with-subscriptions`)
181+
A complete implementation with subscription features:
182+
- User authentication
183+
- Product listing with prices
184+
- Subscription checkout
185+
- Real-time subscription monitoring
186+
- Active subscriptions display
187+
- Uses Vite for development
188+
- Demonstrates full subscription lifecycle
189+
190+
To run any of these examples:
191+
1. Navigate to the example directory
192+
2. Run `npm install`
193+
3. Update the Firebase configuration in `src/firebase-config.js`
194+
4. Run `npm run dev` to start the development server
195+
196+
## Dependencies
136197

137198
* Cloud Firestore (`@firebase/firestore`)
138199
* Firebase Auth (`@firebase/auth`)
139200
* Firebase Core (`@firebase/app`)
140201

141-
# Build, test, release
202+
## Build, test, release
142203

143-
## Prerequisites
204+
### Prerequisites
144205

145-
* Node.js 12 or higher
146-
* NPM 6 or higher
206+
* Node.js 20 or higher
147207

148-
## Development workflows and commands
208+
### Development workflows and commands
149209

150210
To install the dependencies, run `npm install` in the `firestore-stripe-web-sdk` directory.
151211

152212
Run `npm test` to run all unit and integration tests (usually takes about 15 seconds).
153213

154214
To build a release artifact, run `npm run build` followed by `npm pack`. The resulting tarball
155215
can be published to NPM with `npm publish <tarball>`.
216+
217+
### Available Scripts
218+
219+
- `npm run build`: Build the library
220+
- `npm run build:watch`: Build the library in watch mode
221+
- `npm run dev`: Start development mode with watch
222+
- `npm run test`: Run tests using Firebase emulators
223+
- `npm run clean`: Clean build artifacts
224+
- `npm run api-extractor`: Generate API documentation
225+
- `npm run api-documenter`: Generate markdown documentation
226+
227+
## Contributing
228+
229+
1. Fork the repository
230+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
231+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
232+
4. Push to the branch (`git push origin feature/amazing-feature`)
233+
5. Open a Pull Request
234+
235+
## License
236+
237+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

firestore-stripe-web-sdk/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
"firebase",
2828
"payments",
2929
"subscriptions",
30-
"stripe"
30+
"stripe",
31+
"typescript",
32+
"sdk"
3133
],
3234
"author": "Stripe (https://stripe.com/)",
3335
"contributors": [

0 commit comments

Comments
 (0)