Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update readme with CLI usage and local Webhook documentation #436

Merged
merged 7 commits into from
Oct 8, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions firestore-stripe-payments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,46 @@ Then, in the [Stripe Dashboard](https://dashboard.stripe.com):

- 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.

#### Installing via Firebase CLI

When installing via the CLI, be sure to pin the version.

```
firebase ext:install stripe/[email protected] --project=projectId_or_alias
michaelangeloio marked this conversation as resolved.
Show resolved Hide resolved
```

The current version can be found in [extension.yaml](extension.yaml).

#### Using webhooks locally

If you wish to test the webhooks **locally**, use the following command to configure the extension:

```
firebase ext:configure firestore-stripe-payments --local
```

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.

Start the firebase emulator with:

```
firebase emulators:start
michaelangeloio marked this conversation as resolved.
Show resolved Hide resolved
```

Find the functions path associated with the stripe extension, typically it looks like this:

- `http://localhost:3999/{projectId}/{region}/ext-firestore-stripe-payments-handleWebhookEvents`
michaelangeloio marked this conversation as resolved.
Show resolved Hide resolved

- 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://localhost:3999`. Replace `localhost:3999` with your tunnel url. The end result would look something like:
michaelangeloio marked this conversation as resolved.
Show resolved Hide resolved

```
https://1234-1234-1234.ngrok.io/{projectId}/{region}/ext-firestore-stripe-payments-handleWebhookEvents
```

- Configure your test mode stripe [webhook endpoint](https://stripe.com/docs/webhooks) with the url you just constructed.

- Your local webhooks are now set up.

#### Billing

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