Listens on webhook events from Stripe and forwards them to our salesforce environment.
$ node -v
v16.8.0
$ npm install
$ npm run dev
This should restart upon file change.
You'll need to fill these out on your local environment to run the project:
ENV STRIPE_SECRET_KEY=
ENV STRIPE_WEBHOOK_SECRET=
ENV [email protected]
ENV SALESFORCE_PASSWORD=#4Xkeihqtsnei
ENV SALESFORCE_CLIENT_ID=3MVG9sSN_PMn8tjRVL7I.MX.uG3ps4Dyop6ChtUw7QYpF951eoheb79Ncf8G5WQAhYRgGT8TMSnOPY1yDY1.l
ENV SALESFORCE_CLIENT_SECRET=DDC312345A768AA96595178E8C98BDB520CD3705D5ABAA5BD3C4768944B9EADC
ENV SALESFORCE_URL=https://efficiency-enterprise-2129-dev-ed.cs89.my.salesforce.com/services/
- STRIPE_WEBHOOK_SECRET - find this when running the stripe cli for webhooks.
- STRIPE_SECRET_KEY - find in the stripe dashboard
- SALESFORCE_... - set up your local salesforce environment from here and follow the instructions in the readme.
Messy code can lead to bugs :)
In the root directory:
eslint .
To autofix some things:
eslint . --fix
Run these before pushing or your build will break. Also add new tests for any new logic added.
In the root directory:
npm run test
In short, download the stripe CLI and run this command:
stripe listen --forward-to localhost:3000/webhook
And then to fire off events, in a different cmd run:
stripe trigger customer.subscription.deleted
replace customer.subscription.deleted with your desired stripe event.
Also if you're trying to test the receipt emails then you can just make a donation here. with the test card details:
Card number: 4242 4242 4242 4242
expire date: any numbers
cvc: any numbers
zip code: any numbers
Note: sometimes you may need to restart both npm and the webhook for it to pick up...
See the full documentation here.
push to main
https://sf-webhooks.donate.otwarteklatki.pl
push to staging
https://ok-sf-stripe-webhooks-staging-uepvew4upa-ew.a.run.app