【问题标题】:How to get CardType / Payment Network Type for Android Pay如何获取 Android Pay 的 CardType / 支付网络类型
【发布时间】:2016-06-20 17:58:23
【问题描述】:

目前:

maskedWallet.getPaymentDescriptions()[0].substring(0,maskedWallet.getPaymentDescriptions()[0].indexOf("-")); 

会给我卡类型(VISA/AMEX/MASTERCARD/DISCOVER)。 例如:maskedWallet.getPaymentDescriptions()[0] 具有字符串值“VISA-1008”。

当找不到“-”时,上述方法抛出索引越界异常。

现在我已经更新了代码以从 dpan(Android Pay 提供的虚拟帐户#)获取支付网络类型/卡类型,使用的方法与根据信用卡号为我们提供卡类型的方法相同(这里我使用了 dpan而不是 CC#)。

我想知道如果 CardType 是 Android Pay 交易,是否有更好的方法来获取它?

【问题讨论】:

    标签: android android-pay


    【解决方案1】:

    来自 onActivityResults() 中收到的 MaskedWallet 对象{}

    String card_type = mMaskedWallet.getInstrumentInfos()[0].getInstrumentType();
    String card_num = mMaskedWallet.getInstrumentInfos()[0].getInstrumentDetails();
    
    String cardholder_name =  mMaskedWallet.getBuyerBillingAddress().getName();
    

    更多信息请参考文档: https://developers.google.com/android/reference/com/google/android/gms/wallet/MaskedWallet.html#getInstrumentInfos()

    【讨论】:

      猜你喜欢
      • 2021-11-11
      • 2016-05-14
      • 2020-10-22
      • 2021-11-21
      • 1970-01-01
      • 2014-08-20
      • 1970-01-01
      • 2019-09-03
      • 2020-02-17
      相关资源
      最近更新 更多