Last active
March 20, 2020 22:50
-
-
Save hamza39460/aab7631eb5f94e773ac78e7426f68a27 to your computer and use it in GitHub Desktop.
Cloud functions/index.js for Stripe Payment With Flutter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(functions.config().firebase); | |
const firestore = admin.firestore(); | |
const settings = { timestampInSnapshots: true }; | |
firestore.settings(settings) | |
const stripe = require('stripe')('YOUR_SECRET_STRIPE_KEY'); | |
exports.createPaymentIntent = functions.https.onCall((data, context) => { | |
return stripe.paymentIntents.create({ | |
amount: data.amount, | |
currency: data.currency, | |
payment_method_types: ['card'], | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment