PHPackages                             kodedjackson/bachs-laravel - 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. kodedjackson/bachs-laravel

ActiveLibrary

kodedjackson/bachs-laravel
==========================

Laravel client for the Bachs payment API

v1.0.0(today)01↑2900%MITPHPPHP ^8.2

Since Aug 8Pushed todayCompare

[ Source](https://github.com/kodedjackson/bachs-laravel)[ Packagist](https://packagist.org/packages/kodedjackson/bachs-laravel)[ RSS](/packages/kodedjackson-bachs-laravel/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

Bachs Laravel
=============

[](#bachs-laravel)

A fluent, native Laravel integration for the [Bachs.io](https://bachs.io) payment API.

This package provides a clean Facade for interacting with the Bachs API (like creating Checkout Sessions and Products) and automatically handles secure webhook signature verification out of the box.

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

[](#installation)

You can install the package via composer:

```
composer require kodedjackson/bachs-laravel
```

Publish the configuration file:

```
php artisan vendor:publish --tag="bachs-config"
```

This will create a `config/bachs.php` file in your application where you can configure your default settings.

Configuration
-------------

[](#configuration)

Add your Bachs API keys to your `.env` file. You can find these in your Bachs developer dashboard.

```
BACHS_PUBLIC_KEY=pk_test_...
BACHS_SECRET_KEY=sk_sandbox_...
BACHS_WEBHOOK_SECRET=whsec_...
BACHS_BASE_URL=[https://sandbox-api.bachs.io/v1](https://sandbox-api.bachs.io/v1)
BACHS_CURRENCY=USD
```

*(Note: When moving to production, change your Base URL to `https://api.bachs.io/v1` and use your live keys).*

Usage
-----

[](#usage)

### 1. Creating a Checkout Session

[](#1-creating-a-checkout-session)

You can create a hosted checkout session by passing a `pricing` array for raw amounts, or a `product_cart` array for catalog items.

```
use Kodedjackson\Bachs\Facades\Bachs;

$session = Bachs::createCheckoutSession([
    'pricing' => [
        'currency' => 'USD',
        'amount' => '42.00',
    ],
    'customer' => [
        'email' => 'jane@example.com',
        'name' => 'Jane Doe',
    ],
    'success_url' => url('/thanks'), // Must be a public URL in Live mode
    'cancel_url' => url('/cart'),
]);

// Redirect the user to the Bachs hosted checkout page
return redirect($session['checkout_url']);
```

### 2. Creating a Product

[](#2-creating-a-product)

You can create a product in your Bachs catalog. If you omit the currency, the package will automatically use your configured default (`BACHS_CURRENCY`).

```
use Kodedjackson\Bachs\Facades\Bachs;

$product = Bachs::createProduct([
    'name' => 'Pro Plan',
    'description' => 'Monthly access to all Pro features.',
    'price' => [
        'price_type' => 'fixed',
        'amount' => '29.00',
    ],
    'billing_cycle' => [
        'interval' => 'month',
        'frequency' => 1
    ]
]);
```

Handling Webhooks (Fulfilling Orders)
-------------------------------------

[](#handling-webhooks-fulfilling-orders)

Bachs recommends never relying on the browser redirect to fulfill an order. Instead, you should listen for webhooks.

This package automatically exposes a secure webhook endpoint at `POST /bachs/webhook`. It verifies the cryptographic signature of the incoming request and dispatches native Laravel events.

### Step 1: Configure your Dashboard

[](#step-1-configure-your-dashboard)

In your Bachs developer portal, set your webhook URL to: `https://yourdomain.com/bachs/webhook`

Subscribe to the `collection.succeeded` event, and paste the generated signing secret into your `.env` file as `BACHS_WEBHOOK_SECRET`.

### Step 2: Listen for the Event

[](#step-2-listen-for-the-event)

When a payment is successful, the package fires the `Kodedjackson\Bachs\Events\CollectionSucceeded` event.

You can listen for this event in your application (e.g., inside `EventServiceProvider` or a dedicated listener) to fulfill the order:

```
use Illuminate\Support\Facades\Event;
use Kodedjackson\Bachs\Events\CollectionSucceeded;

Event::listen(function (CollectionSucceeded $event) {
    // The payment payload from Bachs
    $data =$event->paymentData;

    $checkoutId =$data['checkout_id'];
    $amount =$data['amount'];
    $status =$data['status']; // "SUCCEEDED"

    // Find the order in your database and mark it as paid
    // Order::where('checkout_id', $checkoutId)->update(['status' => 'paid']);
});
```

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security-related issues, please email directly instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT).

```

```

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

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

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26343652?v=4)[Jackson Jackson](/maintainers/kodedjackson)[@kodedjackson](https://github.com/kodedjackson)

---

Top Contributors

[![kodedjackson](https://avatars.githubusercontent.com/u/26343652?v=4)](https://github.com/kodedjackson "kodedjackson (2 commits)")

### Embed Badge

![Health badge](/badges/kodedjackson-bachs-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/kodedjackson-bachs-laravel/health.svg)](https://phpackages.com/packages/kodedjackson-bachs-laravel)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.3k](/packages/craftcms-cms)[illuminate/http

The Illuminate Http package.

11938.5M7.9k](/packages/illuminate-http)[spatie/laravel-export

Create a static site bundle from a Laravel app

679153.2k7](/packages/spatie-laravel-export)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1239.7k25](/packages/fleetbase-core-api)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1349.3k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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