Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Commit 7b360b7

Browse files
Vercel changes
1 parent f0a87fa commit 7b360b7

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

Diff for: .env.example renamed to .env.local.example

File renamed without changes.

Diff for: .gitignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
.env
21
.DS_Store
32
.vscode
43

54
# Node files
65
node_modules/
7-
package-lock.json
8-
yarn.lock
96

107
# Typescript
118
dist
129

1310
# Next.js
1411
.next
15-
.now
12+
.vercel
13+
.env*.local

Diff for: README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ Read more about testing on Stripe at https://stripe.com/docs/testing.
3434
### Included functionality
3535

3636
- [Global CSS styles](https://nextjs.org/blog/next-9-2#built-in-css-support-for-global-stylesheets)
37-
- Making `.env` variables available to next: [next.config.js](next.config.js)
38-
- **Note**: When deploying with Now you need to [add your secrets](https://vercel.com/docs/v2/serverless-functions/env-and-secrets) and specify a [now.json](/now.json) file.
3937
- Implementation of a Layout component that loads and sets up Stripe.js and Elements for usage with SSR via `loadStripe` helper: [components/Layout.tsx](components/Layout.tsx).
4038
- Stripe Checkout
4139
- Custom Amount Donation with redirect to Stripe Checkout:
@@ -78,13 +76,13 @@ cd with-stripe-typescript
7876

7977
### Required configuration
8078

81-
Copy the `.env.example` file into a file named `.env` in the root directory of this project:
79+
Copy the `.env.local.example` file into a file named `.env.local` in the root directory of this project:
8280

8381
```bash
84-
cp .env.example .env
82+
cp .env.local.example .env.local
8583
```
8684

87-
You will need a Stripe account ([register](https://dashboard.stripe.com/register)) to run this sample. Go to the Stripe [developer dashboard](https://stripe.com/docs/development#api-keys) to find your API keys and replace them in the `.env` file.
85+
You will need a Stripe account ([register](https://dashboard.stripe.com/register)) to run this sample. Go to the Stripe [developer dashboard](https://stripe.com/docs/development#api-keys) to find your API keys and replace them in the `.env.local` file.
8886

8987
```bash
9088
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=<replace-with-your-publishable-key>
@@ -111,27 +109,29 @@ Next, start the webhook forwarding:
111109
stripe listen --forward-to localhost:3000/api/webhooks
112110
```
113111

114-
The CLI will print a webhook secret key to the console. Set `STRIPE_WEBHOOK_SECRET` to this value in your `.env` file.
112+
The CLI will print a webhook secret key to the console. Set `STRIPE_WEBHOOK_SECRET` to this value in your `.env.local` file.
115113

116114
### Deploy
117115

116+
[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/with-stripe-typescript)
117+
118118
Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
119119

120120
**Note**: You must add your Stripe secrets using the Vercel CLI ([Download here](https://vercel.com/download)):
121121

122122
```bash
123-
now secrets add stripe_publishable_key pk_***
124-
now secrets add stripe_secret_key sk_***
125-
now secrets add stripe_webhook_secret whsec_***
123+
vercel secrets add stripe_publishable_key pk_***
124+
vercel secrets add stripe_secret_key sk_***
125+
vercel secrets add stripe_webhook_secret whsec_***
126126
```
127127

128128
After deploying, copy the deployment URL with the webhook path (`https://your-url.now.sh/api/webhooks`) and create a live webhook endpoint [in your Stripe dashboard](https://stripe.com/docs/webhooks/setup#configure-webhook-settings).
129129

130130
**Note**: Your live webhook will have a different secret. To update it in your deployed application you will need to first remove the existing secret and then add the new secret:
131131

132132
```bash
133-
now secrets rm stripe_webhook_secret
134-
now secrets add stripe_webhook_secret whsec_***
133+
vercel secrets rm stripe_webhook_secret
134+
vercel secrets add stripe_webhook_secret whsec_***
135135
```
136136

137137
As the secrets are set as env vars in the project at deploy time, we will need to redeploy our app after we made changes to the secrets.

Diff for: now.json renamed to vercel.json

File renamed without changes.

0 commit comments

Comments
 (0)