定制 palmpesa/palmpesa-payment 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

palmpesa/palmpesa-payment

Composer 安装命令:

composer require palmpesa/palmpesa-payment

包简介

A Laravel package for handling PalmPesa payments including USSD Push and Pay-by-Link.

README 文档

README

Palm pesa laravel simple package

# Laravel PalmPesa Payment Package

**PalmPesa** is a lightweight Laravel package that allows you to easily integrate payment by link using the Selcom PalmPesa gateway.

## 🔧 Features

- Generate payment links via API
- Redirect users to PalmPesa checkout
- Check transaction status
- Simple HTML form for testing
- Easy integration with any Laravel project

## 🧰 Requirements

- PHP >= 8.0
- Laravel 8, 9, or 10
- Selcom PalmPesa account

---

## 🚀 Installation

### Via Composer (Packagist - if published)

```bash
composer require palmpesa/laravel-palmpesa
```

Or Via GitHub (for development/test)

Add this to your Laravel project's composer.json:

"repositories": [
  {
    "type": "vcs",
    "url": "https://github.com/Aam-tanzania/laravel-palmpesa"
  }
],

We accept payment from M-pesa, Airtel Money, Mixx by Yas(Tigo), Halotel and TCCL pesa

Then install:

composer require palmpesa/laravel-palmpesa

📦 Package Setup

1. Add the Service Provider (if Laravel version < 5.5)

In config/app.php:

'providers' => [
    PalmPesa\PalmPesaServiceProvider::class,
],

2. Publish Config (if available)

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

env. add this line as it is in your .env file

PALMPESA_VENDOR_ID=TILL61103867

PALMPESA_API_KEY =Bearer {put your Api token from palmpesa dashboard}


---

## 🧪 Usage

````We have use these form view as an example so use the Url in the post of the form the way you want but those are the data that the specific route

### Payment Form (Pay by USSD PUSH)

```blade
<div class="col-md-6 form-section form-section-right">
    <h3>Payment Form (Pay by USSD PUSH)</h3>
    <form method="POST" action="{{ route('pay.submit') }}">
        @csrf
        <div class="mb-3">
            <label for="name">Full Name:</label>
            <input type="text" name="name" id="name" class="form-control" required>
        </div>
        <div class="mb-3">
            <label for="email">Email:</label>
            <input type="email" name="email" id="email" class="form-control" required>
        </div>
        <div class="mb-3">
            <label for="address">Address:</label>
            <input type="text" name="address" id="address" class="form-control" required>
        </div>
        <div class="mb-3">
            <label for="postcode">Postcode:</label>
            <input type="text" name="postcode" id="postcode" class="form-control" required>
        </div>
        <div class="mb-3">
            <label for="user_id">User ID:</label>
            <input type="number" name="user_id" id="user_id" class="form-control" required>
        </div>
        <div class="mb-3">
            <label for="phone">Phone Number:</label>
            <input type="text" name="phone" id="phone" class="form-control" required>
        </div>
        <div class="mb-3">
            <label for="amount">Amount (TSh):</label>
            <input type="number" name="amount" id="amount" class="form-control" required>
        </div>
        <button type="submit" class="btn btn-primary">Pay Now</button>
    </form>
</div>

Payment Link Form (Example)


```blade
<form method="POST" action="{{ url('/palmpesa/pay-by-link') }}">
    @csrf
    <input type="text" name="user_id" placeholder="User ID">
    <input type="text" name="name" placeholder="Full Name">
    <input type="email" name="email" placeholder="Email">
    <input type="text" name="phone" placeholder="Phone (e.g. 2556...)">
    <input type="number" name="amount" placeholder="Amount">
    <input type="text" name="transaction_id" placeholder="Transaction ID">
    <input type="text" name="address" placeholder="Address">
    <input type="text" name="postcode" placeholder="Postcode">
    <input type="text" name="buyer_uuid" placeholder="Buyer UUID">
    <button type="submit">Get Payment Link</button>
</form>

Redirect Page

<a href="{{ $paymentLink }}" class="btn btn-primary" target="_blank">Go to Payment</a>

<script>
    setTimeout(function () {
        window.location.href = "{{ $paymentLink }}";
    }, 3000);
</script>

🛠 Configuration (optional)

If the package supports a config file, update your credentials in config/palmpesa.php.

📄 License

This package is open-sourced software licensed under the MIT license.

👨‍💻 Author

Anord Amri Mwinuka CTO at PalmPesa GitHubEmail


统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-05