codebuglab/noon-payment-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

codebuglab/noon-payment-laravel

Composer 安装命令:

composer require codebuglab/noon-payment-laravel

包简介

Integrate noon payment API with Laravel

README 文档

README

Integrate NoonPayment API with Laravel

Issues Forks Stars Stars

Noon Payment with laravel

Table of contents

Setup

Installation

To install this package through composer run the following command in the terminal

composer require codebuglab/noon-payment-laravel

Config

Refer to Noon docs to get your info then add them to .env file

NOON_PAYMENT_BUSINESS_ID=
NOON_PAYMENT_APP_NAME=
NOON_PAYMENT_APP_KEY=
NOON_PAYMENT_TOKEN_IDENTIFIER=
NOON_PAYMENT_RETURN_URL=http://127.0.0.1:8000/noon_payment_response
# Change the mode to Live for the Production or set it as Test
NOON_PAYMENT_MODE=Test
# Pre-configured order route categories (the categories will be mentioned also in the initial setup email)
NOON_PAYMENT_ORDER_CATEGORY=
# Channels are pre-defined and limited to Web / Mobile (the channels will be mentioned also in the initial setup email)
NOON_PAYMENT_CHANNEL=web
# Default value - Payment API Endpoint - Chooses
# https://api.noonpayments.com/payment/v1/
# https://api-test.noonpayments.com/payment/v1/
NOON_PAYMENT_PAYMENT_API=https://api-test.noonpayments.com/payment/v1/

Publish (optional)

Run this command in terminal to publish package files in your app

php artisan vendor:publish --provider="CodeBugLab\NoonPayment\NoonPaymentServiceProvider"

This will publish 2 files

1- App/Http/Controllers/NoonPaymentController.php
2- config/noon_payment.php
  • Feel free to change noon_payment.php config file and set package configuration on this file instead of .env if you want
  • If you don't need the config file you can run this command instead
php artisan vendor:publish --provider="CodeBugLab\NoonPayment\NoonPaymentServiceProvider" --tag=controller
  • NoonPaymentController.php is a simple example to use it in your project, consider it as a demo.

Routes (optional)

This package has two routes using NoonPaymentController.php file

  • Create payment page:
http://yourwebsite/noon_payment

Which call function ( NoonPaymentController@index ) by GET Request

  • Receiving response
http://yourwebsite/noon_payment_response

Which receive a GET response through function ( NoonPaymentController@response )

Test Card

the link for test cards by official documentation => Test Cards

Available API Methods

Initiate

  • This will initiate new order.
$data =[
    "order" => [
        "reference" => "1",
        "amount" => "10",
        "currency" => "SAR",
        "name" => "Sample order name",
    ],
    "configuration" => [
        "locale" => "en"
     ]
]
$response = NoonPayment::getInstance()->initiate($data);
  • Simply you can use response and redirect to pay page through this code
if ($response->resultCode == 0) {
    return redirect($response->result->checkoutData->postUrl);
}
  • After sitting your payment information or cancel the process you will go to response page
  • Remember you set it up earlier in .env file like this
NOON_PAYMENT_RETURN_URL=http://127.0.0.1:8000/noon_payment_response
  • For more information about request and response for initiate visit documentation ( Payment Initiate )

Get Order

  • This will get your order information by order id that retrieved by initiate function
 $response = NoonPayment::getInstance()->getOrder($orderId);
  • Simply you can check if transaction is success by using $response variable like this
if (
    $response->result->transactions[0]->type == "SALE" &&
    $response->result->transactions[0]->status == "SUCCESS"
) {
    //success Message
}
  • For more information about response and request for initiate visit documentation ( Payment Get Order )

Notices

  • If you facing any problems using this package try use Publish and Routes this will give you a simple example in NoonPaymentController.php file.
  • If you want to make Refund or Cancel for order then this package doesn't provide these methods yet, So we highly recommend to read full Documentation before try this and making a pull request.

License

This package is a free software distributed under the terms of the MIT license.

codebuglab/noon-payment-laravel 适用场景与选型建议

codebuglab/noon-payment-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.38k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2021 年 05 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「laravel」 「online」 「noon payment」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 codebuglab/noon-payment-laravel 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 15
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

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