1.0.0 • Published 5 years ago

stripe-local-events v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

stripe-local-events

What does it do? Reads stripe events locally for testing purposes.

Do you want to receive stripe events to your local application during development?

Well look no futher! Here is the solution!

Install

npm install --save stripe-local-events

How to use

Require the package in your NodeJS file and call the function stripeLocalEvents with your stripe API key and any of the below options.

Options:

  • secretKey <string> required

    • This is your stripe api secret key
    • I highly reccomend that you store the key in a .env file and read it from process.env.STRIPE_API_KEY - but that's totally up to you
  • webhookUrl <string> required

    • A URL to send the stripe events to
    • Can be any URL, however 99% of the time it will be a local server
  • quiet <boolean> optional

    • if set to true you will not see any logs
    • DEFAULT: true
  • interval <integer> optional

    • the number of milliseconds between calling the stripe events api for new events
    • DEFAULT: 5000

Sample Code

const stripeLocalEvents = require('stripe-local-events');

const STRIPE_SECRET_KEY = 'your_stripe_api_key';
stripeLocalEvents({
    secretKey: STRIPE_SECRET_KEY,
    webhookUrl: 'http://localhost:3000/v1/billing/events',
    quiet: true,
    interval: 5000,
});