📖 Documentation
Overview
The bKash Blogger integration provides a simple JavaScript-based solution for accepting bKash payments on your Blogger/Blogspot website. This solution works entirely on the client-side, making it perfect for static sites.
Core Components
1. bkash-payment.js
The main payment processing script that handles bKash API integration.
<script src="bkash-payment.js"></script>
2. blogger.js
Helper functions specifically designed for Blogger integration.
<script src="blogger.js"></script>
API Reference
bkashBlogger.initButton()
Initializes a payment button with bKash integration.
bkashBlogger.initButton(buttonId, amountInputId);
Parameters:
buttonId(string): The ID of the button element that triggers paymentamountInputId(string): The ID of the input element containing the payment amount
Example Usage
<!-- Add input field for amount -->
<input id="amount" type="number" placeholder="Enter amount" />
<!-- Add payment button -->
<button id="payBtn">Pay with bKash</button>
<!-- Include scripts -->
<script src="bkash-payment.js"></script>
<script src="blogger.js"></script>
<!-- Initialize button -->
<script>
bkashBlogger.initButton('payBtn', 'amount');
</script>
Configuration
Setting Up Credentials
Before going live, you need to configure your bKash merchant credentials in bkash-payment.js:
window.bkashCreds = {
merchantNumber: 'YOUR_MERCHANT_ID',
username: 'YOUR_USERNAME',
password: 'YOUR_PASSWORD',
appKey: 'YOUR_APP_KEY',
appSecret: 'YOUR_APP_SECRET'
};
Environment
For testing, use sandbox credentials from bKash Developer Portal. For production, replace with live credentials.
Payment Flow
- User enters amount and clicks payment button
- Script generates a unique invoice ID
- Opens bKash payment popup window
- User completes payment on bKash platform
- Popup closes and returns to your site
Security Notes
- All payment processing happens on bKash's secure servers
- Never store sensitive card or payment information on your site
- Always use HTTPS for production websites
- Keep your API credentials secure and never commit them to public repositories
Browser Support
This solution works on all modern browsers including:
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers (iOS Safari, Chrome Mobile)