dpsoft/parsian-payment
Composer 安装命令:
composer require dpsoft/parsian-payment
包简介
Parsian bank payment
README 文档
README
Easily integrate PHP application with parsian bank payment.
Installation
$ composer require dpsoft/parsian-payment
Implementation
Attention: The Parsian Bank webservice just available with IP that allowed with Parsian Bank.
استفاده از درگاه بانک پارسیان در زبان Php
Request payment
<?php use Dpsoft\Parsian\Parsian; try{ /** * @param int $pin (required) The Parsian gateway pin code */ $parsian = new Parsian($pin); /** * @param int $amount (required) The amount that customer must pay * @param string $callbackUrl (required) The url that customer redirect to after payment * @param int $orderId (optional) The unique order id, generate by package if value passed null * @param int $additionalData (optional) addition data * * @method payRequest Return array contain transaction `token` and `orderId` and you cat save. * $token = $response['token']; * $orderId = $response['orderId']; * */ $response = $parsian->request($amount, $callbackUrl, $orderId, $additionalData); /** * Redirect user to payment gateway */ echo $parsian->redirect(); /** * If you need to get payment url for application or another reason you can use this method * * $paymentUrl = $parsian->getPaymentUrl(); * */ }catch (\Throwable $exception){ echo $exception->getMessage(); }
Verify transaction or maybe reverse transaction in conditions
Customer redirect to callback url with all transaction data and you must verify or rollback transaction.
verify:
<?php use Dpsoft\Parsian\Parsian; try{ /** * @param int $pin (required) The Parsian gateway pin code */ $parsian = new Parsian($pin); /** * * @method $verify return array of transaction data. * $token = $response['token']; * $orderId = $response['order_id']; * $RRN = $response['RRN']; * $hashCardNumber = $response['hash_card_number']; */ $response = $parsian->verify(); echo "Successful payment ..."; }catch (\Throwable $exception){ echo $exception->getMessage(); }
Reverse transaction
If you don't verify transaction you can reverse it.
<?php use Dpsoft\Parsian\Parsian; try{ /** * @param int $pin (required) The Parsian gateway pin code */ $parsian = new Parsian($pin); /** * @param int $pin (required) The Parsian gateway pin code */ $parsian->reverse($token); echo "Transaction reverse successful ..."; }catch (\Throwable $exception){ echo $exception->getMessage(); }
License
Copyright (c) 2018 dpsoft.ir
dpsoft/parsian-payment 适用场景与选型建议
dpsoft/parsian-payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.29k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 11 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dpsoft/parsian-payment 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dpsoft/parsian-payment 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.29k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 6
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2018-11-04