android - iOS Stripe - 获取没有临时 key 的卡 token ?

标签 android ios stripe-payments

Android 中实现 Stripe 时,有一个 CardInputWidget 给你一个 Card 对象,然后你得到一个token 来自 Stripe API 使用该卡,最后您将该 token 发送到您的服务器,这会产生费用。

iOS 中实现 Stripe 时,我可以看到工作流程非常不同。服务器需要有一个 API 端点来提供 Stripe 临时 key 。有没有办法像在 Android 工作流程中那样做 - 没有 ephemeral key

最佳答案

let stripeCard = STPCardParams() /// Declare Stripe Payment Function
stripeCard.name = "Card Name" // you can enter Card Owner name which is displayed in card
stripeCard.number = "Card number" //You can enter card Number which is displayed in Card
stripeCard.expMonth = "ExpireMonth" // enter expire Month which is displayed in Card
stripeCard.expYear = "ExpireYear" // enter expire year which is displayed in Card
stripeCard.cvc = "CVV" // enter CVV which is displayed in Card
//after check card valid or not from below method
if STPCardValidator.validationState(forCard: self.stripeCard) == .valid 
{
// the card is valid.
print("Valid card")
STPAPIClient.shared().createToken(withCard: self.stripeCard, completion: { (token, error) -> Void in
    if error != nil {
    print(error ?? "")
    return
    }

    print(token!) 
    // call your php Api Pass token id which is given bellow link PHP API link
    APICallResponse.shared.getStripePayment(arrUserLoginDetails:          self.arrStripePayement,vc:self, completion: {data in
      self.SkripePayment = data 
    })
}
}

您可以从给定的链接中引用 PHP API

Stripe payment with php

关于android - iOS Stripe - 获取没有临时 key 的卡 token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50895767/

相关文章:

android - 在触摸相机屏幕时像默认相机一样调整android相机api中的亮度

Android - 我的简单 ListView/Toast 应用程序在启动时崩溃......有什么想法吗?

iOS:通过网络应用程序播放 RTSP 播放器

ios - 如何更改 cellforrowatindexpath 中的 contentView 框架?

ios - 编译 GLSL 着色器会破坏其他着色器

android - 运行 "flutter run"时出现 Flutter Stripe 错误

php - 自定义 Stripe 按钮不会触发 POST 方法

android - Xamarin.Forms(Android) 人脸检测器

ruby-on-rails - 格式化Stripe的时间戳

java - firebase getValue 方法没有按应有的方式从节点检索值