获取带有条纹的最后一张二手信用卡

时间:2015-04-13 19:13:30

标签: stripe-payments


如您所知,Stripe会保存给定客户的所有二手信用卡,您可以通过API访问所有信用卡信息:

{
  object: "list",
  url: "/v1/customers/cu_15rCFB2eZvKYlo2CnkaAKSFt/sources",
  has_more: false,
  data: [
    <Card card id=card_15rCuj2eZvKYlo2CwY0fBAf3 at 0x00000a> JSON: {
      "id": "card_15rCuj2eZvKYlo2CwY0fBAf3",
      "object": "card",
      "last4": "4242",
      "brand": "Visa",
      "funding": "credit",
      "exp_month": 10,
      "exp_year": 2018,
      "country": "US",
      "name": "aysfzai@hotmail.com",
      "address_line1": null,
      "address_line2": null,
      "address_city": null,
      "address_state": null,
      "address_zip": null,
      "address_country": null,
      "cvc_check": "pass",
      "address_line1_check": null,
      "address_zip_check": null,
      "dynamic_last4": null,
      "metadata": {
      },
      "customer": "cus_63Iq2Qa90oQrmv"
    },
    <stripe.Card[...] ...>,
    <stripe.Card[...] ...>
  ]
}

我的问题是:

  1. 这些数据是如何订购的?
  2. 我如何获得最后一张信用卡?它是json响应的第一个元素还是最后一个?
  3. 如果有人有任何想法,我会很感激!

1 个答案:

答案 0 :(得分:0)

您是否在询问如何获取客户的这些数据?

如果是,那么:

\Stripe\Stripe::setApiKey( {stripe_secret_key} );
\Stripe\Customer::retrieve( {customer_id} ); 

要使用上述代码,您需要包含最新的Stripe.