loveycom/cashfree

用于 CashFree 支付网关的包。

v2.1.0 2020-10-09 08:19 UTC

This package is auto-updated.

Last update: 2024-09-09 16:57:49 UTC


README

Issues Stars Forks License

kayusgold 开发,为 CashFree(一家印度支付网关)的开源包。

文档

CashFree 为其客户提供多种服务,使发件人和收件人之间的交易变得无缝便捷。然而,本包主要关注 MarketPlace 结算 API 和支付网关 API。有关 MarketPlace 结算 API 文档,请访问 此处,有关支付网关 API 文档,请访问 此处

使用本包时遇到困难?发现错误?对本包有任何问题或改进建议?请在 GitHub 上创建问题,我们将尽快处理。

要求

  1. PHP >= 7.0.*
  2. Laravel >= 5.6.*

安装

  1. 要使用 LoveyCom CashFree 包,请使用 composer 将其添加到您的项目中
composer require loveycom/cashfree
  1. 打开 Config/app.php 并将以下内容添加到 providers 数组中
LoveyCom\CashFree\CashFreeServiceProvider::class,
  1. 运行以下命令以发布包配置文件 config/cashfree.php
php artisan vendor:publish
  1. 打开 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

使用方法

  1. 编辑已发布的 cashfree.php 文件,位置: config/cashfree.php
  • 填写所有必要的信息
  1. cashfree api 包装器遵循 cashfree 支付网关类别(Marketplace & PaymentGateway)- 请参阅他们的文档以获取更多信息
  2. 在 Marketplace 类别下,此包装器为您提供了以下类和方法
  • Marketplace

  • checkBalance() -- 端点 /getBalance
  • withdraw($amount, $remark = "") -- 端点 /ces/v1/requestWithdrawal
  • getLedger($maxReturn = "", $lastReturnId = "") -- 端点 /ces/v1/getLedger?maxReturn=$maxReturn
  • Settlement

  • status($orderId) -- 端点 /ces/v1/getOrderSettlementStatus/$orderId
  • Transaction

  • importTransaction($details = []) -- 端点 /ces/v1/importTransaction
  • retreive($orderId = "") -- 端点 /ces/v1/getTransactions 或 /ces/v1/getTransaction/$orderId
  • attachVendorToTransaction($orderId, $vendorId, $commission = "", $commissionAmount = "") -- 端点 /ces/v1/attachVendor
  • detachVendorFromTransaction($orderId, $vendorId) -- 端点 /ces/v1/detachVendor
  • Vendor

  • create($vendor = [], $vendorId = "") -- 端点 /ces/v1/editVendor/$vendorId (更新供应商详细信息) | /ces/v1/addVendor (创建供应商)
  • retreive($vendorId = "") -- 端点 /ces/v1/getVendor/$vendorId | /ces/v1/getVendors
  • checkStatus($vendorId) -- 端点 /ces/v1/getVendor/$vendorId
  • adjustVendorBalance($vendorId, $adjustmentId, $amount, $type = "CREDIT", $remark = "") -- 端点 /ces/v1/adjustVendor
  • requestVendorPayout($vendorId, $amount) -- 端点 /ces/v1/requestVendorPayout
  • getLedger($vendorId, $maxReturn = 50, $lastReturnId = "") -- 端点 /ces/v1/getVendorLedger/$vendorId?maxReturn=$maxReturn
  • getTransferDetails($vendorTransferId = "", $vendorId = "", $maxReturn = 50, $lastReturnId = "", $startDate = "", $endDate = "") -- 端点 /ces/v1/getVendorTransfer/...
  • transferBetweenVendors($fromVendorId, $toVendorId, $amount, $adjustmentId) -- 端点 /transferVendorBalance
  1. PaymentGateway 包含以下类和方法
  • Order

  • create($order) -- 端点 /api/v1/order/create
  • getLink($orderId) -- 接口 /api/v1/order/info/link
  • getDetails($orderId) -- 接口 /api/v1/order/info/
  • getStatus($orderId) -- 接口 /api/v1/order/info/status
  • 退款

  • create($orderId, $referenceId, $amount, $remark = "") -- 接口 /api/v1/order/refund
  • instantRefund($orderId, $referenceId, $amount, $remark = "", $refundType = "", $merchantRefundId = "", $mode = "CASHGRAM", $accountNo = "", $ifsc = "") -- 接口 /api/v1/order/refund
  • retreive($startDate, $endDate, $lastId = "", $count = "") -- 接口 /api/v1/refunds
  • Settlement

  • getAll($startDate, $endDate, $lastId = "", $count = "") -- 接口 /api/v1/settlements
  • getOne($settlementId) -- 接口 /api/v1/settlement
  • Transaction

  • retreive($startDate = "", $endDate = "", $txStatus = "", $lastID = "", $count = "") -- 接口 /api/v1/transactions
  1. 用法示例

  • 要使用支付网关分类的订单类,
    //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 许可下发布。