loveycom / cashfree
用于 CashFree 支付网关的包。
v2.1.0
2020-10-09 08:19 UTC
README
由 kayusgold 开发,为 CashFree(一家印度支付网关)的开源包。
文档
CashFree 为其客户提供多种服务,使发件人和收件人之间的交易变得无缝便捷。然而,本包主要关注 MarketPlace 结算 API 和支付网关 API。有关 MarketPlace 结算 API 文档,请访问 此处,有关支付网关 API 文档,请访问 此处。
使用本包时遇到困难?发现错误?对本包有任何问题或改进建议?请在 GitHub 上创建问题,我们将尽快处理。
要求
- PHP >= 7.0.*
- Laravel >= 5.6.*
安装
- 要使用 LoveyCom CashFree 包,请使用 composer 将其添加到您的项目中
composer require loveycom/cashfree
- 打开 Config/app.php 并将以下内容添加到 providers 数组中
LoveyCom\CashFree\CashFreeServiceProvider::class,
- 运行以下命令以发布包配置文件 config/cashfree.php
php artisan vendor:publish
- 打开 config/cashfree.php 以编辑必要的参数,如 API 密钥 ID 和密钥。
'appID' => '', 'secretKey' => '', 'testURL' => 'https://ces-gamma.cashfree.com', 'prodURL' => 'https://ces-api.cashfree.com', 'maxReturn' => 100, 'isLive' => false,
不要忘记导出 composer 自动加载
composer dump-autoload
使用方法
- 编辑已发布的 cashfree.php 文件,位置:
config/cashfree.php
- 填写所有必要的信息
- cashfree api 包装器遵循 cashfree 支付网关类别(Marketplace & PaymentGateway)- 请参阅他们的文档以获取更多信息
- 在 Marketplace 类别下,此包装器为您提供了以下类和方法
checkBalance()
-- 端点 /getBalancewithdraw($amount, $remark = "")
-- 端点 /ces/v1/requestWithdrawalgetLedger($maxReturn = "", $lastReturnId = "")
-- 端点 /ces/v1/getLedger?maxReturn=$maxReturn
status($orderId)
-- 端点 /ces/v1/getOrderSettlementStatus/$orderId
importTransaction($details = [])
-- 端点 /ces/v1/importTransactionretreive($orderId = "")
-- 端点 /ces/v1/getTransactions 或 /ces/v1/getTransaction/$orderIdattachVendorToTransaction($orderId, $vendorId, $commission = "", $commissionAmount = "")
-- 端点 /ces/v1/attachVendordetachVendorFromTransaction($orderId, $vendorId)
-- 端点 /ces/v1/detachVendor
create($vendor = [], $vendorId = "")
-- 端点 /ces/v1/editVendor/$vendorId (更新供应商详细信息) | /ces/v1/addVendor (创建供应商)retreive($vendorId = "")
-- 端点 /ces/v1/getVendor/$vendorId | /ces/v1/getVendorscheckStatus($vendorId)
-- 端点 /ces/v1/getVendor/$vendorIdadjustVendorBalance($vendorId, $adjustmentId, $amount, $type = "CREDIT", $remark = "")
-- 端点 /ces/v1/adjustVendorrequestVendorPayout($vendorId, $amount)
-- 端点 /ces/v1/requestVendorPayoutgetLedger($vendorId, $maxReturn = 50, $lastReturnId = "")
-- 端点 /ces/v1/getVendorLedger/$vendorId?maxReturn=$maxReturngetTransferDetails($vendorTransferId = "", $vendorId = "", $maxReturn = 50, $lastReturnId = "", $startDate = "", $endDate = "")
-- 端点 /ces/v1/getVendorTransfer/...transferBetweenVendors($fromVendorId, $toVendorId, $amount, $adjustmentId)
-- 端点 /transferVendorBalance
- PaymentGateway 包含以下类和方法
create($order)
-- 端点 /api/v1/order/creategetLink($orderId)
-- 接口 /api/v1/order/info/linkgetDetails($orderId)
-- 接口 /api/v1/order/info/getStatus($orderId)
-- 接口 /api/v1/order/info/status
create($orderId, $referenceId, $amount, $remark = "")
-- 接口 /api/v1/order/refundinstantRefund($orderId, $referenceId, $amount, $remark = "", $refundType = "", $merchantRefundId = "", $mode = "CASHGRAM", $accountNo = "", $ifsc = "")
-- 接口 /api/v1/order/refundretreive($startDate, $endDate, $lastId = "", $count = "")
-- 接口 /api/v1/refunds
getAll($startDate, $endDate, $lastId = "", $count = "")
-- 接口 /api/v1/settlementsgetOne($settlementId)
-- 接口 /api/v1/settlement
retreive($startDate = "", $endDate = "", $txStatus = "", $lastID = "", $count = "")
-- 接口 /api/v1/transactions
- 要使用支付网关分类的订单类,
//import the class use LoveyCom\CashFree\PaymentGateway\Order; //instantiate the class $order = new Order(); //prepare the order details //NOTE: Prepare a route for returnUrl and notifyUrl (something like a webhook). However, if you have webhook setup in your cashfree dashboard, no need for notifyUrl. But if notifyUrl is set, it will be called instead. $od["orderId"] = "ORDER-84984941"; $od["orderAmount"] = 10000; $od["orderNote"] = "Subscription"; $od["customerPhone"] = "9000012345"; $od["customerName"] = "Test Name"; $od["customerEmail"] = "test@cashfree.com"; $od["returnUrl"] = "http://127.0.0.1:8000/order/success"; $od["notifyUrl"] = "http://127.0.0.1:8000/order/success"; //call the create method $order->create($od); //get the payment link of this order for your customer $link = $order->getLink($od['orderId']) //You can now either send this link to your customer through email or redirect to it for them to complete the payment. //To confirm the payment, //Call either getDetails($orderId) or getStatus($orderId) method
贡献
感谢您的兴趣,以下是一些许多贡献方式之一。
- 查看我们的贡献指南
安全性
如果您发现任何安全问题,请通过info@plustech.com.ng 发送电子邮件,而不是使用问题跟踪器。
许可证
本软件在MIT 许可下发布。