Example project of stripe payments with firebase using Realtime Database? #840
Unanswered
makinggainz
asked this question in
Q&A
Replies: 1 comment
-
Suggested Approach:
Sample Cloud Function for Stripe:const functions = require('firebase-functions');
const admin = require('firebase-admin');
const stripe = require('stripe')(YOUR_STRIPE_SECRET_KEY);
admin.initializeApp();
exports.createStripeCharge = functions.https.onCall(async (data, context) => {
// Authentication and data validation here
const amount = data.amount;
const currency = data.currency;
// Create Stripe Charge
const charge = await stripe.charges.create({
amount,
currency,
// ... other charge details
});
// Record the charge in the Realtime Database
const db = admin.database();
const ref = db.ref('payments');
return ref.push(charge);
}); In iOS: This is just a high-level example. Let me know if you need further elaboration. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am looking for an example project like this one but using the Realtime Databse, instead of Firestore.
More specifically (If its possible):
Beta Was this translation helpful? Give feedback.
All reactions