测试已测试 | ✓ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布上次发布 | Aug 2015 |
由 Phil Cohen、Jack Flintermann、Ray Morgan 维护。
PaymentKit 是用于在 iOS 应用中编写支付表单的工具库。
我们将 PaymentKit 组件的开发迁移到了我们的 主要 iOS SDK。这将使我们更容易保持它们最新,并使大多数应用的安装和集成更加简单。尽管如此,请注意,您不需要成为 Stripe 用户就可以使用这些组件——我们构建的界面不依赖于 Stripe API。
如果您使用 Cocoapods,要安装我们的 iOS SDK,只需将 pod 'Stripe'
添加到您的 Podfile
中。对于其他集成方式,请参阅我们的 安装指南。
我们将 PTKView
重命名为 STPPaymentCardTextField
。我们还提供了一个兼容性垫片,因此如果您有使用 PaymentKit 的应用,您无需更改任何代码即可迁移。但是迁移是非常直接的
Podfile
中删除任何对 'PaymentKit' 的引用。PTKView
实例重命名为 STPPaymentCardTextField
。#import 'PTKView.h'
的行,并用 #import <Stripe/Stripe.h>
替换它们。PTKViewDelegate
协议的任何类现在应采用 STPPaymentCardTextField
协议。PTKViewDelegate
方法// Before
- (void)paymentView:(nonnull PTKView *)paymentView withCard:(nonnull PTKCard *)card isValid:(BOOL)valid {
if (valid) {
[self doSomethingWithCard:card];
}
}
// After
- (void)paymentCardTextFieldDidChange:(STPPaymentCardTextField *)textField {}
if (textField.isValid) {
STPCard *card = [[STPCard alloc] init];
card.number = textField.cardNumber;
card.expMonth = textField.expirationMonth;
card.expYear = textField.expirationYear;
card.cvc = textField.cvc;
[self doSomethingWithCard:card];
}
}
如果您在迁移过程中遇到任何问题,请随时通过 [email protected] 联系我们。