loki1729/laravel-thepeer
Composer 安装命令:
composer require loki1729/laravel-thepeer
包简介
Laravel Package for easy integration of ThePeer APIs.
README 文档
README
Installation
composer require loki1729/laravel-thepeer
Usage
Following are some ways through which you can access the ThePeer provider:
// Import the class namespaces first, before using it directly use \Loki1729\LaravelThePeer\Services\ThePeer as ThePeerClient; $the_peer_service = new ThePeerClient;
Publish Config Folder
php artisan vendor:publish --provider "Loki1729\LaravelThePeer\ServiceProviders\ThePeerServiceProvider"
Configuration File
The configuration file loki_the_peer.php is located in the config folder. Following are its contents when published:
return [ 'mode' => env('THE_PEER_MODE', 'sandbox'), // Can only be 'sandbox' Or 'live'. If empty or invalid, 'live' will be used. 'sandbox' => [ 'public_key' => env('THE_PEER_TEST_PUBLIC_KEY', ''), 'secret_key' => env('THE_PEER_TEST_SECRET_KEY', ''), ], 'live' => [ 'public_key' => env('THE_PEER_LIVE_PUBLIC_KEY', ''), 'secret_key' => env('THE_PEER_LIVE_SECRET_KEY', ''), ], ];
Configuration Options
You can either use the env to set your keys or use your keys as shown in the example below:
$the_peer_service = new ThePeerClient($mode, $secret_key); For local testing, the "mode" is set to "sandbox"; $the_peer_service = new ThePeerClient('sandbox', 'secret-key'); For Live testing, the "mode" is set to "live"; $the_peer_service = new ThePeerClient('live', 'secret-key');
Index User
$the_peer_service->indexUser(string $name, string $email, string $identifier);
All Users
$the_peer_service->allUsers(int $page = null, int $perPage = null);
Update User
$the_peer_service->updateUser(string $userReference, string $identifier);
Delete User
$the_peer_service->deleteUSer(string $userReference);
Get User Link
$the_peer_service->getUserLink(string $userReference);
Get Transaction
$the_peer_service->getTransaction(string $transactionId);
Refund Transaction
$the_peer_service->refundTransaction(string $transactionId, string $reason);
Get Link
$the_peer_service->getLink(string $linkId);
Charge Link
$the_peer_service->chargeLink(string $linkId, float $amount, string $remark);
Test Credit
$the_peer_service->testCredit(float $amount, string $currency, string $user_reference);
Test Charge
$the_peer_service->testCharge(float $amount, string $from, string $to, string $currency, string $remark, string $channel);
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-02