Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stripe-mock-webhooks

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stripe-mock-webhooks

Test Stripe Webhooks, no internet required

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
decreased by-23.21%
Maintainers
1
Weekly downloads
 
Created
Source

Stripe Mock Webhooks

Quickly test Stripe Webhooks against your application without hitting Stripe or requiring internet connectivity.

Features & Data

  • Customize Webhook response
  • Generate Webhook response object without triggering it against your application
  • Offline mocking
  • Supports multiple versions of the Stripe API
  • Promises!

Install

$ npm install stripe-mock-webhooks --save-dev

Usage

// Require
var StripeMockWebhooks = require('stripe-mock-webhooks')

// Tell the server where it should send events
var webhooks = new StripeMockWebhooks({
  version: '2015-10-01', // Default is latest Stripe API version
  url: 'http://localhost:3001/stripe/events'
})

Send a webhook:

webhooks.trigger('invoice.created').then(function (response) {
  // success
}).catch(function (err) {
  // error
})

Or overwrite values in the response:

webhooks.trigger('invoice.created', {
  data: {
    object: {
      plan: {
        id: 'PLAN_IDENTIFIER'
      }
    }
  }
})

Additional options can be turned on / off:

webhooks.trigger('invoice.created', undefined, {
  now: false
})

Build JSON response without triggering an event:

var response = webhooks.build('invoice.created', {
  data: {
    object: {
      plan: {
        id: 'PLAN_IDENTIFIER'
      }
    }
  }
})

Supports the same arguments as webhooks.trigger

Trigger Options

  • now - Updates event created timestamp to Date.now(), defaults to true

Examples

Look in tests to see example usage.

License

MIT © Nijiko Yonskai

Keywords

FAQs

Package last updated on 05 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc