đź’ˇ Only Silver Membership can access this private repo - let's our join discord server
|
I'm a Software Developer who passionate about coding and building tools that help people with their daily tasks.
I'm currently exploring AI solutions and working with modern tech stacks. I'm also on a journey to level up my
Spaghetti Code skills. Support us by make some donate and I really appricate that.
Got a question? Feel free to contact me anytime. |
This project implements a payment gateway for the Bakong KHQR system (Cambodia's QR code-based payment system). It allows merchants to generate KHQR codes and verify payment status through the Bakong API.
- Generate KHQR codes for payments
- Display QR codes for customer scanning
- Poll payment status in real-time
- Simple user interface for payment processing
- PHP 8.0 or higher
- Composer for PHP dependency management
- A Bakong merchant account with API access
- Web server (Apache, Nginx, etc.)
screenshot image of khqr php composer setup with simple ui
-
Clone the repository:
git clone https://github.com/ikhode-technologies/private-repo.git cd private-repo -
Install PHP dependencies using Composer:
composer require khqr-gateway/bakong-khqr-php endroid/qr-code guzzlehttp/guzzle
-
Configure your Bakong API credentials:
- Open
khqr_api.phpand replace'bakong api key'with your actual Bakong API key - Update the Bakong account ID in the
$individualInfoobject:$individualInfo = new IndividualInfo( bakongAccountID: 'your_bakong_account@domain', // ... other settings );
- Open
Modify the merchant details in the khqr_api.php file:
$individualInfo = new IndividualInfo(
bakongAccountID: 'your_bakong_account@domain', // Your Bakong ID
merchantName: 'Your Business Name', // Your business name
merchantCity: 'Your City', // Your business city
currency: KHQRData::CURRENCY_USD, // Currency (USD or KHR)
amount: floatval($amount), // Amount from request
billNumber: $transactionId, // Transaction ID
purposeOfTransaction: 'Payment' // Purpose description
);You can modify the payment amount in index.html:
body: JSON.stringify({
amount: 0.1, // Change to your desired default amount
transactionId: 'TEST' + Date.now()
})- Start your web server pointing to the project directory
- Access the application through your browser (e.g., http://localhost/index.html)
- Click "Generate QR Code" to create a new payment request
- The customer scans the QR code using their Bakong app
- The system automatically checks for payment confirmation
- Once payment is confirmed, the status will update to "Successfully Paid!"
khqr_api.php- Main PHP backend for KHQR generation and payment verificationindex.html- Frontend interface for payment processingpayment.log- Log file for transaction recordsvendor/- Composer dependencies
-
QR Code Not Generating
- Check if all required PHP extensions are installed
- Verify your Bakong API key is correct
- Check the PHP error logs
-
Payment Status Not Updating
- Ensure the Bakong API is accessible from your server
- Check if the polling interval is working correctly
- Verify your Bakong account has the correct permissions
-
CORS Issues
- The application includes CORS headers, but if you're running on a different domain, you may need to adjust the
Access-Control-Allow-Originheader
- The application includes CORS headers, but if you're running on a different domain, you may need to adjust the
The application logs important events to payment.log. Check this file for debugging information:
tail -f payment.logMIT - See the LICENSE file for details
For support, please contact with this contact list or create an issue in the repository.

