title: Laravel Cashier Subscription v10.5
body: <p>I am trying to implement a subscription with Cashier. I am not using the user table but a customer table which I have defined OK in .env with</p>
  
  <pre><code>CASHIER_MODEL=App\Customer
  </code></pre>
  
  <p>The appropriate other fields are added to the customer table.</p>
  
  <p>I first wish to get some information on the customer so they fill in a simple form which includes their name, email, country and a password. I then save the customer->id as a session variable.</p>
  
  <p>I have a table of plans which contains the stripe subscription reference and the test reference. I have set these up in Stripe.</p>
  
  <p>After recording the customer details I take them to a view which is where they input their card details. The customer is found on this page as the id is passed to the view and also set a session variable.</p>
  
  <pre><code>$fs = App\Customer::find($id);
  $pl = App\Plan::find(3);
  $amount = $pl-&gt;cost * 100;
  session(['subscriber' =&gt; $id]);
  </code></pre>
  
  <p>Plan id 3 is my test plan but will be replaces when I get things to work and so my form is</p>
  
  <pre><code>&lt;form action="/subscriptionPayment" method="POST"&gt;
    @csrf
    &lt;script
            src="https://checkout.stripe.com/checkout.js" class="stripe-button"
            data-key="{{ env('STRIPE_KEY') }}"
            data-amount="{{ $amount }}"
            data-name="{{ $pl-&gt;name }}"
            data-email="{{ $fs-&gt;email }}"
            data-currency="gbp"&gt;
          &lt;/script&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This does record the stripeID in the table but not the last 4 numbers of the card or the card brand. (I am using 4242 4242 4242 4242).</p>
  
  <p>The controller method is</p>
  
  <pre><code>public function subscriptionPayment(Request $request)
    {
  
      $pl = Plan::find(3);
      $amount = $pl-&gt;cost *100;
      $cu = Cust::find( session('customer') );
  
      $paymentMethods = $cu-&gt;paymentMethods();
      $intent = $cu-&gt;createSetupIntent();
  
      $stripeToken = $cu-&gt;stripe_id;
      $cu-&gt;newSubscription($pl-&gt;name, $pl-&gt;test_stripe_plan)-&gt;create($stripeToken);     //test strip id
      return 'Charge successful, you get the course!';
  
      }
  
  }
  </code></pre>
  
  <p>I did dd the $intent which returned</p>
  
  <pre><code>Stripe\SetupIntent {#500 ▼
    +saveWithParent: false
    #_opts: Stripe\Util\RequestOptions {#503 ▶}
    #_originalValues: array:20 [▶]
    #_values: array:20 [▶]
    #_unsavedValues: Stripe\Util\Set {#490 ▶}
    #_transientValues: Stripe\Util\Set {#506 ▶}
    #_retrieveOptions: []
    #_lastResponse: Stripe\ApiResponse {#502 ▶}
    id: "seti_1FyFFyF7aDMrgjaujaPqH939"
    object: "setup_intent"
    application: null
    cancellation_reason: null
    client_secret: "seti_1FyFFyF7aDMrgjaujaPqH939_secret_GVFlyidVC9hiJVM3FDrXMoyxO0etcPL"
    created: 1578392750
    customer: null
    description: null
    last_setup_error: null
    livemode: false
    mandate: null
    metadata: Stripe\StripeObject {#512 ▶}
    next_action: null
    on_behalf_of: null
    payment_method: null
    payment_method_options: Stripe\StripeObject {#508 ▶}
    payment_method_types: array:1 [▶]
    single_use_mandate: null
    status: "requires_payment_method"
    usage: "off_session"
  }
  </code></pre>
  
  <p>The subscription fails with</p>
  
  <pre><code>No such PaymentMethod: cus_GVEuKhg2BUE7BB 
  </code></pre>
  
  <p>This is the correct customer number as recorded in the database.</p>
  
  <p>Help greatly appreciated indeed.</p>