Payments (Stripe)
Set up a Stripe account to handle payments for your serviceCRM instance.
Stripe
SlappShell serviceCRM uses Stripe for handling payments for upfront deposits and final invoicing.
To get started with Stripe for serviceCRM:
- Create a Stripe Account: Sign up at stripe.com.
- Get API Keys: From the Stripe dashboard, obtain your Publishable Key and Secret Key.
- Configure Webhooks: Set up webhooks to handle payment events and updates.
You will need the following details from your Stripe account:
- Publishable Key:
pk_live_... or pk_test_... - Secret Key:
sk_live_... or sk_test_... - Webhook Secret:
whsec_...(set this up in the Stripe dashboard or via the CLI for local testing)
Once your account settings are ready, create a test enviroment to continue developing locally. Switch to production keys and webhooks when ready to deploy.
Webhooks Setup
To set up webhooks for Stripe, follow these steps:
- In the Stripe Dashboard, navigate to Developers > Webhooks.
- Click on "Add endpoint" and enter the webhook URL
https://your-domain.com/api/webhooks/stripe). - Select the following events to listen for:
payment_intent.succeededpayment_intent.payment_failedpayment_intent.canceledpayment_intent.requires_actioncheckout.session.completedcheckout.session.expired
- Copy the webhook secret into the following Stripe Configuration .env variables:
STRIPE_WEBHOOK_SECRET=
Stripe Environment Variables
# In your .env file, set the following:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."
Start with env.template and rename it to env.local
For Local Development - Stripe CLI Webhook
# In your terminal, run the following command to forward Stripe webhooks to your local server:
$ stripe login
$ stripe listen --forward-to localhost:3000/api/webhooks/stripe
Copy the webhook secret from the CLI output and set it in your .env file