Ready-to-use code snippets for your Blogger website
Perfect for selling a single product or service on your Blogger post.
<!-- Single Product Payment Example -->
<div style="background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); padding: 30px; border-radius: 12px; text-align: center; max-width: 400px; margin: 20px auto;">
<div style="background: white; padding: 25px; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,0.08);">
<h3 style="color: #2c3e50; margin-bottom: 10px;">Premium eBook</h3>
<p id="price1" data-price="500" style="font-size: 28px; color: #e2136e; font-weight: bold; margin: 15px 0;">৳500</p>
<button id="pay-btn-1" style="background: linear-gradient(135deg, #e2136e 0%, #c5115d 100%); color: white; border: none; padding: 14px 30px; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; width: 100%;">
Pay with bKash
</button>
</div>
</div>
<script>
(function() {
const btn = document.getElementById('pay-btn-1');
const priceEl = document.getElementById('price1');
btn.addEventListener('click', function() {
const amount = priceEl.dataset.price;
const merchant = 'YOUR_MERCHANT_NUMBER'; // ⚠️ Replace with your merchant number
const invoice = 'INV-' + Date.now();
// ⚠️ Replace with your GitHub Pages URL
const popupUrl = 'https://yourusername.github.io/bkash-blogger-payment/popup.html?amount=' + amount + '&merchant=' + merchant + '&invoice=' + invoice;
window.open(popupUrl, 'bkashPayment', 'width=450,height=700,scrollbars=yes');
});
})();
</script>
Sell multiple products with different prices on the same page.
<!-- Multiple Products Example -->
<div style="max-width: 800px; margin: 0 auto;">
<!-- Product 1 -->
<div style="background: white; padding: 20px; margin: 15px 0; border-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<div>
<h4 style="color: #2c3e50; margin-bottom: 5px;">Basic Plan</h4>
<p style="color: #e2136e; font-size: 20px; font-weight: bold;">৳300</p>
</div>
<button class="pay-btn" data-price="300" data-product="Basic Plan">Buy Now</button>
</div>
<!-- Product 2 -->
<div style="background: white; padding: 20px; margin: 15px 0; border-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<div>
<h4 style="color: #2c3e50; margin-bottom: 5px;">Premium Plan</h4>
<p style="color: #e2136e; font-size: 20px; font-weight: bold;">৳800</p>
</div>
<button class="pay-btn" data-price="800" data-product="Premium Plan">Buy Now</button>
</div>
<!-- Product 3 -->
<div style="background: white; padding: 20px; margin: 15px 0; border-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<div>
<h4 style="color: #2c3e50; margin-bottom: 5px;">Ultimate Plan</h4>
<p style="color: #e2136e; font-size: 20px; font-weight: bold;">৳1500</p>
</div>
<button class="pay-btn" data-price="1500" data-product="Ultimate Plan">Buy Now</button>
</div>
</div>
<style>
.pay-btn {
background: linear-gradient(135deg, #e2136e 0%, #c5115d 100%);
color: white;
border: none;
padding: 10px 24px;
border-radius: 6px;
font-weight: 600;
cursor: pointer;
}
</style>
<script>
document.querySelectorAll('.pay-btn').forEach(btn => {
btn.addEventListener('click', function() {
const amount = this.dataset.price;
const product = this.dataset.product;
const merchant = 'YOUR_MERCHANT_NUMBER'; // ⚠️ Replace
const invoice = product.replace(/\s+/g, '-') + '-' + Date.now();
const popupUrl = 'https://yourusername.github.io/bkash-blogger-payment/popup.html?amount=' + amount + '&merchant=' + merchant + '&invoice=' + invoice;
window.open(popupUrl, 'bkashPayment', 'width=450,height=700');
});
});
</script>
Let customers enter their own amount (useful for donations, custom orders, etc.).
<!-- Custom Amount Example -->
<div style="background: #f8f9fa; padding: 30px; border-radius: 12px; max-width: 400px; margin: 20px auto; text-align: center;">
<h3 style="color: #2c3e50; margin-bottom: 20px;">Enter Your Amount</h3>
<input
type="number"
id="custom-amt"
placeholder="Enter amount (min 10)"
min="10"
style="width: 100%; padding: 12px; border: 2px solid #dee2e6; border-radius: 8px; font-size: 16px; margin-bottom: 20px; text-align: center;"
/>
<button id="pay-custom" style="background: linear-gradient(135deg, #e2136e 0%, #c5115d 100%); color: white; border: none; padding: 14px 30px; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; width: 100%;">
Pay with bKash
</button>
</div>
<script>
document.getElementById('pay-custom').addEventListener('click', function() {
const amount = document.getElementById('custom-amt').value;
if (!amount || amount < 10) {
alert('Please enter an amount (minimum 10 BDT)');
return;
}
const merchant = 'YOUR_MERCHANT_NUMBER'; // ⚠️ Replace
const invoice = 'CUSTOM-' + Date.now();
const popupUrl = 'https://yourusername.github.io/bkash-blogger-payment/popup.html?amount=' + amount + '&merchant=' + merchant + '&invoice=' + invoice;
window.open(popupUrl, 'bkashPayment', 'width=450,height=700');
});
</script>
Fork this repository and enable GitHub Pages in settings. Your files will be available at: https://yourusername.github.io/bkash-blogger-payment/
Visit bKash Developer Portal and get your merchant credentials. Use sandbox credentials for testing.
In all code examples above, replace YOUR_MERCHANT_NUMBER with your actual merchant number.
Replace https://yourusername.github.io/bkash-blogger-payment/ with your actual GitHub Pages URL.
Copy any example code above, go to your Blogger post, switch to HTML view, and paste the code where you want the payment button.
Publish your post and test the payment flow. Use sandbox credentials and test wallet for initial testing.
100% client-side JavaScript. Works directly on Blogger without any server.
All payments go through official bKash gateway. Your site only handles the UI.
Beautiful, responsive design that works perfectly on all devices.
Easy to customize colors, text, and layout to match your brand.
Minimal JavaScript, fast loading, no heavy dependencies.
MIT licensed, free to use, modify, and distribute.