rohit/line-pay
Composer 安装命令:
composer require rohit/line-pay
包简介
Line Payment Package for Laravel
README 文档
README
Very easy and light package for Line Payment.
Installation
Composer
Add Line Pay to your composer.json file
"rohit/line-pay": "^3.0"
Run composer install to get the latest version of package
Or you can directly run the composer require command
composer require rohit/line-pay
Configuration
After the package install is completed you need to configure config/app.php and add Providers and Aliases
'providers` => [
.......
.......
Rohit\LinePay\LinePayServiceProvider::class
]
'aliases' => [ ...... ...... 'LinePay' => Rohit\LinePay\Facades\LinePay::class ]
Vendor Publish
After the above steps, you need to publish vendor for this packge. It will create line-pay.php file under config folder. This folder contains the configuration for your locales.
php artisan vendor:publish --provider="Rohit\LinePay\LinePayServiceProvider"
The file line-pay.php will contain the following structure
return [ 'channel-id' => 'Line Pay Channel Id', 'channel-secret' => 'Line Pay Channel Secret', 'reservation-url' => 'https://sandbox-api-pay.line.me/v1/payments/request', 'detail-url' => 'https://sandbox-api-pay.line.me/v1/payments', ];
Functions
-
Process Payment
You can process your payment with the function process Payment which accepts array as an arguments with following
LinePay::processPayment($params);
The array params for processPayment is described below:
Items Datatype Required Description Remarks productName string (4000byte) Y Name of Product you want user to pay for amount numeric Y Amount of the product currency string (3byte) Y Payment Currency supported Currencies are (USD, JPY, TWD, THB)orderId string (100byte) Y Order Number corresponding to payment request Must be unique for each order confirmUrl string (500byte) Y Url to which Line will redirect after successful of payment cancelUrl string (500byte) N Url to which Line will redirect when user cancel the payment Default redirect to request URL. No additional parameters is sent by LINE productImageUrl string (500byte) N Url to Product Image mid string (50byte) N Line member ID oneTimeKey string (12byte) N Scanning and reading QR/Bar code information given by LINE pay app is used as LINE pay users's mid. Valid time is 5 minutes and it will be deleted with reserve at the same time confirmUrlType string N Type of URL that the buyer is redirected to after selecting payment method and entering the payment password in LINE pay CLIENT: A user based URL(DEFAULT).
SERVER: A server based URLcheckConfirmUrlBrowser Boolean N When moved to confirmUrl. check a browser true: When a browser calling a payment and browser directing to confirmUrl are different LINE pay provides a guide page directing to a previous browser.false: Redirecting to confirmUrl without checking a browser(DEFAULT)packageName string (4000byte) N Information to avoid phishing during transition between apps in Android deliveryPlacePhone string (100byte) N Receipent Contact Number payType string (12byte) N Payment Types NORMAL: Single Payment(DEFAULT)PREAPPROVED: Preapproved PaymentlangCd string N Language code on the payment waiting screen Supported Languages are:
-ja(Japanese)
-ko(Korean)
-en(English)(DEFAULT)
-zh-Hans(Chinese Simplified)
-zh-Hant(Chinese Traditional)
-th(Thai)capture Boolean N Whether to capture or not - true: Payment authorization and capture are handled at once when the confirm payment API is called(DEFAULT)
-false: A payment is compleed only after it is authorized and then separately captured by calling Capture API when confirm payment API is calledThe response from the process payment will be as below
[ 'status' => 'success' or 'failed', 'data' => [ 'request' => 'Params you send while calling the function (You may need to save it to log for future)', 'response' => 'Array response (You may need to save it to log for future)', ], ] The response will be empty [] or as follows: [ 'returnCode' => '0000' (if success) or other code, 'returnMessage' -> 'OK', 'info' => [ 'transactionId' => 'Transaction Id eg: 12345678', 'paymentUrl' => [ 'web' => 'Payment url for web.' (Need to redirect to this for payment), 'app' => 'Payment url for app', ], 'paymentAccessToken' => 'Access Token for Payment' ], ] -
Verify Payment
After Successful payment from line, it redirects to the
confirmUrl. Now we need to verify the payment from line before updating our order. Its a 3 way handshake for security. This function takes 2 arguments. TransactionId and the array of parameters.LinePay::verifyPayment($transactionId, $params);
The array param for verifyPayment is described below:
Items Datatype Required Description Remarks amount numeric Y Payment Amount Should match with the amount on Process Payment for the given transaction Id. currency string (3byte) Y Payment Currency Should match with Currency on Process Payment for the given transaction Id.
Supported Languages are:
-ja(Japanese)
-ko(Korean)
-en(English)(DEFAULT)
-zh-Hans(Chinese Simplified)
-zh-Hant(Chinese Traditional)
-th(Thai)The response from the verify payment will be as below
[ 'status' => 'success' or 'failed', 'data' => [ 'request' => 'Params you send while calling the function (You may need to save it to log for future)', 'response' => 'Array response (You may need to save it to log for future)', ], ]The response will be empty [] or as follows:
If payment Type is NORMAL the response will be as follow: [ 'returnCode' => '0000' (if success) or other code, 'returnMessage' -> 'OK', 'info' => [ 'orderId' => 'OrderID of the payment', 'transactionId' => 'Transaction Id', 'payInfo' => [ [ 'method' => 'BALANCE', 'amount' => '10', ], [ 'method' => 'DISCOUNT', 'amount' => '10', ], ], ], ]
If payment Type is PREAPPROVED the response will be as follow: [ 'returnCode' => '0000' (if success) or other code, 'returnMessage' -> 'OK', 'info' => [ 'orderId' => 'OrderID of the payment', 'transactionId' => 'Transaction Id', 'payInfo' => [ [ 'method' => 'CREDIT_CARD', 'amount' => '10', 'creditCardNickName' => 'test', 'creditCardBrand' => 'VISA', ], 'regKey' => 'Random reg Key', ], ], ]
-
Capture Payment
If
captureis false while processing payment byprocessPaymentfunction, then the payment is completed only after the Catpute API is called. This function completes the payment that was only authorized byprocessPayment. This function takes 2 arguments. TransactionId and the array of parameters.LinePay::verifyPayment($transactionId, $params);
The array param for verifyPayment is described below:
Items Datatype Required Description Remarks amount numeric Y Payment Amount Should match with the amount on Process Payment for the given transaction Id. currency string (3byte) Y Payment Currency Should match with Currency on Process Payment for the given transaction Id.
Supported Languages are:
-ja(Japanese)
-ko(Korean)
-en(English)(DEFAULT)
-zh-Hans(Chinese Simplified)
-zh-Hant(Chinese Traditional)
-th(Thai)The response from the verify payment will be as below
[ 'status' => 'success' or 'failed', 'data' => [ 'request' => 'Params you send while calling the function (You may need to save it to log for future)', 'response' => 'Array response (You may need to save it to log for future)', ], ] The response will be empty [] or as follows: [ 'returnCode' => '0000' (if success) or other code, 'returnMessage' -> 'OK', 'info' => [ 'orderId' => 'The order id', 'transactionId' => 'Transaction Id eg: 12345678', 'info' => [ [ 'method' => 'BALANCE', 'amount' => 10, ], [ 'method' => 'DISCOUNT', 'amount' => 10, ], ], ], ] -
Void Payment
Voids a previously authorized payment. A payment that has been already captured can be refunded by this API
LinePay::voidPayment($transactionId);
The response from the void payment will be as below
[ 'status' => 'success' or 'failed', 'data' => [ 'request' => [], 'response' => 'Array response (You may need to save it to log for future)', ], ] The response will be empty [] or as follows: [ 'statusCode' => '0000' (if success) or other code, 'returnMessage' => 'OK', ]
rohit/line-pay 适用场景与选型建议
rohit/line-pay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 153 次下载、GitHub Stars 达 4, 最近一次更新时间为 2017 年 06 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「payment」 「laravel」 「line pay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rohit/line-pay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rohit/line-pay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rohit/line-pay 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
Laravel package for Accurate Online API integration.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
TrinkPOS Sanal POS (Virtual POS) API client for PHP
统计信息
- 总下载量: 153
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-13