PHPackages                             p4ndish/laravel-santimpay - 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. p4ndish/laravel-santimpay

ActiveLibrary[Payment Processing](/categories/payments)

p4ndish/laravel-santimpay
=========================

A Laravel package for Santim Pay payment gateway integration.

v1.1.0(3mo ago)02MITPHPPHP ^8.2

Since Jan 8Pushed 3mo agoCompare

[ Source](https://github.com/p4ndish/santimpay-laravel-sdk)[ Packagist](https://packagist.org/packages/p4ndish/laravel-santimpay)[ RSS](/packages/p4ndish-laravel-santimpay/feed)WikiDiscussions main Synced 1mo ago

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

laravel-santimpay
=================

[](#laravel-santimpay)

Laravel package for integrating **SantimPay** payment gateway.

Requirements
------------

[](#requirements)

- **PHP**: 8.2+
- **Laravel / Illuminate**: 11.x or 12.x

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

[](#installation)

### Via Composer (Packagist)

[](#via-composer-packagist)

```
composer require p4ndish/laravel-santimpay
```

### Via Composer (VCS / local development)

[](#via-composer-vcs--local-development)

If the package is not published yet, you can install it from a Git repository:

```
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com//laravel-santimpay"
    }
  ],
  "require": {
    "p4ndish/laravel-santimpay": "dev-main"
  }
}
```

Then run:

```
composer update
```

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

[](#configuration)

Publish the config file:

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

This will publish `config/santimpay.php`.

### Environment variables

[](#environment-variables)

Add the following to your `.env`:

```
SANTIMPAY_API_URL=https://services.santimpay.com
SANTIMPAY_INITIATE_ENDPOINT=https://services.santimpay.com/api/v1/gateway/initiate-payment
SANTIMPAY_TRANSACTION_STATUS_ENDPOINT=https://services.santimpay.com/api/v1/gateway/fetch-transaction-status

SANTIMPAY_MERCHANT_ID=your_merchant_id

# IMPORTANT: this path is resolved using storage_path(...)
# Example below expects the key at: storage/app/santimpay/private.pem
SANTIMPAY_PRIVATE_KEY_PATH=app/santimpay/private.pem

SANTIMPAY_SUCCESS_URL=https://your-app.com/payments/success
SANTIMPAY_FAILURE_URL=https://your-app.com/payments/failure
SANTIMPAY_CANCEL_REDIRECT_URL=https://your-app.com/payments/cancel
SANTIMPAY_NOTIFY_URL=https://your-app.com/api/santimpay/notify

SANTIMPAY_RETRY_ATTEMPTS=3
SANTIMPAY_RETRY_SLEEP_MS=200
```

### Private key

[](#private-key)

The package loads the private key from the filesystem using:

- `storage_path(config('santimpay.private_key_path'))`

Example:

- Put your key at: `storage/app/santimpay/private.pem`
- Set: `SANTIMPAY_PRIVATE_KEY_PATH=app/santimpay/private.pem`

Make sure your key file is **not committed** to git.

Usage
-----

[](#usage)

The package registers a singleton in the container as `santimpay` and also provides a facade alias `SantimPay`.

### Generate a transaction ID

[](#generate-a-transaction-id)

```
use P4ndish\SantimPay\Facades\SantimPay;

$merchantTxnId = SantimPay::generateMerchantTxnId();
```

### Initiate a payment

[](#initiate-a-payment)

`initiatePayment(...)` returns an array like:

- `status_code` (int)
- `url` (string|null) payment redirect URL
- `body` (array) full response JSON

Example controller action:

```
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use P4ndish\SantimPay\Exception\SantimPayException;
use P4ndish\SantimPay\Facades\SantimPay;

public function pay(Request $request): RedirectResponse
{
    $merchantTxnId = SantimPay::generateMerchantTxnId();

    try {
        $res = SantimPay::initiatePayment(
            merchantTxnId: $merchantTxnId,
            amount: 100,
            reason: 'Order #123',
            phoneNumber: $request->input('phone')
        );
    } catch (SantimPayException $e) {
        abort($e->getStatus(), $e->getMessage());
    }

    if (!($res['url'] ?? null)) {
        abort(500, 'SantimPay did not return a redirect URL.');
    }

    return redirect()->away($res['url']);
}
```

### Check transaction status

[](#check-transaction-status)

```
use P4ndish\SantimPay\Facades\SantimPay;

$status = SantimPay::checkTransactionStatus($merchantTxnId);
// $status is the decoded JSON response array
```

Handling redirects and notifications
------------------------------------

[](#handling-redirects-and-notifications)

SantimPay can redirect the customer back to your app (success/failure/cancel), and it can also call your `notifyUrl`.

Recommended approach:

- Create routes/controllers for:
    - `SANTIMPAY_SUCCESS_URL`
    - `SANTIMPAY_FAILURE_URL`
    - `SANTIMPAY_CANCEL_REDIRECT_URL`
    - `SANTIMPAY_NOTIFY_URL`
- In those handlers, verify the transaction with `checkTransactionStatus($merchantTxnId)` before marking an order as paid.

Error handling
--------------

[](#error-handling)

Most failures during API calls are thrown as `P4ndish\SantimPay\Exception\SantimPayException`.

```
use P4ndish\SantimPay\Exception\SantimPayException;

try {
    // ... call initiatePayment / checkTransactionStatus
} catch (SantimPayException $e) {
    report($e);
    return response()->json([
        'message' => $e->getMessage(),
    ], $e->getStatus());
}
```

Security notes
--------------

[](#security-notes)

- Never commit your private key.
- Prefer storing the key under `storage/` and restricting file permissions.
- Always validate/verify transactions server-side using `checkTransactionStatus(...)`.

Contributing
------------

[](#contributing)

Contributions are welcome.

- Fork the repo
- Create a feature branch
- Open a PR

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Every ~27 days

Total

2

Last Release

96d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f6b4ed14c32f7eca54b724471c3794a0c57f037310dbe33fdf61f64d2600d21?d=identicon)[p4ndish](/maintainers/p4ndish)

---

Top Contributors

[![p4ndish](https://avatars.githubusercontent.com/u/65342438?v=4)](https://github.com/p4ndish "p4ndish (5 commits)")

### Embed Badge

![Health badge](/badges/p4ndish-laravel-santimpay/health.svg)

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

###  Alternatives

[laraveldaily/laravel-invoices

Missing invoices for Laravel

1.5k1.3M4](/packages/laraveldaily-laravel-invoices)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

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