sytxlabs / laravel-paypal
A Laravel package to interact with PayPal
v1.0.1
2024-12-17 18:10 UTC
Requires
- php: ^8.2|^8.3
- guzzlehttp/guzzle: ^7.8
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^8.5|^9.1
- portavice/laravel-pint-config: ^2.0
This package is auto-updated.
Last update: 2024-12-17 19:22:47 UTC
README
This package adds a simple way to integrate PayPal payments into your Laravel application.
Prerequisites
- A configured Laravel database connection
- PHP 8.2 or higher
- Laravel 10.0 or higher
Installation
composer require sytxlabs/laravel-paypal
Using
Configuration
php artisan vendor:publish --tag="sytxlabs-paypal-config"
the configuration file is located at config/paypal.php
Optional Database
php artisan vendor:publish --tag="sytxlabs-paypal-migrations"
php artisan migrate
Usage
Create a new PayPal Order
use SytxLabs\PayPal\PayPalOrder; $paypalOrder = new PayPalOrder(); $paypalOrder->addProduct(new Product('Product 1', 10.00, 1)); $paypalOrder->createOrder();
Redirect to PayPal
$paypalOrder->approveOrderRedirect();
or get the approval link
$paypalOrder->getApprovalLink();
Capture the payment
$paypalOrder->captureOrder();
Check the payment status
$paypalOrder->captureOrder()->getOrderStatus();
License
The MIT License (MIT). Please see License File for more information.