Download the PHP package sokeng/khqr-gateway without Composer
On this page you can find all versions of the php package sokeng/khqr-gateway. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package khqr-gateway
Bakong KHQR PHP
This is a complete implementation of the bakong-khqr npm module, including all the available API calls documented here: https://api-bakong.nbc.gov.kh/document.
Installation
Usage
All available methods are exposed through the BakongKHQR class:
Generate KHQR for an individual
Output:
Generate KHQR for a merchant
Output:
Decode KHQR
Output:
Verify KHQR
Output:
API - Generate KHQR with Deep Link
Output:
API - Check Bakong Account Existence
Output:
API - Check Transaction Status
A valid token is required to check transaction status. You can get one by registering on the Bakong website: https://api-bakong.nbc.gov.kh/register. At the moment of writing this README the token has to be renewed every 90 days. Then you can create a BakongKHQR instance with the token:
Check Transaction by MD5
Check Transaction by MD5 List
Check Transaction by Full Hash
Check Transaction by Full Hash List
Check Transaction by Short Hash
Check Transaction by Instruction Reference
Check Transaction by External Reference
API - Renewing an expired Bakong API Token
If your token has expired, you will get a KHQRException when calling authorized Bakong API requests:
You can renew your token with the renewToken method:
Output:
In case your email is not registered:
Testing
To run the tests:
Static Code Analysis
To run static code analysis:
Code Style
To run the code style fixer:
Code Refactoring
Troubleshooting
PHP curl does not work correctly on Windows.
It may be due to the fact that your PHP configuration does not include a valid certificate file. This can be confirmed by disabling the SSL verification:
or by checking with phpinfo():
If that's true, the certificate file can be downloaded from https://curl.se/ca/cacert.pem, and include in php.ini file:
After that, restart your services or your terminal and retest.