toanppp / php-zalo-pay
PHP Zalo Pay integration.
1.0.0
2022-05-15 07:21 UTC
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2024-12-29 23:18:01 UTC
README
About
PHP Zalo Pay integration.
Todo
- Payment
- Disbursement
Install
composer require toanppp/php-zalo-pay
Methods
ZaloPay :: __construct ( array
params, string
env )
Create Zalo Pay service instance
param
must containappID
,paymentID
,hMacKey
,privateKey
env
:ZaloPay::ENV_PRODUCTION
|ZaloPay::ENV_SANDBOX
|ZaloPay::ENV_SANDBOX_QC
$params = [ 'appID' => 'appID', 'paymentID' => 'paymentID', 'hMacKey' => 'hMacKey', 'privateKey' => 'privateKey', ]; $zaloPay = new ZaloPay($params, ZaloPay::ENV_SANDBOX_QC);
ZaloPayDisbursement :: queryUser ( string
phone, string
&requestID ) : array
Query Zalo Pay user info.
ZaloPayDisbursement :: transferFund ( ... ) : array
Transfer fund to user's wallet.
Params:
string
mUID : response inqueryUser
functionint
amountstring
descriptionarray
partnerEmbedDataarray
extraInfostring
&partnerOrderID
ZaloPayDisbursement :: queryOrder ( string
partnerOrderID, string
&requestID ) : array
Query order info (status,...).
ZaloPayDisbursement :: queryBalance ( string
&requestID ) : array
Query merchant's wallet balance.
ZaloPayDisbursement :: disbursement ( ... , int
maxQueryTimes) : bool
Transfer fund to user's wallet & query status.
// Query user $phone = '0987654321'; $queryUserRequestID = ''; $userInfoResponse = $zaloPay->queryUser($phone, $queryUserRequestID); if ($userInfoResponse['return_code'] != ZaloPay::RETURN_CODE_SUCCESS) { return false; } // Disbursement $partnerOrderID = ''; return $zaloPay->disbursement($userInfoResponse['data']['m_u_id'], 1, 'Demo disbursement', [], [], $partnerOrderID, 3);