How developer will get to know which card type user (Amex, visa, discovery) has selected in swift?

is am using This delegate method, but i am getting type of card(debit/credit) info i want to know this card is from mastercard / visa or amex.

func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didSelectPaymentMethod paymentMethod: PKPaymentMethod) async -> PKPaymentRequestPaymentMethodUpdate { print(paymentMethod.displayName ?? "") return PKPaymentRequestPaymentMethodUpdate(paymentSummaryItems: payemntRequest.paymentSummaryItems) }

Hi @rahulbandal,

You wrote:

[...] I want to know this card is from mastercard / visa or amex. [...]

Use the PKPaymentMethod object for this, however, the displayName you've provided above is not standardized and each issue can modify its contents (or provide none). Please note the following:

To protect the user’s privacy, Apple Pay sets the display name only after the user authorizes the purchase. You can safely access this property as soon as the system calls your PKPaymentAuthorizationControllerDelegate instance's paymentAuthorizationController(_:didAuthorizePayment:handler:) method.

Alternatively, what you're looking for is the PKPaymentNetwork, which can be found as a String value via PKPaymentMethod.network. The same privacy notice above applies with this API as well.

Cheers,

Paris

How developer will get to know which card type user (Amex, visa, discovery) has selected in swift?
 
 
Q