Ios 如何在Swift应用程序中为Stripe配置后端?
在过去的几个小时里,我一直在研究如何为Stripe实现后端。我不是很有经验,一些iOS Stripe文档让我感到困惑。很多参考资料建议使用Heroku/PHP和Alamofire或AFNetworking设置后端,但我对它不是很熟悉。我知道这是一个愚蠢的问题,但我正在努力学习!有谁能给我解释一下如何设置一个简单的后端/explain Alamofire,或者推荐一些关于如何正确实现Stripe的资源吗?我建议您学习如何做到这一点,您应该在Javascript/Node.JS中完成,并使用类似Heroku的东西来设置Express服务器 在iOS方面,我将使用Alamofire,它将允许您轻松地从Swift应用程序进行API调用。其实现如下所示(用于创建新客户): 在服务器端,假设您使用的是Express,则具有以下内容:Ios 如何在Swift应用程序中为Stripe配置后端?,ios,swift,heroku,stripe-payments,alamofire,Ios,Swift,Heroku,Stripe Payments,Alamofire,在过去的几个小时里,我一直在研究如何为Stripe实现后端。我不是很有经验,一些iOS Stripe文档让我感到困惑。很多参考资料建议使用Heroku/PHP和Alamofire或AFNetworking设置后端,但我对它不是很熟悉。我知道这是一个愚蠢的问题,但我正在努力学习!有谁能给我解释一下如何设置一个简单的后端/explain Alamofire,或者推荐一些关于如何正确实现Stripe的资源吗?我建议您学习如何做到这一点,您应该在Javascript/Node.JS中完成,并使用类似He
app.post('/add-customer', function (req, res) {
stripe.customers.create(
{ email: req.body.email },
function(err, customer) {
err; // null if no error occured
customer; // the created customer object
res.json(customer) // Send newly created customer back to client (Swift App)
}
);
});
您可以在此处找到iOS后端示例:。该后端可用于绑定中包含的iOS示例:我在下面给出了一个模糊的答案,但是请开始编码并向我们展示您所做的工作,然后我们可以为您指出正确的方向。
app.post('/add-customer', function (req, res) {
stripe.customers.create(
{ email: req.body.email },
function(err, customer) {
err; // null if no error occured
customer; // the created customer object
res.json(customer) // Send newly created customer back to client (Swift App)
}
);
});