承接 nikba/paynet 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

nikba/paynet

Composer 安装命令:

composer require nikba/paynet

包简介

Paynet payment module for Laravel

README 文档

README

This package provides integration with the Paynet payment gateway for Laravel applications.

Installation

Install the package via Composer:

composer require nikba/paynet

Publish the configuration file:

php artisan vendor:publish --provider="Nikba\Paynet\Providers\PaynetServiceProvider" --tag="config"

Add the following environment variables to your .env file:

PAYNET_MERCHANT_CODE=862491
PAYNET_SECRET_KEY=F822E47B-6F4F-4D9D-92EB-566ED89E3D76
PAYNET_USERNAME=388018
PAYNET_PASSWORD=6olmfsQX
PAYNET_TEST_MODE=true

Usage

Initiate a Payment

Use the Paynet facade to initiate a payment:

use Nikba\Paynet\Facades\Paynet;

$paymentData = [
    'Invoice' => 20160622010101,
    'Currency' => 498,
    'LinkUrlSuccess' => 'http://localhost:8000/pay/1?status=success',
    'LinkUrlCancel' => 'http://localhost:8000/pay/1?status=cancel',
    'Customer' => [
        'Code' => 'CustomerCode',
        'NameFirst' => 'FirstName',
        'NameLast' => 'LastName',
        'PhoneNumber' => 'PhoneNumber',
        'email' => 'customer@example.com',
        'Country' => 'Country',
        'City' => 'City',
        'Address' => 'Address',
    ],
    'ExternalDate' => '2025-01-01T00:00:00',
    'ExpiryDate' => '2025-01-02T00:00:00',
    'Services' => [
        [
            'Name' => 'ServiceName',
            'Description' => 'ServiceDescription',
            'amount' => 100,
            'Products' => [
                [
                    'Amount' => 100,
                    'Code' => 'PRODUCT1',
                    'Description' => 'ProductDescription',
                    'LineNo' => 1,
                    'Name' => 'ProductName',
                    'UnitPrice' => 100,
                    'UnitProduct' => 1,
                ],
            ],
        ],
    ],
    'SignVersion' => 'v01',
    'MoneyType' => null
];

$response = Paynet::sendPayment($paymentData);

Handle Paynet Notifications

Add a route to handle Paynet notifications in your routes/web.php file:

Route::post('/paynet/notification', [\Nikba\Paynet\Http\Controllers\PaynetController::class, 'handleNotification']);

Create a controller method to process the notifications:

public function handleNotification(Request $request)
{
    $notificationData = $request->all();

    try {
        $response = Paynet::handleNotification($notificationData);
        return response()->json(['status' => 'success', 'data' => $response]);
    } catch (\Exception $e) {
        Log::error('Paynet notification failed: ' . $e->getMessage());
        return response()->json(['error' => $e->getMessage()], 400);
    }
}

Testing

Install necessary dependencies for testing:

composer require --dev mockery/mockery

Run the tests:

vendor/bin/phpunit --filter PaynetServiceTest

Postman

Postman Collections (JSON file) for a quicker and easier usage of RESTful APIs.

How to import and configure

  • Download the postman_collection.json repository.
  • Click the Import button. On Postman for Mac, for example, the button is at the top left

nikba/paynet 适用场景与选型建议

nikba/paynet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 07 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 nikba/paynet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nikba/paynet 我们能提供哪些服务?
定制开发 / 二次开发

基于 nikba/paynet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-28