title: PHP | Stripe API - check if customer have card attached
body: <p>I am trying to set up Stripe API to my website, but I ran into a problem. I need to check if the customer have a credit card attached to him, in order to process to subscribe to the plan.</p>
  
  <p>I cannot seem to find anything about this in their docs: <a href="https://stripe.com/docs/api#retrieve_customer" rel="nofollow">https://stripe.com/docs/api#retrieve_customer</a></p>
  
  <p>The output from a customer looks like this:</p>
  
  <pre><code>Stripe\Customer JSON: {
    "id": "CUSTOMER_ID",
    "object": "customer",
    "account_balance": 0,
    "created": 1474620297,
    "currency": "dkk",
    "default_source": null,
    "delinquent": false,
    "description": null,
    "discount": null,
    "email": "",
    "livemode": false,
    "metadata": {
    },
    "shipping": null,
    "sources": {
      "object": "list",
      "data": [
  
      ],
      "has_more": false,
      "total_count": 0,
      "url": "/v1/customers/CUSTOMER_ID/sources"
    },
    "subscriptions": {
      "object": "list",
      "data": [
  
      ],
      "has_more": false,
      "total_count": 0,
      "url": "/v1/customers/CUSTOMER_ID/subscriptions"
    }
  }
  </code></pre>
  
  <p>So, how to check if the customer have a credit card attached to him?</p>