Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Paypal Fake

Paypal Fake Laravel Package

puntodev/paypal-fake

A lightweight PayPal fake for Laravel testing. Swap the real PayPal client for a fake that returns stubbed API responses, so you can exercise checkout, payment, and webhook flows in your test suite without network calls or sandbox credentials.

View on GitHub
Deep Wiki
Context7

puntodev/paypal-fake is a lightweight fake PayPal client for Laravel/PHP tests. It lets you replace real PayPal API calls with predictable, in-memory responses, keeping your test suite fast and deterministic—no network access or sandbox credentials required.

  • Drop-in PayPal fake for Laravel/PHP applications
  • Fluent assertions for verifying API requests
  • Simulate successful responses and error scenarios
  • No external HTTP calls or credentials needed
  • Compatible with PHPUnit and Pest workflows
Frequently asked questions about Paypal Fake
What is puntodev/paypal-fake used for?
It is a mocking library for Laravel applications that use the puntodev/paypal package. It fakes PayPal so your tests can simulate orders, payments, and API responses without contacting live or sandbox PayPal services. The result is a faster, deterministic test suite that has no network dependencies or external rate limits.
How do I install puntodev/paypal-fake?
Install it with Composer as a development dependency, for example composer require --dev puntodev/paypal-fake. Because it exists purely for testing, it belongs in require-dev rather than your production dependencies. Check the repository README for any service provider registration or configuration publishing steps specific to your version.
Does puntodev/paypal-fake work with puntodev/paypal out of the box?
Yes, it is built specifically to stand in for puntodev/paypal inside Laravel applications. Your application code keeps making the same PayPal calls, while the fake intercepts them and returns simulated responses. Make sure the fake version you install matches the version of puntodev/paypal you are testing against.
How do I simulate a PayPal order or payment in a Laravel test?
You enable the fake inside your test case before running the code that creates, captures, or refunds an order. The package then returns simulated PayPal responses for orders and payments instead of making real HTTP calls. The README documents the exact setup and assertion helpers exposed by your installed version.
Do I need PayPal API credentials to run tests with this package?
No. The package exists precisely so your tests never reach live or sandbox PayPal, which means no client ID, secret, or access token is required for faked flows. That makes it safe to run in CI pipelines without storing PayPal secrets. It also removes flaky network failures and rate limiting from your test runs.
Which Laravel and PHP versions does puntodev/paypal-fake support?
Support generally tracks the puntodev/paypal package it mocks, since both must agree on the underlying PayPal client behavior. The authoritative constraints are listed in the package composer.json and README. Check those before upgrading Laravel or PHP in your application.
Can I simulate failed payments or PayPal API errors with puntodev/paypal-fake?
Because you control the faked responses, you can exercise error paths such as declined payments, failed captures, or API errors in your test suite. This lets you verify that your application handles PayPal failures gracefully without touching a real account. Refer to the README for the specific helpers available for defining custom responses in your version.
Does puntodev/paypal-fake replace PayPal sandbox testing?
No, it complements sandbox testing rather than replacing it. The fake is ideal for fast unit and feature tests where you want predictable, isolated PayPal behavior, while sandbox credentials are still useful for occasional end-to-end checks against real PayPal endpoints. Use the fake for the bulk of your suite and the sandbox for integration verification.
Can I use puntodev/paypal-fake in production?
No, it is a testing tool and should stay in your require-dev dependencies. Registering fakes in production code paths would mean your application never talks to PayPal for real. Keep the fake confined to your test suite and local development workflows.
Is puntodev/paypal-fake actively maintained, and what are the alternatives?
Maintenance activity is best confirmed by checking the repository's commit history, releases, and issue tracker on GitHub. If you prefer not to add a dependency, you can hand-roll fakes with Laravel's HTTP client faking or mock the PayPal client directly in your tests. A dedicated fake is usually less boilerplate because it already mirrors the puntodev/paypal surface.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings