如何实现支付意向api?
How to implement payment intent api?
因此,欧盟更改了一系列付款规则,因此我必须使用 Stripes Payment API,但有一件事我坚持不懈。我一直在使用 firebase 函数作为我的后端。所以问题是。 "MyAPIClient" 到底是什么? (见代码)
MyAPIClient.createPaymentIntent(amount: 100, currency: "usd") { result
in
switch (result) {
case .success(let clientSecret):
// Hold onto clientSecret for Step 4
case .failure(let error):
// Handle the error
}
}
MyAPIClient
是在 Stripe's iOS examples to handle HTTP requests between your Application and a server backend. There's a corresponding iOS backend example. If you are using Firebase instead of your own server, you could define server side routes in terms of HTTP functions.
之一中定义的 class
最简单的带有支付意向的支付流程是:
- 在 Firebase 中,设置一个 HTTP endpoint, where you create 一个
PaymentIntent
和 return 一个响应,特别是 client_secret
- 在您的应用中,您将使用 HTTP 客户端请求您在步骤 1 中创建的端点。这将为您的应用程序创建付款意向和 return
client_secret
。
- 在您的应用中,收集用户的 card details。
- 通过您的应用,并使用您在上面收集的
client_secret
和银行卡详细信息,confirm the Payment Intent
因此,欧盟更改了一系列付款规则,因此我必须使用 Stripes Payment API,但有一件事我坚持不懈。我一直在使用 firebase 函数作为我的后端。所以问题是。 "MyAPIClient" 到底是什么? (见代码)
MyAPIClient.createPaymentIntent(amount: 100, currency: "usd") { result
in
switch (result) {
case .success(let clientSecret):
// Hold onto clientSecret for Step 4
case .failure(let error):
// Handle the error
}
}
MyAPIClient
是在 Stripe's iOS examples to handle HTTP requests between your Application and a server backend. There's a corresponding iOS backend example. If you are using Firebase instead of your own server, you could define server side routes in terms of HTTP functions.
最简单的带有支付意向的支付流程是:
- 在 Firebase 中,设置一个 HTTP endpoint, where you create 一个
PaymentIntent
和 return 一个响应,特别是client_secret
- 在您的应用中,您将使用 HTTP 客户端请求您在步骤 1 中创建的端点。这将为您的应用程序创建付款意向和 return
client_secret
。 - 在您的应用中,收集用户的 card details。
- 通过您的应用,并使用您在上面收集的
client_secret
和银行卡详细信息,confirm the Payment Intent