Learn how to set up Stripe with ShipThing.
Secret key
and the Publishable key
. You will need the Secret key
for the integration to work.
.env.local
as well as your production environment:
stripe
object like so:
/api/stripe/checkout
endpoint.
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
checkout.session.completed
POST /webhooks/stripe
route in the apps/api
app. This route constructs the event and then switches on the event type to determine how to process the event.
Webhook
handler for you. You can modify it as needed.apps/api
app to forward webhooks to your local server. This will start automatically when you run pnpm dev
.
Edit the layout
apps/app/app/layout.tsx
and add <Script src="https://js.stripe.com/v3/" />
after the opening <html>
tag and before the opening <body>
tag. You will also need to add import Script from 'next/script'
Add script to the website
apps/web/app/layout.tsx
.Prevent common fraud patterns with Arcjet
apps/app/app/(authenticated)/layout.tsx
you could add this after the call to aj.protect()
: