Kotha Payment Integration Toolkit

Accept SSLCommerz payments on your own website using Kotha's open-source integration kits. There is no need for complex server configuration, and Kotha does not sit in the middle of your payments.

1. WooCommerce Plugin

The easiest way to accept payments on a WordPress store.

Installation Guide

  1. Download kotha-pay-wp.zip directly.
  2. Go to your WordPress Admin Dashboard > Plugins > Add New > Upload Plugin.
  3. Activate Kotha Pay for WooCommerce.
  4. Navigate to WooCommerce > Settings > Payments > Kotha Pay.
  5. Enter your SSLCommerz Store ID and Store Password.
Important Note on Gutenberg Checkout Blocks: Kotha Pay is built for the classic WooCommerce checkout layout. If your WordPress theme uses the newer block-based Checkout block by default, the Kotha Pay payment method might not display. To fix this, edit your checkout page, delete the default Checkout Block, and insert a Shortcode Block containing [woocommerce_checkout].

2. Node.js Integration SDK

For custom web applications built with Node.js, Express, or Fastify.

Installation

npm install @kothatech/ssl-integration-kit

Usage Example

const { SslCommerzIntegration } = require('@kothatech/ssl-integration-kit');

const sslcommerz = new SslCommerzIntegration({
  store_id: 'your_store_id',
  store_passwd: 'your_store_password',
  is_sandbox: true // Set to false for production
});

// 1. Initiate a payment session
app.post('/api/pay', async (req, res) => {
  const session = await sslcommerz.initiatePayment({
    total_amount: 100,
    currency: 'BDT',
    tran_id: 'TXN_12345',
    success_url: 'https://yoursite.com/api/success',
    fail_url: 'https://yoursite.com/api/fail',
    cancel_url: 'https://yoursite.com/api/cancel',
    ipn_url: 'https://yoursite.com/api/ipn',
    cus_name: 'John Doe',
    cus_email: 'john@example.com',
    cus_phone: '01711000000',
    cus_add1: 'Dhaka',
    cus_city: 'Dhaka',
    cus_country: 'Bangladesh',
    shipping_method: 'NO',
    product_name: 'Test Product',
    product_category: 'General',
    product_profile: 'general'
  });

  if (session.GatewayPageURL) {
    res.redirect(session.GatewayPageURL);
  }
});

// 2. Handle IPN (Instant Payment Notification)
app.post('/api/ipn', (req, res) => {
  const isValid = sslcommerz.verifyIpnHash(req.body);
  
  if (isValid && req.body.status === 'VALID') {
    // Fulfill the order safely
    console.log('IPN Verified and Paid!', req.body.val_id);
  }
  
  res.status(200).send('IPN Received');
});