Download the PHP package pleets/laravel-paypal without Composer
On this page you can find all versions of the php package pleets/laravel-paypal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-paypal
Laravel integrator for PayPal solutions. Actually this library supports the following solutions:
- Checkout
- Subscriptions
1. Requirements
You need to make sure your server meets the following requirements.
- PHP >= 7.4, PHP >= 8.0
- Laravel 7.x, 8.x
2. Installation
Use following command to install this library:
Add the service provider to your providers[]
array in config/app.php
file like:
Finally, publish the vendor files.
3. Usage
3.1 Live and Sandbox environments
Set up first API credentials for sandbox with the following env vars.
For live environment set up the following.
You can choose your current environment with the following.
The only valid values for this are sandbox
and live
.
3.2 Checkout
Activate paypal checkout with the following env var.
Add the PayPal SDK to your blade templates as follows
:bulb: You don't have to be worried about when to include this SDK. The component checks for PAYPAL_CHECKOUT_ACTIVATED
and then include the JavaScript SDK in case the value were true.
Then you can add the Smart Payment Button like this
:warning: Finally, after the code of this button add the javascript code to handle it. This JS file is not intended to be used for production. It is just an example about how to handle the PayPal button.
The checkout.js
file contains values related to the purchase amount and purchase behaviour.
For other values you can check the official documentation.
3.3 Subscriptions
Activate paypal subscriptions with the following en var.
You can interact with subscriptions Api through this PayPal SDK. Add the service provider
to your providers[]
array in config/app.php
file like:
Add the PayPal SDK to your blade templates as follows
:bulb: You don't have to be worried about when to include this SDK. The component checks for PAYPAL_SUBSCRIPTION_ACTIVATED
and then include the JavaScript SDK in case the value were true.
Then you can add the Smart Payment Button like this
:warning: Finally, after the code of this button add the javascript code to handle it. This JS file is not intended to be used for production. It is just an example about how to handle the PayPal button.
The subscriptions.js
file contains values related to creating subscriptions and purchase behaviour.
For other values you can check the official documentation.
4. Mocking
If you want to mock the PayPal Service for testing purposes, you need to overwrite the paypal testing configuration.
You must create a testing.php
file inside config/paypal
folder and set up a specific handler like this.
Feel free to use your own paypal mock, or you can use this PayPal Api Mock.
Finally, you should set up the following in your testing environment.
All versions of laravel-paypal with dependencies
ext-json Version *
laravel/framework Version ^7.0|^8.0
payment-gateways/paypal-sdk Version ^1.2