I would like to use firebase as a server and send request to payment request to stripe. I have zero experience server side so I am looking for a simple way to achieve this. This post Is it possible to integrate Stripe With Firebase and with iOS? is close to what I want to achieve and it also list some interesting link. Does anyone know where I can find a good but simple tutorial to set up firebase as a server for stripe?
Asked
Active
Viewed 786 times
1
-
I did not find anything simple. Please note I have non knowledge re servers so what I find is pretty hard to understand – M4trix Dev Jul 29 '19 at 11:03
2 Answers
4
I resolved this with the following 2 steps
- follow step 1, 2 and 3 of the the get started article (https://firebase.google.com/docs/functions/get-started). This has allowed me to install all the software which was needed (note I had several issue with firebase tool install and node/npm but eventually I managed to install)
- Follow this youtube guide (https://www.youtube.com/watch?v=NsPGRIVOg0U). It is a nice video, simple to understand, on what to do to set up the function to request the execution of the payment.
- create some logic in my swift app to save the stripe token in a realtime database as below
func saveTokenInRealtimeDatabase(token: STPToken) {
let ref = Database.database().reference(withPath: "payments") ref.child(Auth.auth().currentUser!.uid).childByAutoId().setValue(["amount": valueToCharge, "token": token.allResponseFields]) }

M4trix Dev
- 1,828
- 3
- 23
- 48
0
You will find in the list of official Cloud Function samples, a sample on how to integrate Firestore and Stripe:
"Create Stripe customers and charge them on Cloud Firestore write", https://github.com/firebase/functions-samples/tree/master/stripe

Renaud Tarnec
- 79,263
- 10
- 95
- 121
-
I have seen this and it is all very hard to understand. Here is my current state: I have an iOS app and I am able to send credit card details to Stripe and get a token. Now I need to send a payment request to a server so that the server send back to stripe and eventually execute the payment. So I really need to just set up the server and I would like to use firebase... – M4trix Dev Jul 29 '19 at 11:10
-
"I need to send a payment request to a server" (which will communicate with the stripe API): the way you would do that with Firebase is by using Cloud Functions. Detailing here how you should set-up everything is way too broad... You should start with https://firebase.google.com/docs/functions/get-started. It is probably a whole new world to get used to, but in any case if you want to set-up a back-end that will interact with the Stripe API you will need to get use to a "new world". – Renaud Tarnec Jul 29 '19 at 12:13