title: No attached payment source for Stripe subscription creation
body: <p>I'm currently migrating my app from using the Stripe Charges API to use the Stripe PaymentIntents API, in order to comply with SCA regulations.  </p>
  
  <p>My subscription creation code roughly looks like this:</p>
  
  <pre><code>Map&lt;String, Object&gt; srchOpts = new HashMap&lt;&gt;();
  srchOpts.put("email", userEmail);   
  
  List&lt;Customer&gt; matchingCustomers = Customer.list(srchOpts).getData();
  Customer customer = null;
  Subscription subscription = null;
  
  if ( matchingCustomers.isEmpty() ){
      Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;();
      params.put("email", userEmail);
      params.put("payment_token", stripeToken);
      customer = Customer.create(params);
  }
  else if (matchingCustomers.size() == 1) {
      customer = matchingCustomers.get(0);
      Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;();
      params.put("source", stripeToken);
      PaymentSourceCollection paymentSources = customer.getSources();
      paymentSources.create(params);
  }
  
  Map&lt;String, Object&gt; item = new HashMap&lt;String, Object&gt;();
  item.put("plan", planId); // e.g. my-pro-plan (no trial days)
  
  Map&lt;String, Object&gt; items = new HashMap&lt;String, Object&gt;();
  items.put("0", item);
  
  Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;();
  params.put("items", items);
  
  params.put("customer", customer.getId());
  params.put("off_session", false);
  subscription = Subscription.create(params); 
  </code></pre>
  
  <p>I can see on the Stripe dashboard (in test mode) that the customer is created and has the card which I specified, but the Subscription.create call fails with:</p>
  
  <blockquote>
    <p>com.stripe.exception.InvalidRequestException: This customer has no attached payment source; code: resource_missing</p>
  </blockquote>
  
  <p>The customer has a card set (there is only 1 so it has to be the default card), the customer creation call happens before the subscription creation call and the customer ID is being passed to the sub creation call. Is there some other parameter I need to pass in?</p>
  
  <hr>
  
  <p>I've tried setting <code>Customer.invoice_settings.default_payment_method</code> when the customer is being created, and that gets me past the subscription creation. Everything looks fine from the Stripe dashboard, except that I'm testing with an SCA test card, so the transaction is incomplete until the customer has authenticated further.  </p>
  
  <p>I need the client secret token from the response to continue, and I thought that I would get it from <code>#Subscription.getLatestInvoiceObject().getPaymentIntentObject().getClientSecret()</code> but the <code>getLatestInvoiceObject()</code> call is returning <code>null</code>.  </p>
  
  <p>I'm not setting <code>collection_method</code> on the Subscription object which defaults to <code>charge_automatically</code>. This is what I want because the customer is on-session and so the <code>Invoice</code> being <code>null</code> probably makes sense, but how do I get the client secret to pass back to the frontend? The <code>SetupIntent</code> object returned by the subscription response exposes a client secret, but that object is <code>null</code> too. </p>