PHPackages                             bocapro/boca-payments - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. bocapro/boca-payments

ActiveLibrary[Payment Processing](/categories/payments)

bocapro/boca-payments
=====================

Payment helper for Stripe, PayPal, Plaid, MercadoPago, Authorize.Net, JustiFi and Global Payments

v1.0.0(yesterday)00MITPHPPHP ^8.2

Since Jun 8Pushed yesterdayCompare

[ Source](https://github.com/siefhesham-boca/boca-payments)[ Packagist](https://packagist.org/packages/bocapro/boca-payments)[ RSS](/packages/bocapro-boca-payments/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (13)Versions (2)Used By (0)

Boca Payments
=============

[](#boca-payments)

[![MIT License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://choosealicense.com/licenses/mit/)[![Laravel 11+](https://camo.githubusercontent.com/977ed8891f0c3f376e098db6a13fd1aa413d5d0c4e380d9a550a475e52696470/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3131253230253743253230313225323025374325323031332d7265642e737667)](https://laravel.com)[![PHP 8.2+](https://camo.githubusercontent.com/0f16581d1180dbfd4c0e13166ec1267d4ad2f2fab8281ea6d6b284cf5c65d921/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c75652e737667)](https://php.net)

A unified payment gateway package for Laravel. One package, one interface, seven gateways.

Stripe, PayPal, Plaid, MercadoPago, Authorize.Net, JustiFi, and Global Payments.

Supported Gateways
------------------

[](#supported-gateways)

- [Stripe](https://stripe.com/)
- [PayPal](https://www.paypal.com/)
- [Plaid](https://plaid.com/)
- [MercadoPago](https://www.mercadopago.com/)
- [Authorize.Net](https://www.authorize.net/)
- [JustiFi](https://www.justifi.tech/)
- [Global Payments](https://www.globalpayments.com/)

Installation
------------

[](#installation)

```
composer require bocapro/boca-payments
```

Publish Config
--------------

[](#publish-config)

```
php artisan vendor:publish --tag="boca-payments-config"
```

Setup
-----

[](#setup)

Add your credentials to `.env`. You only need to fill in the gateways you use.

```
BOCA_PAYMENTS_DEFAULT=stripe

STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
PAYPAL_MODE=sandbox

PLAID_CLIENT_ID=...
PLAID_SECRET=...
PLAID_ENVIRONMENT=sandbox

MERCADOPAGO_ACCESS_TOKEN=...

AUTHORIZE_NET_LOGIN_ID=...
AUTHORIZE_NET_TRANSACTION_KEY=...
AUTHORIZE_NET_MODE=sandbox

JUSTIFI_CLIENT_ID=...
JUSTIFI_CLIENT_SECRET=...

GLOBAL_PAYMENT_MERCHANT_ID=...
GLOBAL_PAYMENT_ACCOUNT_ID=...
GLOBAL_PAYMENT_SHARED_SECRET=...
GLOBAL_PAYMENT_APP_KEY=...
GLOBAL_PAYMENT_MODE=sandbox
```

How to Use
----------

[](#how-to-use)

### 1. Pay

[](#1-pay)

```
use BetterFutures\BocaPayments\Facades\BocaPayments;
use BetterFutures\BocaPayments\Data\Customer;
use BetterFutures\BocaPayments\Enums\Currency;
use BetterFutures\BocaPayments\Enums\Gateway;

$response = BocaPayments::setAmount(99.99)
    ->setCurrency(Currency::USD)
    ->setCustomer(new Customer(email: 'john@example.com', firstName: 'John', lastName: 'Doe'))
    ->setDescription('Order #1234')
    ->setReturnUrl('https://myapp.com/payment/success')
    ->setCancelUrl('https://myapp.com/payment/cancel')
    ->pay();
```

This uses the default gateway from your config. To use a different gateway:

```
$response = BocaPayments::gateway(Gateway::PayPal)
    ->setAmount(50.00)
    ->setCurrency(Currency::USD)
    ->setCustomer(new Customer(email: 'john@example.com'))
    ->pay();
```

**Pay Response:**

```
$response->status;          // PaymentStatus::Completed, Pending, Failed, RequiresAction, etc.
$response->paymentId;       // "pi_3abc123" - store this in your orders table
$response->redirectUrl;     // "https://..." - for gateways that redirect (PayPal, MercadoPago)
$response->html;            // rendered html for gateways that need it
$response->message;         // "succeeded"
$response->raw;             // full raw gateway response

$response->isSuccessful();     // true if completed
$response->requiresRedirect(); // true if needs redirect
$response->requiresAction();   // true if needs 3D Secure, etc.
```

**Handle the response in your controller:**

```
if ($response->requiresRedirect()) {
    return redirect($response->redirectUrl);
}

// payment completed
return view('payment.success', ['payment_id' => $response->paymentId]);
```

### 2. Verify

[](#2-verify)

After the user is redirected back or you receive a webhook, verify the payment:

```
$response = BocaPayments::verify($paymentId);

if ($response->isSuccessful()) {
    // mark order as paid
}
```

### 3. Refund

[](#3-refund)

```
// full refund
$refund = BocaPayments::refund(paymentId: $paymentId);

// partial refund
$refund = BocaPayments::refund(paymentId: $paymentId, amount: 25.00, reason: 'Customer request');

if ($refund->isSuccessful()) {
    // refund processed
}
```

### Switch Gateway Dynamically

[](#switch-gateway-dynamically)

Pass a gateway string from user input, a database column, or a form select:

```
use Smpita\TypeAs\TypeAs;

$response = BocaPayments::gateway(Gateway::from($request->input('gateway')))
    ->setAmount(TypeAs::float($request->input('amount')))
    ->setCurrency(Currency::USD)
    ->setCustomer(new Customer(email: TypeAs::string($request->input('email'))))
    ->pay();

// valid strings: stripe, paypal, plaid, mercadopago, authorize_net, justifi, global_payment
```

### Full Controller Example

[](#full-controller-example)

```
use BetterFutures\BocaPayments\Facades\BocaPayments;
use BetterFutures\BocaPayments\Data\Customer;
use BetterFutures\BocaPayments\Enums\Currency;
use BetterFutures\BocaPayments\Enums\Gateway;
use Smpita\TypeAs\TypeAs;

class PaymentController extends Controller
{
    public function pay(Request $request)
    {
        $response = BocaPayments::gateway(Gateway::from($request->input('gateway', 'stripe')))
            ->setAmount(TypeAs::float($request->input('amount')))
            ->setCurrency(Currency::USD)
            ->setCustomer(new Customer(
                email: TypeAs::string($request->input('email')),
                firstName: TypeAs::nullableString($request->input('first_name')),
                lastName: TypeAs::nullableString($request->input('last_name')),
            ))
            ->setReturnUrl(route('payment.verify'))
            ->pay();

        if ($response->requiresRedirect()) {
            return redirect($response->redirectUrl);
        }

        return redirect()->route('orders.show', $response->paymentId);
    }

    public function verify(Request $request)
    {
        $response = BocaPayments::verify($request->input('payment_id'));

        if ($response->isSuccessful()) {
            // update order status
            return redirect()->route('orders.success');
        }

        return redirect()->route('orders.failed');
    }

    public function refund(string $paymentId)
    {
        $refund = BocaPayments::refund(paymentId: $paymentId);

        if ($refund->isSuccessful()) {
            return back()->with('success', 'Refund processed');
        }

        return back()->with('error', 'Refund failed');
    }
}
```

Test Cards and Sandbox Credentials
----------------------------------

[](#test-cards-and-sandbox-credentials)

- [Stripe](https://docs.stripe.com/testing#cards)
- [PayPal](https://developer.paypal.com/tools/sandbox/)
- [Plaid](https://plaid.com/docs/sandbox/)
- [MercadoPago](https://www.mercadopago.com/developers/en/docs/your-integrations/test/cards)
- [Authorize.Net](https://developer.authorize.net/hello_world/testing_guide.html)
- [JustiFi](https://docs.justifi.tech/)
- [Global Payments](https://developer.globalpayments.com/resources/test-card-numbers)

Testing
-------

[](#testing)

```
vendor/bin/pest
```

Formatting
----------

[](#formatting)

```
vendor/bin/pint
```

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f823ddeb05a88f85eceb235b39fd1473888fbb55cb2831e0b75ef58f468e8467?d=identicon)[siefhesham-bocapro](/maintainers/siefhesham-bocapro)

---

Top Contributors

[![siefhesham-boca](https://avatars.githubusercontent.com/u/234080835?v=4)](https://github.com/siefhesham-boca "siefhesham-boca (2 commits)")

---

Tags

stripepaypalmercadopagoauthorize.netplaidonline paymentsglobal-paymentsjustifi

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bocapro-boca-payments/health.svg)

```
[![Health](https://phpackages.com/badges/bocapro-boca-payments/health.svg)](https://phpackages.com/packages/bocapro-boca-payments)
```

###  Alternatives

[payum/payum

One million downloads of Payum already! Payum offers everything you need to work with payments. Friendly for all PHP frameworks (Symfony, Laravel, Laminas, Yii, Silex). Check more visiting site.

1.9k6.7M23](/packages/payum-payum)[payum/payum-bundle

One million downloads of Payum already! Payum offers everything you need to work with payments. Check more visiting site.

58310.7M48](/packages/payum-payum-bundle)[tastyigniter/ti-ext-payregister

Allows you to accept credit card payments using PayPal, Stripe, Authorize.Net and/or Mollie.

1016.7k6](/packages/tastyigniter-ti-ext-payregister)[payum/payum-laravel-package

Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more

12342.5k](/packages/payum-payum-laravel-package)[recca0120/laravel-payum

Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more

741.5k](/packages/recca0120-laravel-payum)[payum/payum-yii-extension

Rich payment solutions for Yii framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more

1211.8k](/packages/payum-payum-yii-extension)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
