<style>.woocommerce-product-gallery{ opacity: 1 !important; }</style>


Stripe payment

What does it do?

This module allows your users to pay with credit card (via Stripe) to access premium features.

Notice: this module only handles payment and changes users.premium field from 0 to 1. It doesn't take care of any internal logic of what that "premium" user actually can access, that should be your custom code.

How does the result look in QuickAdminPanel code?

First, we add a field users.premium with default value 0, potentially changed to 1 after successful payment.

Then we add this package to composer.json:

"stripe/stripe-php": "^3.21"

Next step - separate Controller for the actual payment:

class StripeUpgradesController extends Controller
    public function index(Request $request)
        return view('admin.stripe_upgrades.index');

    public function store(Request $request)

        $transaction = StripeTransaction::create([
            'amount' => 19.99,
            'transaction_user_id' => Auth::id()

        $user = User::where('id', Auth::id())
                'premium' => 1

        return redirect()->back()->with('success', 'Payment completed successfully.');

    public function createStripeCharge($request)

        try {
            $customer = Customer::create([
                'email' => $request->get('stripeEmail'),
                'source'  => $request->get('stripeToken')

            $charge = Charge::create([
                'customer' => $customer->id,
                'amount' => 1999,
                'currency' => "usd"
        } catch (\Stripe\Error\Base $e) {
            return redirect()->back()->withError($e)->send();

In view file for this payment we have this form:

<form action="{{ route('admin.stripe_upgrades.store') }}" method="POST">
            src="https://checkout.stripe.com/checkout.js" class="stripe-button"
            data-key="{{ env('PUB_STRIPE_API_KEY') }}"
            data-name="Job Scheduling"
            data-label="Pay 19.99 USD to Upgrade"
            data-description="Upgrade to premium"
    {{ csrf_field() }}

And then we have a separate Controller to view all the transaction - for administrator.

class StripeTransactionsController extends Controller

    public function index()
        if (! Gate::allows('stripe_transaction_access')) {
            return abort(401);

        $stripe_transactions = StripeTransaction::all();

        return view('admin.stripe_transactions.index', compact('stripe_transactions'));

How to install/use the module?

First, go to your panel's Modules menu item, find the module in the list and click Install.

Then, fill in Stripe credential variables STRIPE_API_KEY and PUB_STRIPE_API_KEY in your .env file.

More information