Download the PHP package puntodev/paypal without Composer
On this page you can find all versions of the php package puntodev/paypal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download puntodev/paypal
More information about puntodev/paypal
Files in puntodev/paypal
Package paypal
Short Description PayPal API Client
License MIT
Homepage https://github.com/puntodev/paypal
Informations about the package paypal
PayPal API Client for Laravel
A lightweight Laravel package that wraps the PayPal Orders v2 API (create, find and capture orders) and provides classic IPN verification. It uses Laravel's HTTP client under the hood and caches the OAuth2 access token automatically.
Requirements
- PHP
>=8.4 <9.0 - Laravel 13+ (
illuminate/support^13.0)
Installation
Install via composer:
The package auto-registers its service provider and the Paypal facade via Laravel
package discovery. To publish the config file:
Configuration
Set the following environment variables:
These map to config/paypal.php:
When use_sandbox is true the client targets api.sandbox.paypal.com and the
sandbox IPN endpoint; otherwise it targets production.
Usage
Resolving the client
Inject the PayPal contract (or use the Paypal facade) and obtain a PayPalApi
instance. Use defaultClient() to use the configured credentials, or
withCredentials() to override them at runtime (e.g. for multi-tenant setups):
Building an order
OrderBuilder produces the payload for the Orders v2 API. The order intent is
CAPTURE, items are sent as DIGITAL_GOODS with NO_SHIPPING, and a discount is
only included when greater than zero:
Creating, finding and capturing orders
All order methods return the decoded JSON response as an array and throw
Illuminate\Http\Client\RequestException on HTTP errors.
Verifying IPN notifications
Testing
Note: the test suite (
tests/PayPalApiTest.php) makes real HTTP calls to the PayPal sandbox. You must provide valid sandbox credentials viaPAYPAL_API_CLIENT_IDandPAYPAL_API_CLIENT_SECRET.phpunit.xml.distforcesSANDBOX_GATEWAYS=true.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Releasing
Releases are cut from GitHub and the changelog is kept in sync automatically:
- Merge the pull requests you want to ship into
main. Label them so the notes group nicely (security,enhancement,bug,dependencies,documentation); grouping is configured in.github/release.yml. - On GitHub, go to Releases → Draft a new release, create a
vX.Y.Ztag following SemVer, and click Generate release notes. - Publish the release. Packagist picks up the new tag, and the
update-changelog.ymlworkflow writes the release notes intoCHANGELOG.mdand commits them back tomain.
The Unreleased section in the changelog is just an anchor — release notes flow
from the published GitHub release, so there is no changelog to edit by hand.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Mariano Goldman
- All Contributors
License
The MIT License (MIT). Please see License File for more information.