Download the PHP package abraham-flutterwave/laravel-payment without Composer

On this page you can find all versions of the php package abraham-flutterwave/laravel-payment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-payment

Flutterwave for Laravel

Tests Docs Packagist Downloads Packagist PHP Version Support GitHub stars Packagist License

Accept payments across Africa and beyond, send payouts, bill subscriptions and react to webhooks, all from Laravel with very little code.

Prefer a nicer read? Read the guides on the documentation site, with search and navigation.

Setting up for the first time? Download the developer quickstart (PDF). It walks through installing, connecting your Flutterwave account, taking a test payment, going live and troubleshooting, in one printable document. See Setup guide below.

That one line creates a hosted checkout supporting cards, bank transfer, USSD, mobile money and more, then sends your customer to it.

If this package saves you time, please ⭐ star it on GitHub. It helps other developers find it.

Features

Checkout Hosted payment links, inline modal, drop-in <x-flutterwave-button>
Inertia Inertia-aware redirects, plus publishable React, Vue and Svelte components for checkout and bank transfer payments
Verification Flutterwave::isSuccessful($id, $amount, $currency) in one call
Webhooks Route, signature check and Laravel events wired up for you
Transfers Single and bulk payouts to banks and mobile money, fees, FX rates
Stablecoins Send USDC, USDT and RLUSD on Solana, Ethereum, Base and Polygon; fund from fiat
Banks Bank lists, branches, account-name resolution
Subscriptions Payment plans and subscription management
Virtual accounts Static accounts, plus a drop-in <x-flutterwave-virtual-account> component for one-off bank transfer payments
Split payments Subaccounts for marketplaces
Refunds Full and partial refunds with a reason, refund history
Balances & settlements Wallet balances, and settlements with their fees and the payments in each
Beneficiaries Saved transfer recipients, and a bank dropdown that submits the bank code
Chargebacks List disputes, accept them, or decline with uploaded proof
FX trades Request a quote and convert NGN, GHS and USD at the quoted rate
Saved cards Charge a customer's card again with a Billable trait; pre-authorize, capture and void holds
Bill payments Airtime, data, electricity and cable TV, with customer number validation
Wallets Payout subaccounts: a balance and bank account number for each customer
BVN verification Consent-based BVN checks for Nigerian customers
Testing Flutterwave::fake() with realistic responses and assertions
Artisan flutterwave:doctor to check your setup, plus commands to verify payments, check balances, look up banks, accounts, card BINs and bills, and replay webhooks locally

Supports PHP 8.1+ and Laravel 9, 10, 11, 12 and 13.

Setup guide (PDF)

A 16-page developer quickstart for teams setting up the package, in Flutterwave's brand:

It documents 2.3.0. When a release changes the setup steps or settings, update the HTML edition and re-export the PDF in the same pull request.

Installation

The install command publishes config/flutterwave.php, adds the keys below to your .env, and prints your webhook URL:

Get your keys from the Flutterwave dashboard. Test keys work against the sandbox automatically.

The Flutterwave look

Every component, in Blade, React, Vue and Svelte, has the same look as Flutterwave's WooCommerce onboarding and settings screens:

They share one stylesheet, flutterwave.css, and the fonts ship with the package, so there are no third-party font requests and no Tailwind setup is needed:

Restyle everything at once by overriding the CSS tokens on .flw. For example, .flw { --flw-orange: #f5a623; --flw-radius: 4px; }. The components are light by default, like the plugin. They switch to dark colours when your app turns dark mode on with a dark class or data-theme="dark" on a parent element. A className (or class) you pass is added to a component's own classes.

Publishing files

flutterwave:install publishes only the config. Everything else is opt-in: publish just the parts you need, by tag or with an install option.

What Tag Install option Goes to
Config flutterwave-config (always) config/flutterwave.php
React, Vue or Svelte components flutterwave-react, flutterwave-vue, flutterwave-svelte --react, --vue, --svelte resources/js/components/flutterwave/
Saved card columns flutterwave-migrations --billable database/migrations/
Blade views flutterwave-views resources/views/vendor/flutterwave/
Example checkout routes flutterwave-routes routes/vendor/flutterwave/web.php

Before you publish:

Don't publish everything with --provider. php artisan vendor:publish --provider="Flutterwave\Payments\Providers\FlutterwaveServiceProvider" publishes every tag at once. That puts all three frontends' components in one folder, adds the saved-card migration and the example routes, and copies every view. Use the tags above instead.

Accepting payments

Hosted checkout (recommended)

Need just the URL (for an API or mobile app)? Use Flutterwave::checkout([...]), which returns the link. tx_ref is generated for you; pass your own to tie the payment to an order.

Inline modal button

Supported attributes: amount, email, currency, name, phone, tx-ref, redirect-url, payment-options, payment-plan, :meta, :customizations, :subaccounts.

Inertia (React, Vue, Svelte)

Flutterwave::redirect() works as-is from an Inertia form post. It sees the X-Inertia header and returns the response that makes Inertia do a full page visit to the hosted checkout, so the browser doesn't block a cross-domain XHR redirect.

For the inline modal, build the config on the server and pass it as a prop. That way the amount and tx_ref can't be changed in the browser:

Components for React, Vue and Svelte

Publish the components for your frontend:

This copies TypeScript files into resources/js/components/flutterwave, along with flutterwave.css and the fonts. They're yours to restyle, and they don't add an npm dependency. They work with Inertia 1, 2 and 3 and are safe to render with Inertia SSR. See The Flutterwave look for styling. You get the same three pieces in each framework:

Pass both props from your controller:

React

Vue

Svelte

Card payments. By default, Flutterwave redirects to your FLW_REDIRECT_URL after payment, and that route verifies the payment on the server. To stay on the page, pass onSuccess (@success in Vue) and send the payment to your server to verify. Flutterwave ignores callbacks when a redirect URL is set, so the component drops the redirect URL when you pass onSuccess. onClose (@close) runs when the customer closes the modal:

Bank transfers. While paid is false, VirtualAccount reloads the reloadOnly props every 5 seconds (pollInterval). It pauses while the tab is hidden and stops once the account expires. Your ChargeCompleted listener updates the order when the transfer arrives, and the next reload picks that up. Set pollInterval to 0 to turn checking off. It also takes onExpired (@expired in Vue), paidMessage and expiredMessage; Vue also has #paid and #expired slots.

Styling. The components use the shared Flutterwave stylesheet. A class or className you pass is added to the root element; to change colours, fonts or corners, override the tokens described in The Flutterwave look.

Checksum (optional)

Turn on Flutterwave's checksum to have it reject any checkout whose amount, currency, email or reference was changed in the browser:

The package then adds a payload_hash to every hosted and inline checkout, including the Blade button and the React, Vue and Svelte components. It's off by default. Turn it on, make one test payment, and keep it on if the payment goes through. If Flutterwave shows a checksum error instead, turn it off again and open an issue. For a checkout you build yourself, Flutterwave\Payments\Support\Checksum::make($payload, $secretKey) returns the hash. Keep verifying payments on your server either way.

Confirming a payment

Flutterwave redirects the customer to FLW_REDIRECT_URL with status, tx_ref and transaction_id. Never trust those query parameters. Verify on the server instead:

isSuccessful() returns true only when Flutterwave reports the transaction as successful and the amount and currency match what you expected.

For the raw response, use Flutterwave::verifyTransaction($id) or Flutterwave::verifyTransactionReference($txRef).

Webhooks

Webhooks are the reliable way to learn about payments, since customers sometimes close the browser before the redirect. The package registers POST /flutterwave/webhook for you. It:

  1. rejects any request whose signature doesn't match FLW_SECRET_HASH,
  2. re-fetches charge.completed transactions from the Flutterwave API, so a forged payload can't mark an order as paid,
  3. dispatches Laravel events you can listen to.

Set the URL printed by php artisan flutterwave:install as your webhook URL on the dashboard, then listen for events:

Event When
WebhookReceived Every verified webhook ($event->event, $event->data, $event->payload)
ChargeCompleted A payment completed. $event->transaction is the API-verified transaction
TransferCompleted A payout succeeded or failed
SubscriptionCancelled A customer's subscription was cancelled
QuoteCompleted An FX quote changed status. $event->isReady() when you can trade it
ChargebackUpdated A chargeback was raised, accepted, declined or lost. $event->needsResponse() for new ones

Change the path, add middleware or turn the route off under webhook in config/flutterwave.php.

Duplicate webhooks and queueing

Flutterwave retries a webhook until your app answers with a 2xx, so the same webhook can arrive more than once. The package fires each webhook's events only once. It remembers handled webhooks in your cache for 7 days, but only after they've been handled, so a webhook whose charge couldn't be verified still gets through when Flutterwave retries. If two copies arrive at the same moment, one waits, and Flutterwave retries the other.

Use a cache store that every server shares and that survives restarts, such as redis or database. The array store forgets everything between requests. Set FLW_WEBHOOK_DEDUPE_STORE to use a different store from your default.

To answer Flutterwave immediately and handle webhooks in the background, set a queue:

The queued job retries for about four hours when a charge can't be verified yet. Keep a worker running: php artisan queue:work --queue=payments.

Transfers (payouts)

Don't know a bank code? Run php artisan flutterwave:banks NG --search=access.

resolveAccount() works for Nigerian and Ghanaian bank accounts and Ghanaian mobile money numbers. Before a wallet-to-wallet transfer, use resolveMerchant() to check a Flutterwave merchant ID:

With test keys, only Flutterwave's test accounts resolve. Real account numbers return an error.

Testing transfers in the sandbox

With test keys, Flutterwave leaves transfers PENDING unless the reference says how they should end. Pass test_outcome and the package adds the suffix Flutterwave looks for. With live keys it's ignored:

Sandbox transfers also need your server's IP whitelisted on the dashboard. Transfers to 0690000036 fail as a blacklisted account.

Stablecoins

Send USDC, USDT and RLUSD to crypto wallets, or convert fiat into your stablecoin balance. This requires a live, production-approved account with whitelisted IPs.

Network Coins
SOLANA USDT, USDC
ETHEREUM USDT, USDC, RLUSD
BASE USDC
POLYGON USDT, USDC

Crypto transfers can't be reversed, so before calling Flutterwave, send() rejects coins a network doesn't support (e.g. USDT on Base), unsupported networks such as Tron, and addresses in the wrong format for the chain. You can't send USDC to a USDT address. Completed transfers fire the TransferCompleted event.

Subscriptions

Saved cards

After a customer pays by card once, you can charge that card again without them entering it. Add the columns and the trait:

Save the card when the first payment comes in, then charge it whenever you need to:

Without the trait, call the service directly: Flutterwave::cards()->charge($token, $email, 5000). chargeMany() charges many cards in one request, which needs no-auth charges enabled.

Pre-authorization

Hold an amount on a saved card now, and charge it later, for example when a ride ends or a guest checks out. Flutterwave has to enable this on your account.

Holds you don't capture are released after 7 days.

Virtual accounts

Dynamic accounts for one-off payments

A dynamic account is a single-use NGN or GHS account number for one payment. It expires after an hour by default. Drop the component into your checkout page:

It shows the bank name, the account number in a copy field, the amount to send and a live countdown. When the account expires, it shows a message instead. Anything between the tags is rendered under the account details, and class is added to the wrapper.

Using Inertia, or creating the account in a controller? dynamicFor() uses the same per-tx_ref caching as the component and returns a flat array that works as a prop:

Base your frontend countdown on expires_in, not expires_at, so a wrong clock on the customer's device doesn't matter. The Blade component also accepts this array: <x-flutterwave-virtual-account :account="$account" />. For a single uncached account, use dynamic($email, $amount, $options), which returns Flutterwave's raw response.

When the customer pays, Flutterwave sends a charge.completed webhook with payment_type: bank_transfer, so your existing ChargeCompleted listener handles it. NGN accounts reverse an underpayment, and also any amount paid over the total. GHS accounts reject anything that isn't the exact amount.

Wallets (payout subaccounts)

Give each customer a wallet: a balance on your Flutterwave account with its own bank account number, so anyone can pay into it.

all(), find(), update(), staticAccount() and delete() cover the rest. Deleting deactivates the wallet in the background.

Chargebacks

When a customer disputes a payment with their bank, respond before the due date: 10 working hours for local transactions, 30 for international ones. If you don't, the chargeback is lost and the customer is refunded.

Proof must be one JPEG, PNG or PDF file under 8MB, so merge multiple documents into one first. declineWithProof() accepts a file path or an uploaded file, and checks it before sending anything. To do it in two steps, call uploadProof($file) to get a proof link, then decline($id, $comment, $proofLink).

To have Flutterwave notify you by webhook instead of email, ask them to enable chargeback webhooks. Each one fires ChargebackUpdated:

FX trades

Convert between currencies at a quoted rate. Supported pairs are NGN to USD, GHS to USD and USD to NGN. FX has to be enabled on your account, trades run on weekdays only, and the minimum is USD 1,000 or its equivalent.

A quote is valid for 5 minutes and can only be traded once. tradeIfReady() re-checks the quote first, so an expired one fails with a clear message instead of at the API. approved_quantity can be lower than the amount you asked for, depending on liquidity and your account limits. Instead of polling, listen for QuoteCompleted, and for TransferCompleted when the trade settles.

Bill payments

Pay for airtime, data, electricity, cable TV and more from your Flutterwave balance. Find the codes first. php artisan flutterwave:bills walks you through them, or do it in code:

Bill payments can't be undone, so check the customer's meter, smartcard or phone number first. payValidated() validates it, checks the amount against the provider's limits, and only then pays:

validate() on its own returns the name on the account, so you can show it to the customer to confirm.

BVN verification

Check a Nigerian customer's Bank Verification Number, with their consent, before giving them a static virtual account or a wallet:

The full result from verification($reference) includes personal data, including a photo of the customer's face. Keep only what you need, and don't log it. The package never logs successful responses.

Admin components for chargebacks and FX

Drop-in screens for your team: a chargeback list where you can accept or dispute each chargeback, and an FX converter that gets a rate, trades it and follows the trade. They come in Blade, React, Vue and Svelte. The Inertia versions are published with the rest of the components (flutterwave:install --react, --vue or --svelte).

These screens refund customers and move money, so they're off until you turn them on in two places.

1. Register the routes inside your own admin group. Nothing is registered until you call Route::flutterwaveAdmin():

2. Say who may use them. Every action checks the flutterwave.manage ability. Until you define it, every request is refused with a 403, even for signed-in users:

Then give your page the panel data. panel() returns everything the component needs, including the countdowns and the action URLs. API errors come back in panel['error'] instead of being thrown:

In Blade, pass the same arrays: <x-flutterwave-chargebacks :panel="$chargebacks" /> and <x-flutterwave-fx :panel="$fx" />. The Blade versions work without JavaScript, and use a required checkbox in place of the confirm step.

Transactions, refunds, settlements and beneficiaries

Four more admin components, with the same setup as the ones above. Each panel() takes the request's query string, so filters, page numbers and the item being viewed live in the URL:

In Blade: <x-flutterwave-transactions :panel="$transactions" />, and the same for refunds, settlements and beneficiaries.

Refunds, webhook resends and beneficiary changes are written to the audit log.

Bank dropdown

BankSelect lists a country's banks by name and submits the bank code, with a search box when the list is long. Nigeria alone has hundreds of banks.

The Blade component loads the list itself. In React, Vue and Svelte, pass the banks from Flutterwave::banks()->options($country) as a prop:

The list is cached for a day, since bank lists rarely change.

Ready-made admin page

Route::flutterwaveAdmin() also registers a page at its prefix (/admin/flutterwave in the example above). Its Overview shows your wallet balances, the chargebacks that need a response (with an "All" tab), and the FX converter. Transactions, Refunds, Settlements and Beneficiaries each have their own section, and only the section you're viewing is loaded. It checks the same flutterwave.manage ability. To change it, publish the views with php artisan vendor:publish --tag=flutterwave-views and edit admin/index.blade.php. To register only the actions and use your own page, call Route::flutterwaveAdmin(page: false).

Notifications

Chargebacks have deadlines, and failed payouts mean someone wasn't paid. Set addresses to hear about both by email:

The chargeback email says how long you have and links to the admin page when it's registered. To send the notifications yourself, for example to Slack or the database, use the classes directly:

TransferFailed works the same way with a transfer from TransferCompleted.

Split payments

More

Every method returns Flutterwave's JSON response as an array (status, message, data and, for lists, meta).

Artisan commands

Everything the standalone Flutterwave CLI does, using the keys already in your .env:

Run flutterwave:doctor after installing and before going live. It flags test and live keys mixed together, an app running on an IP address (where the checkout won't load), a missing webhook secret hash (which makes every webhook get rejected), a webhook URL Flutterwave can't reach, a cache that won't remember handled webhooks, and admin routes without the flutterwave.manage ability. It then checks that Flutterwave accepts your secret key. Pass --offline to skip that last check.

Commands that refund a customer or move money (accept-chargeback, decline-chargeback and fx-trade) show what will happen and ask before going ahead. Pass --force to run them from scripts or CI. Without it, they change nothing when there's no terminal to ask in.

flutterwave:ping-webhook fetches the real transaction (or transfer, with --event=transfer) and posts it to your local URL as a signed charge.completed or transfer.completed webhook, so you can test your listeners without exposing localhost. The URL defaults to this app's webhook route, and the signature uses FLW_SECRET_HASH unless you pass --hash.

Audit log

Accepting or disputing a chargeback, trading FX, refunding a payment, resending a webhook, and adding or deleting a beneficiary, through the admin screens or the Artisan commands, are recorded in the flutterwave log channel. Each entry has the action, whether it succeeded, the user ID (or the system user for commands), and the IP address. The admin page is sent with Cache-Control: no-store, so browsers and proxies don't keep copies of balances and disputes.

Error handling

API errors throw Flutterwave\Payments\Exception\FlutterwaveException:

Network failures throw NetworkConnection, a subclass of FlutterwaveException. Read-only (GET) requests are retried automatically. Requests that move money are never retried, so a timeout can't cause a double payout. Tune this with FLW_TIMEOUT and FLW_RETRIES.

The transactions() service keeps its 2.1 behaviour of returning the error body instead of throwing, so existing code keeps working.

Everything the package does is logged to storage/logs/flutterwave.log.

Testing your app

Flutterwave::fake() answers every Flutterwave API call with a realistic response, and records what your app sent. It only fakes Flutterwave, so your other Http::fake() calls keep working:

Verifying a transaction only succeeds for ones you register, so a test can't pass by accident:

The fake fills in placeholder keys when your test environment has none.

For trying flows by hand against Flutterwave's sandbox, Flutterwave\Payments\Testing\SandboxData holds the official test values. These include cards that succeed or fail in specific ways, the special OTPs, the Access Bank test accounts and the blacklisted one, the DSTV and airtime bill credentials, and the BVN test identities. In test mode, airtime numbers must start with +234, and the checkout only loads on localhost or a domain, not on 127.0.0.1. To test against a running app instead, use php artisan flutterwave:ping-webhook {transaction-id}.

Customising

Upgrading from 2.2

Nothing to change in your code. Three things behave differently:

If you've published config/flutterwave.php, the new options (checksum, notify, and the webhook dedupe and queue settings) use their defaults until you add them. Compare with php artisan vendor:publish --tag=flutterwave-config --force in a scratch branch.

Upgrading from 2.1

Existing code keeps working: render(), use(), verifyTransaction(), verifyTransactionReference() and generateTransactionReference() are unchanged. A few things to note:

See CHANGELOG.md for details.

Contributing

Contributions are welcome! Read the contribution guidelines, then:

Ideas for what's next: bill payments, card tokenisation and charges, payment links, and more Blade components. Open an issue to discuss.

Support

Security

Found a vulnerability? Please don't open a public issue. Report it privately as described in SECURITY.md.

License

MIT. See LICENSE. Copyright (c) Flutterwave Inc.


All versions of laravel-payment with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
illuminate/console Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/view Version ^9.0|^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package abraham-flutterwave/laravel-payment contains the following files

Loading the files please wait ...