PayPal Payment Integration with PHP, Laravel and Symfony
- Description
- Curriculum
- FAQ
- Reviews
PayPal is the most popular online payment gateway. In this course we will learn how to accept payments for products and services from customers by implementing real web applications in PHP language. This course uses PayPal SDKs V1.
In this course I will focus on PayPal Checkout service and its implementation in PHP using PayPal rest api which is the newest and the best way to handle online payments provided by PayPal. Thanks to it, we can accept online payments for single or multiple products and services, handle subscriptions, automatically handle transaction notifications from PayPal, etc.
We will learn PayPal integration (PayPal Checkout) in PHP by building two real applications: a simple shopping cart and a small video subscription application. I will make each of these applications from scratch in three versions:
-
in pure PHP, using model-view-controller approach (files included for every coding lecture)
-
in Laravel and Symfony php frameworks with real, secure login and registration system (files included for every coding lecture)
PayPal Checkout is the newest rest api based solutions to handle payments. It is very flexible. You can build with it whatever you want including:
-
e-commerce website with multiple products to sell
-
website with single product or service to sell
-
subscription billing websites
-
backend for your mobile application
You will also learn and implement PayPal Webhooks – rest api based solution to handle automatic transaction notifications. For example, if a user cancels his subscription from his PayPal account, the application will be notified about that and an administrator can reject access to videos etc. To test these notifications we will deploy our subscription application to Heroku.
If you want to learn PayPal integration in PHP by building practical examples this course is for you.
QA
Question:
You used Laravel 5 in this course for creating an app to practice PayPal integration. Now we have Laravel 8 already. Does it mean that this course is outdated and I will not benefit from it?
Answer:
Absolutely not! In tools like PHP frameworks the fundamentals and base syntax almost never change regardless of the version. But of course any maintained software evolves all the time. That’s why I always suggest you to use the version of software that instructor uses in the course. It prevents from errors and confusions. As a someone who wants to learn web development you should be aware, that real web development involves also adapting the code to newer versions if necessary – but this is not always necessary, not every company do that. Software changes so often that the instructors would not be able to create the courses so that they match the latest version. This is not even advisable, because as a student you would loose an important aspect of real web development – the awareness that everything is changing and you need to be able to deal with it.
-
1Welcome to the course
What is PayPal and online payment processing. How we will learn it
-
2Installation info
-
3Course outline & recommended learning paths
What we will learn and learning paths
-
4What we are going to build in this course
Present all applications that we will build in this course - shopping cart and subscription service made 3 times from scratch (PHP, Laravel, Symfony = 6 apps)
-
5How PayPal Checkout works
Explain entire checkout flow from choosing product or products on the website up to payment confirmation
-
6PayPal Standard vs PayPal Checkout
Why it is better to use PayPal Express Checkout than PayPal Standard
-
7How PayPal Subscription works
Explain entire checkout flow from choosing subscription on the website up to payment confirmation
-
8PayPal Rest SDKs and APIs
About PayPal's software development kits and application programming interfaces
-
9Discussing html templates for the applications
What websites and libraries I used to build html templates for shopping cart website and simple subscription application
-
10Move html template to php application
Divide html code to header, footer and views. Move it to php app
-
11Create Router class to manage requests
We are building MVC-based application so first thing is to create Router class that calls a controller for loading a view based on url parameter
-
12Create a controller for our application
Instead of handling requests directly in the Router make controller for this and call it from the Router
-
13Create database & model for shop products
Create database with sample shop products. Make Products model for interacting with the database
-
14Display shop products on main page
Fetch shop products from the database and display them on the main page
-
15Make use of session
Start session and create FakeLogin class
-
16Login and logout functionality in the application
Use FakeLogin class to authenticate users. Display logged in user data on the website
-
17Create shopping cart class
Create ShoppingCart class and use it to add item to cart
-
18Show total price and total amount of products in shopping cart
Show total price and total amount of products in shopping cart. Create method for updating total price and total amount
-
19Display products from shopping cart on cart page
Display products from shopping cart on cart page
-
20Display products from shopping cart on checkout page
Display products from shopping cart on checkout page
-
21Update product quantities
Update product quantities
-
22Delete products from cart
Delete products from cart. Make use of session
-
23Create PayPal business account & REST API application
Create PayPal business account to accept payments from buyers. Create sandbox accounts. Create REST API application (inside PayPal account) to receive http calls for live transactions
-
24Create payment using PayPal REST API
Send products from user session cart to PayPal through its api
-
25Execute and confirm PayPal payment
Execute and confirm PayPal payment and store payment details on the buyer side
-
26Move html template to php application
Divide html code to header, footer and views. Move it to php app
-
27Create Router class to manage requests
We are building MVC-based application so first thing is to create Router class that calls a controller for loading a view based on url parameter
-
28Create a controller for our application
Instead of handling requests directly in the Router make controller for this and call it from the Router
-
29Login and logout functionality in the application
Create and use FakeLogin class to authenticate users. Display logged in user data on the website
-
30Show videos to users that are logged in and have subscription active
Authorize users to show them videos
-
31Create simple file database to store subscription status
Create simple file database to store subscription status (whether it is active or not)
-
32Create PayPal business account & REST API application
Create PayPal business account to accept subscriptions from subscribers. Create sandbox accounts. Create REST API application (inside PayPal account) to receive http calls for live transactions
-
33Create subscription plan
Administrator must first create a billing plan to allow subscribers to subscribe to
-
34Activate created billing plan
Activate created billing plan. Use __call magic class method to handle easier PayPal methods
-
35Show all subscriptions plans
Show all subscriptions plans that an administrator created
-
36Delete subscription plan
Administrator can delete subscription plan
-
37Create subscription agreement
A user that wants to subscribe, first has to create subscription agreement
-
38Execute subscription agreement
After creating subscription agreement the user has to log in to his PayPal account and confirm the agreement
-
39Heroku deployment - create an account and first app
We need to deploy our subscription application to live server because we are going to test cancelling subscription functionality (a user may cancel his subscription and then PayPal must talk to our server to inform us what happened)
-
40Deploy subscription application to Heroku
Deploy subscription application to Heroku live server & live domain
-
41Create PayPal webhook to listen to the events
A user may cancel his subscription manually every time or subscription may expire itself. In such situations we need to reject access to video service in our application
-
42Move html template to Laravel application by using Laravel Blade
Install Laravel app. Divide html code to header, footer and views. Move it to Laravel app
-
43Create controller for the application
Instead of loading views from the routing file, make a controller for this
-
44Create sqlite database connection and migration file
Create sqlite database connection and migration file to create database tables
-
45Create database seeder
Create database seeder to fill database with sample product data
-
46Display shop products dynamically on the website
Fetch data from the database and display shop products on the website
-
47Create shopping cart service & addToCart method
Create shopping cart service & addToCart method. We use session to store chosen shop products
-
48Display products on cart page
A user adds products to shopping cart. Display them on the cart subpage
-
49Display products on checkout page
A user finishes adding products to shopping cart and wants to pay. Display products on the checkout subpage
-
50Display total price and total amount of products
Calculate total price and total amount of products that a client purchased. Then display it on the page
-
51Delete a product from the shopping cart
Delete a product from the shopping cart and update total amount & price
-
52Update product quantities
Update product quantities
-
53Login & registration system
In Laravel framework making login and registration functionality is a breeze
-
54Create payment after collecting products in shopping cart
We need to send products to PayPal after collecting them in shopping cart. Create controller method for this. Only users logged in are allowed to perform this action
-
55Create PayPal service and finish creating payment
Install PayPal RestApi package using composer. Create PayPal account. Create PayPal service inside Laravel app and finish creating payment
-
56Execute PayPal payment
After creating a payment and login in to PayPal account, a user must confirm his payment
-
57Move html template to Laravel application by using Laravel Blade
Install Laravel app. Divide html code to header, footer and views. Move it to Laravel app
-
58Create controller for the application
Instead of loading views from the routing file, make a controller for this
-
59Create sqlite database connection and migration file
Create sqlite database connection and migration file to create users table in the database
-
60Login & registration system
In Laravel framework making login and registration functionality is a breeze
-
61Create subscription plan
An administrator first must create a billing plan that a subscriber will be subscribed to. Install PayPal Rest Api composer package. Create PayPal controller & method
-
62Activate created plan
After an administrator creates a plan, he needs to activate it to allow a user to subscribe to it. Create a trait to get PayPal rest app credentials
-
63Display all plans
Display all plans data that the administrator created
-
64Delete a subscription plan
The administrator can delete subscription plan
-
65Authorize actions using Laravel middleware
Only an administrator can create subscription plans, delete them, etc.
-
66Create a subscription agreement
After the administrator created a subscription plan and activated it, a user is able to subscribe to it. First he has to creeate an agreement
-
67Execute the subscription agreement
After a user log in to his PayPal account he must confirm the subscription agreement (execute it)
-
68Prepare the subscription application for uploading to Heroku
We need to test cancelling subscription by the user. And because of that we need to upload our app to live server
-
69Create webhook handler to reject access to videos in special cases
Webhook handler handles PayPal request to our application if a user cancels his subscription or it expires, etc.
-
70Deploy to Heroku and test cancelling subscription
Deploy subscription application to Heroku and test cancelling subscription
-
71Move html template to Symfony application by using Twig template system
Install Symfony app. Divide html code to header, footer and views. Move it to Symfony app
-
72Create database connection and Product entity to operate on cart products
Create database connection and Product entity to operate on cart products
-
73Load sample shop products data using fixtures in Symfony
Load sample shop products data using fixtures in Symfony so that they are ready to be displayed on the page
-
74Display shop products on the website
After we created database and sample product data, we are able to display it on the website
-
75Link application pages
Make links between application pages and create method for adding a product to the cart
-
76Create Shopping Cart service and method for adding products to shopping cart
Create Shopping Cart service and method for adding products to shopping cart. First we need to create a special session service to handle multilevel array values stored in the session
-
77Display cart products from the session on cart page
A user adds products to cart. We store them in the session and display on the cart page
-
78Update total amount of products and total price
After a user adds products to cart we need to update total quantity and total price in shopping cart
-
79Display cart products from the session on checkout page
After a user added products to the cart he can display it on the checkout page
-
80Remove product from the cart
Remove product from the cart by clearing session item
-
81Update product quantities
A user may want to change product quantities. We have to handle this
-
82Login system in Symfony
Create a special user entity for authentication purposes. Create entire login scaffolding (login form, etc.) with one console command
-
83Registration system in Symfony
Create registration system in Symfony with one console command
-
84Create logout functionality
Create logout functionality. Recognize that a user is logged in or not
-
85Create payment for cart products
Install PayPal SDK and use it to create payment. Create PayPal sandbox account
-
86Execute PayPal payment
After creating a payment and login in to PayPal account, a user must confirm his payment for shopping cart products