sytxlabs/laravel-paypal

A Laravel package to interact with PayPal

v1.0.1 2024-12-17 18:10 UTC

This package is auto-updated.

Last update: 2024-12-17 19:22:47 UTC


README

MIT Licensed Check code style Latest Version on Packagist Total Downloads

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.