ente/web/apps/payments
Abhinav 8a3c0743fe
Import code for payments.ente.io
Manav: To avoid accidentally spilling out any secrets, squash and
import. However, the overwhelming majority of the work in the original code was
done by Abhinav <abhinavk.grd@gmail.com> so set them as the author for the
commit.
2024-03-28 10:19:44 +05:30
..
.github Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
public/fonts Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
src Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
.babelrc Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
.eslintrc Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
.gitignore Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
.prettierrc.json Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
next.config.js Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
package.json Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
README.md Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
SECURITY.md Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
sentry.client.config.js Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
sentry.properties Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
sentry.server.config.js Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
tsconfig.json Import code for payments.ente.io 2024-03-28 10:19:44 +05:30
yarn.lock Import code for payments.ente.io 2024-03-28 10:19:44 +05:30

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev

Notes

If you're running this to test out the payment flows end-to-end, please do a yarn build, that will place the output within the out folder.

Then use any tool to serve this over HTTP. For example, python3 -m http.server 3001 will serve this directory over port 3001.

Aside that, these are the necessary configuration changes.

Local configuration

Update the .env.local to point to the local museum instance, and to define the necessary Stripe keys that can be fetched from Stripe's developer dashboard.

Assuming that your local museum instance is running on 192.168.1.2:8080, your .env.local should look as follows.

NEXT_PUBLIC_ENTE_ENDPOINT = http://192.168.1.2:8080
NEXT_PUBLIC_STRIPE_US_PUBLISHABLE_KEY = stripe_publishable_key

Museum

  1. Install the stripe-cli and capture the webhook signing secret.

  2. Define this secret within your musuem.yaml

  3. Update the whitelisted-redirect-urls so that it supports redirecting to this locally running project

Assuming that your local payments app is running on 192.168.1.2:3001, your museum.yaml should look as follows.

stripe:
    us:
        key: stripe_dev_key
        webhook-secret: stripe_dev_webhook_secret
    whitelisted-redirect-urls: ["http://192.168.1.2:3001/frameRedirect"]
    path:
        success: ?status=success&session_id={CHECKOUT_SESSION_ID}
        cancel: ?status=fail&reason=canceled