Laravel Cashier : Stripe Setup

Configure stripe billable payment gateway


Requirements

Stripe authenticates your API requests using your account’s API keys. If you do not include your key when making an API request, or use one that is incorrect or outdated, Stripe returns an error.

For use laravel cashier stripe you need two types of API keys: publishable and secret.

  • Publishable API keys are meant solely to identify your account with Stripe, they aren’t secret. In other words, they can safely be published in places like your Stripe.js JavaScript code, or in an Android or iPhone app.
  • Secret API keys should be kept confidential and only stored on your own servers. Your account’s secret API key can perform any API request to Stripe without restriction.

For Create Custom Plan for the users, you need to a stripe product, and two types of Parameter: Product Id and Price ID.
Example :

Key Value
Product Id prod_IYzhtY9NCfLSPo
Price Id price_1HxrR2Lcy8fLfdopdj5oiogz7

Get the Key

Please login/register to stripe, Your API keys are always available in the Stripe Dashboard. For your convenience, your test API keys for your account are:

Key Value
Publishable pk_test_TYooMQauvdEDq54NiTphI7jx
Secret sk_test_4eC39HqLyjWDarjtT1zdp7dc

You can get your own key, Please click below.
get key

Stripe Configuration

Next, you should configure your Stripe API keys in your application's .env file. open .env file and change the value of STRIPE_KEY and STRIPE_SECRET

STRIPE_KEY=your-stripe-key

STRIPE_SECRET=your-stripe-secret

if you have any doubt, or want to know more about laravel cashier Please visit the link.

Detail Documentation

Get Stripe Product

Here some step to create a stripe product, we will use this product in our membership plan latter, if you want to know more detail please read Detail Documentation

  • Log into your Stripe Dashboard and navigate to the Products dashboard.
  • Click on the + Add Product button.
  • Add a price to your product,Please select recurring payment mode.

Create Plan

Please login to your website admin panel, navigate to the Plans, Here is list of plans, free plan is system plan, you cannot delete it, you can only edit Free Plan settings, Click on the + Add New button to add new plan.

Fill all the details.

Done :)