在 Android 中实施 Stripe 时,CardInputWidget
会为您提供Card
个对象,然后您会从token
获得ephemeral key
Stripe API使用该卡,最后您将该令牌发送到您的服务器,这将收取费用。
在 iOS 中实施 Stripe 时,我发现工作流程完全不同。服务器需要有一个API端点来提供Stripe ephemeral key
。有没有办法在Android工作流程中执行此操作 - 没有$(document).ready(function() {
$("#password2").keyup(checkPasswordMatch);
$('#signup-button').click(function() {
$.ajax({
type: "POST",
url: "/cinestop/submitsignup",
data: getFormDataJSON(),
contentType: "application/json",
dataType: "json"
});
});
});
?
答案 0 :(得分:3)
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答案 1 :(得分:1)
是的,绝对可以使用Stripe的iOS SDK进行开发,而无需使用预先构建的UI或临时密钥方法。
您可以使用自己的表单或STPPaymentCardTextField
类,创建STPCardParams
个实例,然后创建一个STPToken
,您可以将其发送到后端。
STPCardParams *cardParams = [[STPCardParams alloc] init];
cardParams.number = @"4242424242424242";
cardParams.expMonth = 10;
cardParams.expYear = 2020;
cardParams.cvc = @"345";
[[STPAPIClient sharedClient] createTokenWithCard:cardParams completion:^(STPToken *token, NSError *error) {
...
}
}];
有关详情,请参阅https://stripe.com/docs/mobile/ios/custom#stpapiclient--stpcardparams。