border-js
v1.0.3
Published
Border is CloudFunction libarry that connect Firebase and Stripe.
Downloads
7
Maintainers
Readme
Border
Border is CloudFunction libarry that connect Firebase and Stripe.
Feature
- Create stripe customer.
- Add payment(credit card) to stripe.
- Charge amount using specified card.
Install
$ npm install border-js
Usage
- Add your Stripe API Secret Key to firebase config:
firebase functions:config:set stripe.token=<YOUR_STRIPE_API_SECRET_KEY>
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const Border = require('border-js')
const border = new Border("v1"); // set model version.
exports.createStripeCustomer = border.createCustomer();
exports.cleanupStripeCustomer = border.cleanupCustomer();
exports.registerCreditCard = border.addPaymentSource();
exports.createStripeCharge = border.createStripeCharge();
Security Rules
You have to set security rules(.read/.write) so that each models can only access Authenticated user himself
.
/{version}/customer/{customerID}
/{version}/charge/{chargeID}
/{version}/source/{sourceID}
Please take care.