| 1 | // Thin wrapper around the Stripe SDK. |
| 2 | // All Stripe calls go through here so the rest of the app stays clean. |
| 3 | let _stripe; |
| 4 | |
| 5 | function getStripe() { |
| 6 | if (!_stripe) { |
| 7 | if (!process.env.STRIPE_SECRET_KEY) return null; |
| 8 | _stripe = require('stripe')(process.env.STRIPE_SECRET_KEY); |
| 9 | } |
| 10 | return _stripe; |
| 11 | } |
| 12 | |
| 13 | module.exports = { getStripe }; |