使用 Firebase 作为后端的支付集成

Payment Integration Using Firebase as a backend

我想在我的 android 应用程序中集成 paytm 钱包。到目前为止,我一直使用 Firebase 作为我的数据库。我已经看到了我们必须托管自己的单独服务器以进行支付集成的解决方案,但是可以使用 firebase 来实现吗? 谢谢。

据我所知,支付网关要求您在 API 调用中指定一个密码。由于无法从客户端代码(在您用户的 phone 中运行)安全地完成此操作,因此需要从受信任的环境(例如您的开发机器、您控制的服务器或 Cloud Functions for Firebase).

functions-samples repo, for example Stripe and Paypal 中有使用 Cloud Functions 将支付集成到 Firebase 的很好的例子。没有集成 paytm 钱包的示例,但您可以使用这些示例作为起点。

您的 Firebase 项目需要付费计划才能使这些功能正常工作,因为这些 Cloud Functions 会调用第 3 方 APIs,这在免费计划中是不允许的(以防止滥用服务)。

它们有多种可用的支付网关,其中很少有服务器端代码和很少的客户端代码。

支付网关与作为后端的 firebase 的最佳和最简单的集成是 razorpay. They have a very easy documentation and can be integrated in just 30 mins of time.The developer documentation for the same can be found here

他们也支持借记卡、信用卡和一些钱包支付。