Skip to content

Commit 408e8d8

Browse files
update readme with CLI usage and local Webhook documentation
1 parent 8f1dd4e commit 408e8d8

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

firestore-stripe-payments/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,50 @@ Then, in the [Stripe Dashboard](https://dashboard.stripe.com):
6060

6161
- Create a new [restricted key](https://stripe.com/docs/keys#limit-access) with write access for the "Customers", "Checkout Sessions" and "Customer portal" resources, and read-only access for the "Subscriptions" and "Prices" resources.
6262

63+
#### Installing via Firebase CLI
64+
65+
When installing via the CLI, be sure to pin the version.
66+
67+
```
68+
firebase ext:install invertase/firestore-stripe-payments --project=projectId_or_alias
69+
70+
Alternatively for local source:
71+
72+
firebase ext:install . --project=projectId_or_alias
73+
```
74+
75+
The current version can be found in [extension.yaml](extension.yaml).
76+
77+
#### Using webhooks locally
78+
79+
If you wish to test the webhooks **locally**, use the following command to configure the extension:
80+
81+
```
82+
firebase ext:configure firestore-stripe-payments --local
83+
```
84+
85+
Be sure to configure your test mode [API Key](https://stripe.com/docs/keys) and webhook [signing secret](https://stripe.com/docs/webhooks/signatures#:~:text=Before%20you%20can%20verify%20signatures,secret%20key%20for%20each%20endpoint.) when prompted.
86+
87+
Start the firebase emulator with:
88+
89+
```
90+
firebase emulators:start --project=projectId_or_alias
91+
```
92+
93+
Find the functions path associated with the stripe extension, typically it looks like this:
94+
95+
- `http://192.0.0.1:5001/{projectId}/{region}/ext-firestore-stripe-payments-handleWebhookEvents`
96+
97+
- You can tunnel your local endpoint using a tool like [ngrok](https://ngrok.com/). In this case you will tunnel the localhost domain and port `http://127.0.01:5001`. Replace `127.0.0.1:5001` with your tunnel url. The end result would look something like:
98+
99+
```
100+
https://1234-1234-1234.ngrok.io/{projectId}/{region}/ext-firestore-stripe-payments-handleWebhookEvents
101+
```
102+
103+
- Configure your test mode stripe [webhook endpoint](https://stripe.com/docs/webhooks) with the url you just constructed.
104+
105+
- Your local webhooks are now set up.
106+
63107
#### Billing
64108

65109
This extension uses the following Firebase services which may have associated charges:

0 commit comments

Comments
 (0)