Skip to content

Commit

Permalink
chore: update readme with stripe webhook forwarding instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
commoddity committed Sep 3, 2024
1 parent 0ce5ddc commit f4280d7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,30 @@ Open up [http://localhost:3000](http://localhost:3000) and you should be ready t

If you're used to using the `vercel dev` command provided by [Vercel CLI](https://vercel.com/cli) instead, you can also use that, but it's not needed.

### Stripe Webhook Forwarding

If you wish to test the Stripe webhook flow, you must use the Stripe CLI to forward the webhook to your local environment.

[Full instructions can be found on the Stripe documentation page.](https://docs.stripe.com/stripe-cli/overview#forward-events-to-your-local-webhook-endpoint)

You must initialize the Stripe CLI with your Stripe account:

```sh
stripe login
```

Then run the following to start forwarding webhooks:

```sh
stripe --api-key <STRIPE API KEY> listen --forward-to http://localhost:3000/api/stripe/webhook
```

It is generally recommended to use the test mode Stripe API key for forwarding webhooks, as this will not create any real subscriptions or charge any real money.

You will be given a webhook signing secret, set it in your `.env` file as `STRIPE_WEBHOOK_SECRET`.

[The webhook handling code in this repo can be found here.](app/routes/api.stripe.webhook/route.tsx).

### Backend

This currently requires you to also run the current portal backend on localhost:4200 in order to run. I am working with the backend team to whitelist localhost and enable us to hit the backend.staging.portal.pokt.network endpoints.
4 changes: 4 additions & 0 deletions app/models/stripe/stripe.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ export const subscription: Stripe.Subscription = {
description: null,
discount: null,
ended_at: null,
invoice_settings: {
account_tax_ids: null,
issuer: { type: "self" },
},
items: {
object: "list",
data: [
Expand Down

0 comments on commit f4280d7

Please sign in to comment.