Skip to content

Listens on webhook events from Stripe and forwards them to our salesforce environment.

Notifications You must be signed in to change notification settings

otwarteklatki/ok-sf-stripe-webhooks

Repository files navigation

ok-sf-stripe-webhooks

Listens on webhook events from Stripe and forwards them to our salesforce environment.

Run Locally

Node Version

    $ node -v
    v16.8.0

Install

    $ npm install

Run

    $ npm run dev

This should restart upon file change.

Environment variables

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/

But where do I find these environment variables?

Lint

Messy code can lead to bugs :)

In the root directory:

    eslint .

To autofix some things:

    eslint . --fix

Tests

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

Debugging stripe webhooks locally

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.

How to deploy to production

push to main

Production url

https://sf-webhooks.donate.otwarteklatki.pl

How to deploy to staging

push to staging

Staging url

https://ok-sf-stripe-webhooks-staging-uepvew4upa-ew.a.run.app

About

Listens on webhook events from Stripe and forwards them to our salesforce environment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published