All Projects → tnylea → laravel-cashier-examples

tnylea / laravel-cashier-examples

Licence: other
Examples of using Laravel Cashier v.10

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects
Vue
7211 projects

Projects that are alternatives of or similar to laravel-cashier-examples

cashier-register
Cashier Register is a simple quota feature usage tracker for Laravel Cashier subscriptions.
Stars: ✭ 93 (-12.26%)
Mutual labels:  stripe, laravel-cashier, cashier
marketplace
A file sharing website using Laravel 5.5
Stars: ✭ 19 (-82.08%)
Mutual labels:  stripe
discourse-subscriptions
A Discourse plugin that allows payments and subscription management via Stripe.
Stars: ✭ 24 (-77.36%)
Mutual labels:  stripe
nean-stack-starter
neo4j, express, angular, node
Stars: ✭ 30 (-71.7%)
Mutual labels:  stripe
invoicing
GetPaid (Formerly the Invoicing plugin) is a lightweight Payments and Invoicing system for WordPress. It can be used to sell anything online via payment forms or buy now buttons that can be added to any landing page. It can also be used by freelancers to manage their Invoices or by 3rd party Themes and Plugins as their payment system. GeoDirecto…
Stars: ✭ 34 (-67.92%)
Mutual labels:  stripe
cashier-paystack
Cashier provides an expressive, fluent interface to Paystack's subscription billing services.
Stars: ✭ 44 (-58.49%)
Mutual labels:  laravel-cashier
proof-of-kyc
An NFT that proves you've gone through an identity verification process, powered by Stripe Identity.
Stars: ✭ 78 (-26.42%)
Mutual labels:  stripe
Business-Stripe
Perl bindings for Stripe payment system
Stars: ✭ 21 (-80.19%)
Mutual labels:  stripe
ethibox
Open-source web apps hoster
Stars: ✭ 130 (+22.64%)
Mutual labels:  stripe
wp-simple-pay-lite
Add high conversion Stripe payment forms to your WordPress site in minutes.
Stars: ✭ 31 (-70.75%)
Mutual labels:  stripe
react-native-stripe
Unofficial integration of the payment APIs from the Stripe SDK on react-native
Stars: ✭ 21 (-80.19%)
Mutual labels:  stripe
netlify-lambda-function-example
An example Netlify Lambda function that processes payments with Stripe.
Stars: ✭ 93 (-12.26%)
Mutual labels:  stripe
laravel-stripe-connect
🦓 Stripe Connect binding for Laravel
Stars: ✭ 73 (-31.13%)
Mutual labels:  stripe
koa-better-error-handler
A better error-handler for Lad and Koa. Makes `ctx.throw` awesome (best used with koa-404-handler)
Stars: ✭ 51 (-51.89%)
Mutual labels:  stripe
SAAS-Starter-Kit-Pro
🚀A boilerplate for building Software-as-Service (SAAS) apps with Reactjs, and Nodejs
Stars: ✭ 313 (+195.28%)
Mutual labels:  stripe
charging-for-multiple-plan-subscriptions
Getting started with Stripe Elements and Stripe Billing to charge a customer for a monthly subscription with multiple items.
Stars: ✭ 54 (-49.06%)
Mutual labels:  stripe
memberful-wp
Better membership software for WordPress.
Stars: ✭ 37 (-65.09%)
Mutual labels:  stripe
stripe
Stripe integration with Magento 2
Stars: ✭ 58 (-45.28%)
Mutual labels:  stripe
netlify-stripe-subscriptions
An example of managing subscriptions with the Stripe Customer Portal and Netlify Identity.
Stars: ✭ 96 (-9.43%)
Mutual labels:  stripe
payment-form-modal
How to implement Stripe Elements within a modal dialog.
Stars: ✭ 108 (+1.89%)
Mutual labels:  stripe

Laravel Cashier Examples

Laravel Cashier Examples image

The Laravel Docs are great... But, there are a few things that seemed to be missing in the Laravel Cashier Documentation, such as basic examples of how to submit the payment form in order to capture payment on the other end. Don't get me wrong, the docs are still amazing, but I wanted to create these examples that anyone can download and easily view a working version of Cashier.

This repo contains 2 examples of accepting payments:

  1. Accepting Payment Up Front on the Register Page master and example3 branch
  2. Accepting Payment for the currently logged in user example2 and example4 branch.

Installation

The install instructions are the same for both examples. After installing you can switch between the 2 branches to test each example. These install instructions assume that you are using Laravel Valet or a similar Laravel local server:

1. Clone the repo

git clone https://github.com/tnylea/laravel-cashier-examples.git

2. Change directories and install dependencies

cd laravel-cashier-examples
composer install

3. Add your database & stripe credentials

Next, copy or rename .env.example to .env. Then you'll need to create a new database and add your database credentials to the .env file.:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel-cashier-examples
DB_USERNAME=root
DB_PASSWORD=

We also want to add our Stripe API keys. Head on over to Stripe dashboard, and under the Developer->API Keys section you'll find your Publishable key and your Secret key:

stripe dashboard image

Add these keys to the bottom of your .env file:

# Test Keys
STRIPE_KEY=pk_test_RKDJpn1L9eRdJOBF3WfaLKRR00VbHCT6ju
STRIPE_SECRET=sk_test_SomeReallyL0ngRand0m5tring...

4. Create a new Stripe Product

When a user enters their Credit Card Info, they are signing up for your product and Stripe needs to know a bit about your product, so we need to create a new product inside of Stripe.

Inside your stripe dashboard, go to Billing->Products, and click to Add a New product:

products page image

For this example, I will give my a product a name of Laravel Cashier Example, and click Create Product:

stripe plan image

Next, we need to create a Pricing Plan for our product. We can add as many Pricing plans to a product as we would like, but in this example we will just add one pricing plan called starter, this will be the plan ID:

pricing page image

Then click on Add pricing plan, and we've just created our first pricing plan 🙌

5. Run The Database Migrations

php artisan migrate

6. Test it out 🤙 You're now accepting payments 💳

Example 1 Test

For example1 (master), you can visit your app /register route and you will see the Credit Card field:

register page image

Try signing up with the following credentials to test it out:

Credit Card Number: 4242 4242 4242 4242
Expires: 04/24
CVC Code: 242
Zip: 42424

And after signing up, you will be redirected to your application dashboard:

dashboard image

There will now be a new user in your database. You will also see a new entry in the subscriptions table:

database image

Additionally, if you login to your stripe dashboard you will see that you now have a new customer.

stripe purchase image

🔮 Magic!

Example 2 Test

Make sure to checkout the example2 branch to "Checkout" this example:

In example2 the user can register for an account without adding a credit card at signup. Register for an account and you will see a Credit Card Input on the dashboard:

example 2 dashboard image

You'll see that on the dashboard there is also a message stating that you are not subscribed to any plan.

Try entering the following Credit Card info and subscribing:

Credit Card Number: 4242 4242 4242 4242
Expires: 04/24
CVC Code: 242
Zip: 42424

Upon entering the credit card info and clicking the Subscribe button, you will be redirected back to the dashboard showing a message that you are a subscribed customer 🤟

dashboard subscribed image

You will also see a new entry in the subscriptions table of your application, and you'll see a new customer in your Stripe Dashboard.

👻 Scary Awesome!

Example 3 & Example 4

Example 3 is similar to the master branch Example 4 is similar to example 3.

The difference between example 3 and 4 is that they are able to support [SCA] (https://laravel.com/docs/6.x/billing#strong-customer-authentication).

Master and Example 2 are leveraging the following JS method:

stripe.createPaymentMethod

Whereas Example 3 and 4 are leveraging the following JS method:

stripe.handleCardSetup These will handle any kind of SCA or Dynamic 3D Secure functionality. It might be ideal to stick with either Example3 or 4. If you use master or example 2, you'll want to manually redirect the user to the SCA page after they have purchased: Payments Requiring Additional Confirmation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].