#Mehedi-Apple pay

1 messages · Page 1 of 1 (latest)

ebon bloom
#

👋 happy to help

supple ore
#

can we test apple pay from Bangladesh, we are facing difficulties with this

ebon bloom
supple ore
#

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

ebon bloom
#

how are you implementing Stripe?

supple ore
#

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

umbral raptor
#

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?

supple ore
#

in a physical device. the card was Mastercard added to the wallet. here is the screen recording

umbral raptor
#

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)

supple ore
#

thanks for the heads up. Unfortunately, this code was already implemented with the product we got. we will check and follow your advice