如何将Stripe checkout集成到android? 我知道如何在Ios中做到这一点,但Android实现听起来很复杂 我已经读过了 https://stripe.com/docs/mobile/android 和 https://github.com/stripe/stripe-android
我不想使用带有条纹的Android支付。其他选项我正在创建一个自定义支付表格......这并不容易。 在Ios中,您可以通过几行代码完成此操作。这是它在Ios中的表现。 我想知道是否有类似易于使用的android.Thanks代码
func stripePayment() {
PaymentType = "2"
let options = STPCheckoutOptions()
options.publishableKey = stripePublishableKey
if (appleMerchantId != "") {
options.appleMerchantId = appleMerchantId
}
options.companyName = "Create Delivery"
options.purchaseDescription = "CreateDelivery"
// options.purchaseCurrency = "USD"
options.purchaseAmount = UInt(createDeliveryPrice)
println(options.purchaseAmount)
options.logoColor = UIColor(red: 0.0/255.0, green: 183.0/255.0, blue: 255.0/255.0, alpha: 1.0)
let presenter = STPPaymentPresenter(checkoutOptions: options, delegate: self)
presenter.requestPaymentFromPresentingViewController(self)
}
func paymentPresenter(presenter: STPPaymentPresenter!, didCreateStripeToken token: STPToken!, completion: STPTokenSubmissionHandler!) {
createBackendChargeWithToken(token, completion: completion)
}
func paymentPresenter(presenter: STPPaymentPresenter!, didFinishWithStatus status: STPPaymentStatus, error: NSError!) {
self.dismissViewControllerAnimated(true, completion: {
switch(status) {
case .UserCancelled:
return // just do nothing in this case
case .Success:
self.UploadData()
println("great success!")
case .Error:
println("oh no, an error 111:")
}
})
}
// This is optional, and used to customize the line items shown on the Apple Pay sheet.
func paymentPresenter(presenter: STPPaymentPresenter!, didPreparePaymentRequest request: PKPaymentRequest!) -> PKPaymentRequest! {
request.paymentSummaryItems = [
PKPaymentSummaryItem(label: "Create Delivery", amount: NSDecimalNumber(string: DeliveryPriceText)),
PKPaymentSummaryItem(label: "shipping", amount: NSDecimalNumber(string: "0.00"))
]
return request
}