#billhyuou
1 messages · Page 1 of 1 (latest)
i have ios code: class PaymentViewController: UIViewController {
// Your other view controller code here
func initiatePayment() {
// Call your server to create a Payment Intent with the necessary details,
// including 3DS support. The server will return the client secret.
let clientSecret = "YOUR_CLIENT_SECRET_FROM_SERVER"
// Create a PaymentIntentParams object
let paymentIntentParams = STPPaymentIntentParams(clientSecret: clientSecret)
// Optionally, set additional parameters if needed
paymentIntentParams.paymentMethodId = "YOUR_SELECTED_PAYMENT_METHOD_ID"
// Confirm the Payment Intent
STPPaymentHandler.shared().confirmPayment(withParams: paymentIntentParams, authenticationContext: self) { (status, paymentIntent, error) in
switch status {
case .succeeded:
// Payment succeeded, handle success scenario
break
case .failed:
// Payment failed, handle failure scenario
break
case .canceled:
// Payment canceled by the user, handle cancel scenario
break
default:
break
}
}
}
}
but i need android code, but i can't find be related to code
What are you trying to do?
use 3ds test and verify
Can I provide an Android code according to the iOS code
ios code is class PaymentViewController: UIViewController {
// Your other view controller code here
func initiatePayment() {
// Call your server to create a Payment Intent with the necessary details,
// including 3DS support. The server will return the client secret.
let clientSecret = "YOUR_CLIENT_SECRET_FROM_SERVER"
// Create a PaymentIntentParams object
let paymentIntentParams = STPPaymentIntentParams(clientSecret: clientSecret)
// Optionally, set additional parameters if needed
paymentIntentParams.paymentMethodId = "YOUR_SELECTED_PAYMENT_METHOD_ID"
// Confirm the Payment Intent
STPPaymentHandler.shared().confirmPayment(withParams: paymentIntentParams, authenticationContext: self) { (status, paymentIntent, error) in
switch status {
case .succeeded:
// Payment succeeded, handle success scenario
break
case .failed:
// Payment failed, handle failure scenario
break
case .canceled:
// Payment canceled by the user, handle cancel scenario
break
default:
break
}
}
}
}
Do you just want to accept payments on Android?
yes
If the user has 3ds, they can directly call SDK for payment
Can you provide an Android code based on the iOS code
You can use PaymentSheet and then 3DS will be taken care for you: https://stripe.com/docs/payments/accept-a-payment?platform=android&ui=payment-sheet
ok i try,thanks
Happy to help!