Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Node.js Stripe webhook & object data for mocking / testing purposes.

License

Notifications You must be signed in to change notification settings

lookback/stripe-mock-data

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stripe Mock Data Gitter chat

Stripe webhook & resource object data for mocking / testing purposes.

Install

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

Features

  • Quick access to entire dataset via .collection
  • Quick select of a specific version using constructor.

Versioning

Resource Object Builders

Webhook Data

Note: Starting with version 2016-07-06, webhook filenames use '.' not '' as a namespace separator, to be consistent with Stripe's actual nomenclature, e.g. customer.subscription.created not customer_subscription_created. '' is still used as word separator in the same namespace, e.g. invoice.payment_succeeded, as per in Stripe's API docs. Older API versions still use customer_subscription_created.

Don't see your version? Open an issue, or start a pull request by forking.

Usage

Basic usage:

var StripeMockData = require('stripe-mock-data')
console.log(StripeMockData.collection)

Access Specific Version:

var StripeMockData = require('stripe-mock-data')
var StripeVersion = '2015-10-01'

// Access Version
var StripeData = StripeMockData(StripeVersion)

// View data
console.log(StripeData)

When attempting to access a version that doesn't exist, an error is thrown:

try {
  StripeData = StripeMockData('Invalid')
} catch (e) {
  console.log(e.message, e.stack)
}

Using resource object builders:

console.log(StripeData.resources.account({
  id: 'cus_CUSTOM_ID' // overrides default parameters
}))

Todo

  • Write tests (entry file, resource objects)
  • Clean up older webhook objects of invalid identifiers
  • Core for webhooks / resources, extend off core objects.

License

MIT © Nijiko Yonskai

About

Node.js Stripe webhook & object data for mocking / testing purposes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%