#Mehedi-Apple pay
1 messages · Page 1 of 1 (latest)
can we test apple pay from Bangladesh, we are facing difficulties with this
have you followed this guide? https://stripe.com/docs/apple-pay
yes. but the problem is our codebase is from 2017 and our app uses apple pay and credit cards both using stripe.
is there any way we can use stripeapplepay separately
how are you implementing Stripe?
we are using pod 'Stripe'
using import Stripe
then for function
func openApplePay() {
let paymentNetworks = [PKPaymentNetwork.amex, .discover, .masterCard, .visa]
if PKPaymentAuthorizationViewController.canMakePayments(usingNetworks: paymentNetworks) {
let paymentItem = PKPaymentSummaryItem.init(label: "Trip Payment", amount: NSDecimalNumber(value: self.txtTipAmount.text!.toDouble()))
let request = PKPaymentRequest()
request.currencyCode = CurrentTrip.shared.currencyCode//"USD" // 1
request.countryCode = CurrentTrip.shared.currentCountryCode//"US"// 2
request.merchantIdentifier = "merchant.com.baronfleet" // 3
request.merchantCapabilities = PKMerchantCapability.capability3DS // 4
request.supportedNetworks = paymentNetworks // 5
request.paymentSummaryItems = [paymentItem] // 6
guard let paymentVC = PKPaymentAuthorizationViewController(paymentRequest: request) else {
displayDefaultAlert(title: "Error", message: "Unable to present Apple Pay authorization.")
return
}
paymentVC.delegate = self
Utility.hideLoading()
self.present(paymentVC, animated: true, completion: nil)
} else {
displayDefaultAlert(title: "Error", message: "Unable to make Apple Pay transaction.")
}
}
one thing to note is that our credit card payment is working fine
what's the exact error you get and the code that generates it?
How do you test it exactly? On a physical device or simulator.app? What type of card do you have in your Apple Pay wallet?
in a physical device. the card was Mastercard added to the wallet. here is the screen recording
thanks, the video helps, but can you debug the code a little more?
for example, what is your implementation of the didAuthorizePayment delegate?
what do you do with the PKPayment object returned(do you send it to your backend server? Is your backend server handling it? etc)
thanks for the heads up. Unfortunately, this code was already implemented with the product we got. we will check and follow your advice