如何将Firebase设置为服务器并执行条带支付 [英] How to set up firebase as server and execute stripe payment

查看:64
本文介绍了如何将Firebase设置为服务器并执行条带支付的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Firebase用作服务器,并将请求发送到付款请求以进行分条.我的服务器端经验为零,因此我正在寻找一种简单的方法来实现这一目标.这篇文章是否可以将Stripe与Firebase集成并使用iOS?接近我想要实现的目标,并且还列出了一些有趣的链接.有谁知道我在哪里可以找到一个很好而简单的教程来将Firebase设置为Stripe的服务器?

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?

推荐答案

我通过以下2个步骤解决了此问题

I resolved this with the following 2 steps

  1. 遵循入门文章中的步骤1、2和3( https://firebase.google.com/docs/functions/使用入门).这使我能够安装所需的所有软件(请注意,我在安装Firebase工具和node/npm时遇到了几个问题,但最终我设法安装了该程序)
  2. 遵循此youtube指南( https://www.youtube.com/watch?v=NsPGRIVOg0U).这是一个很好的视频,简单易懂,它介绍了如何设置功能以请求执行付款.
  3. 在我的swift应用中创建一些逻辑,以将条带令牌保存在实时数据库中,如下所示
  1. 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)
  2. 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.
  3. create some logic in my swift app to save the stripe token in a realtime database as below

func saveTokenInRealtimeDatabase(令牌:STPToken){

func saveTokenInRealtimeDatabase(token: STPToken) {

    let ref = Database.database().reference(withPath: "payments")     
    ref.child(Auth.auth().currentUser!.uid).childByAutoId().setValue(["amount": valueToCharge,  "token": token.allResponseFields])

}

这篇关于如何将Firebase设置为服务器并执行条带支付的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆