簡體   English   中英

使用客戶對象獲取最后4位卡-Stripe API

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

我正在使用Stripe API,並使用以下代碼獲取詳細信息-

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

我得到這個對象數據

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"
  }
]

我想獲取卡號的最后4位,exp_year,exp_month和address_zip。
請幫我得到這個字符串值

要獲取特定密鑰,您可以執行以下操作:

object.get(index)

對於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