简体   繁体   English

使用客户对象获取最后4位卡-Stripe API

[英]Getting Last 4 Digits of Card using Customer Object - Stripe API

I am using Stripe API and using below code I fetch details - 我正在使用Stripe API,并使用以下代码获取详细信息-

Customer cu = Customer.retrieve(customerid); // customerid
List<ExternalAccount> object = cu.getSources().getData();
Log.d("customerobj",object + "");

I get this object data 我得到这个对象数据

D/customerobj: [
  <com.stripe.model.Card@148232829id=>JSON: {
    "address_city": null,
    "address_country": null,
    "address_line1": null,
    "address_line1_check": null,
    "address_line2": null,
    "address_state": null,
    "address_zip": "71000",
    "address_zip_check": "pass",
    "available_payout_methods": null,
    "brand": "Visa",
    "country": "US",
    "currency": null,
    "cvc_check": "pass",
    "default_for_currency": null,
    "description": null,
    "dynamic_last4": null,
    "exp_month": 4,
    "exp_year": 2021,
    "fingerprint": "EmNhHLSbWLElhMvG",
    "funding": "credit",
    "iin": null,
    "issuer": null,
    "last4": "4242",
    "name": null,
    "recipient": null,
    "status": null,
    "three_d_secure": null,
    "tokenization_method": null,
    "type": null,
    "account": null,
    "customer": "cus_DL2GSWX9bfTZeU",
    "id": "card_1CuMC8A41bIzZYFFlpiW3hZp",
    "metadata": {

    },
    "object": "card"
  }
]

I want to get last 4 digits card number, exp_year, exp_month and address_zip. 我想获取卡号的最后4位,exp_year,exp_month和address_zip。
Please help me get this String values 请帮我得到这个字符串值

To get a specific key you can do: 要获取特定密钥,您可以执行以下操作:

object.get(index)

For exp_month, you would do object.get(16) , for exp_year, you would do object.get(17) and for last4 you would do object.get(22) 对于exp_month,您将执行object.get(16) ;对于exp_year,您将执行object.get(17) ;对于last4,您将执行object.get(22)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM