syednasharudin / malakatpay-client
Malakatpay网关包装客户端
1.0.0
2023-09-19 09:22 UTC
Requires
- php: ^7.1.3
- ext-json: *
- kitetail/zttp: ^0.6.0
Requires (Dev)
- phpunit/phpunit: ^8.5
- vlucas/phpdotenv: ^4.1
README
非官方的MalakatPay支付网关 SDK
目录
安装
Composer
composer require syednasharudin/malakatpay
或者,您可以在项目的现有composer.json文件中将它指定为依赖项
{
"require": {
"syednasharudin/malakatpay-client": "^1.0.0"
}
}
用法
安装后,您需要要求Composer的自动加载器并添加您的代码。
配置设置
$config = [
'api_key' => getenv('MALAKATPAY_API_KEY'),
'signature_key' => getenv('MALAKATPAY_X_SIGNATURE')
];
或者使用Laravel配置文件,命名为malakatpay.php
,并保留make()
为空
return [
'api_key' => env('MALAKATPAY_API_KEY'),
'signature_key' => env('MALAKATPAY_X_SIGNATURE', null),
'is_sandbox' => env('MALAKATPAY_SANDBOX', env('APP_ENV') != 'production'),
];
集合
创建集合
MalakatPay::make()
->collection()
->create("Collection Name");
获取集合
MalakatPay::make()
->collection()
->fetchList();
更新集合名称
MalakatPay::make()
->collection()
->updateCollectionName("CollectionID", "New Name");
通过代码获取集合
MalakatPay::make()
->collection()
->fetchByCode("CollectionCode");
账单
创建账单
MalakatPay::make()
->bill()
->makeBill("COLLECTION CODE")
->setCustomer("Amirul", "Amirul", "hello@gmail.com", "60123456789", "Melaka")
->setReference("Testing")
->setProduct("Product 1", 10.30, 1)
->create();
产品
创建产品
MalakatPay::make()
->product()
->create(string|array $title/$arrays, string $code, string $description, $price);
获取产品
MalakatPay::make()
->product()
->getList();
客户
创建客户
MalakatPay::make()
->customer()
->create(string|array $firstName/$arrays, string $lastName = null, string $phoneNumber = null, string $email = null);
获取客户
MalakatPay::make()
->customer()
->getList();
直接支付
直接支付收款人
$response = MalakatPay::make()
->directPay()
->payee("COLLECTION CODE")
->getDirectPays();
直接支付付款人
$response = MalakatPay::make()
->directPay()
->payee("COLLECTION CODE")
->getTransactions($direct_pay_payer_code);
从重定向/Webhook检查校验和
MalakatPay::make()->isCheckSumValid($payload); //boolean
源代码
待办事项
- 其他Malakat Pay功能。仍在开发中
- 单元测试
- 修改README
许可证
许可协议:MIT许可