raziul/shurjopay-php
Composer 安装命令:
composer require raziul/shurjopay-php
包简介
ShurjoPay payment gateway integration for PHP applications.
README 文档
README
ShurjoPay PHP Library
Using this library you can integrate ShurjoPay payment gateway into your PHP applications.
If you face any problem then create issues or make a PR with your solution.
Requirement
- PHP 7.3 or Later
- curl extension
Installation
The installation is pretty easy using Composer
composer require raziul/shurjopay-php
Usage
You can check the examples directory for full code.
Configuration
$config = [ // set this to false if you are running in live mode 'sandbox_mode' => true, // ShurjoPay credentials [Change these with your details] 'username' => 'sp_sandbox', 'password' => 'pyyk97hu&6u6', 'prefix' => 'NOK', ];
Creating a payment
require __DIR__ . '/vendor/autoload.php'; // create ShurjoPay instance $sp = new \Raziul\ShurjoPay\ShurjoPay($config); // set callback url $sp->setCallbackUrl($success_url, $cancel_url); // make payment $sp->makePayment($payload); // it will redirect to the payment page
You can also use method chaining like below
ShurjoPay::create($config)->setCallbackUrl($success_url, $cancel_url)->makePayment($payload);
After making a successfull payment, user will be redirected to the success_url with
order_idquery parameter in the URI.
Verify Payment
// retrieve order id from the URI $order_id = $_GET['order_id']; // verify payment $payment = $sp->verify($order_id); // check success status if ($payment->success()) { // show the payment method echo $payment->paymentMethod(); }
Available methods in the Payment class.
| Method | Description |
|---|---|
| $payment->success() | Return payment success status |
| $payment->failed() | Return payment failed status |
| $payment->message() | Get the success/error message |
| $payment->orderId() | Get the order ID |
| $payment->currency() | Get currency code |
| $payment->amount() | Get the amount |
| $payment->customerOrderId() | Get customer order ID |
| $payment->paymentMethod() | Get the payment method name |
| $payment->dateTime() | Get the transaction date time |
| $payment->toArray() | Get all the data as array |
Error Handling
This package throws Raziul\ShurjoPay\ShurjoPayException on error. You can use try-catch for better error handling.
try { // making payment ShurjoPay::create($config) ->setCallbackUrl($success_url, $cancel_url) ->makePayment($payload); // also for verfication ShurjoPay::create($config) ->verify($order_id); } catch (Raziul\ShurjoPay\ShurjoPayException $e) { echo $e->getMessage(); }
Suggestion/Issues
If you found any issues or have any suggestion then please create an issue.
You can also submit PR regarding any issues.
License
The MIT License (MIT). Please see License File for more information.
Thank You
Thanks for using this package and If you foound this package useful then consider giving it a star.
raziul/shurjopay-php 适用场景与选型建议
raziul/shurjopay-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 6, 最近一次更新时间为 2022 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment gateway」 「shurjopay」 「shurjopay gateway」 「shurjopay php」 「shurjopay payment gateway php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 raziul/shurjopay-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 raziul/shurjopay-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 raziul/shurjopay-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
ShurjoPay payment gateway for laravel
shurjoPay is a online payment gateway and easy payment solution
Client library to send SMS using Comilio SMS Gateway API (https://www.comilio.it)
ShurjoPay payment gateway integration for Laravel.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-14