Passing customer data to Stripe with Cashier.

Submitted by msurguy - 6 years ago

Laravel Cashier makes it easy to create subscription-based websites and collect money from customers. Passing an extra array to create() method allows passing data specific to Stripe's API along with creating a new subscription for the customer. To see which fields are supported check this section of Stripe's API:

public function postPro()
    $user = Auth::user();

    $user->subscription('premium')->create( Input::get('stripe_token'), ['description' => 'Customer info here', 'email' => Auth::user()->email] );

    $this->layout->content = View::make('', compact('user'));