Indian Betting Payment System Integration WordPress Tutorials
foreword
Please note that gambling is illegal in most parts of India, with only a few states (e.g. Goa, Sikkim, etc.) allowing specific forms of gambling activities. Please ensure that your business complies with local laws and regulations before proceeding with any payment system integration.
Legitimate Payment Gateway Options
If you operate a legitimate online gaming or lottery platform (with the appropriate licence), consider the following local payment gateways in India:
- Paytm Payment Gateway
- Razorpay
- CCAvenue
- PayU India
- Instamojo (for small transactions)
WordPress Integration Steps
Method 1: Use the official plugin (take Razorpay as an example)
-
Installation of plug-ins
- Log in to the WordPress backend
- Go to "Plugins" > "Add New".
- Search for "Razorpay"
- Install and activate the official Razorpay plugin
-
Configuration settings
- Go to WooCommerce > Settings > Payments
- Enable Razorpay option
- Enter your API key (get it from Razorpay merchant panel)
- Configure other options such as payment method logo, order status, etc.
-
Test Transactions
- Razorpay provides a test mode to verify functionality with a test API key.
Method 2: Custom Integration Code Sample (PHP)
If you need a more flexible solution:
// Add the following code snippet to functions.php
function custom_payment_gateway_init() {
if (!class_exists('WC_Payment_Gateway')) return; return;
class WC_Custom_India_Gateway extends WC_Payment_Gateway {
public function __construct() {
$this->id = 'custom_india_gateway';
$this->method_title = __('Indian Payment Gateway', 'woocommerce');
// ... Other initialisation code...
}
public function process_payment($order_id) {
global $woocommerce.
$order = new WC_Order($order_id);
// API Call Example (PayTM)
$params = array(
'MID' => 'YOUR_MID',
'ORDER_ID' => $order_id,
'CUST_ID' => get_current_user_id(),
// ... Other necessary parameters...
);
// ... Handling API responses...
return array(
'result' => 'success',
'redirect' => $payment_url_from_api_response,
);
}
}
add_filter('woocommerce_payment_gateways', 'add_custom_india_gateway');
function add_custom_india_gateway($methods) {
$methods[] = 'WC_Custom_India_Gateway'.
return $methods.
}
}
add_action('plugins_loaded', custom_payment_gateway_init,0);
SSL Certificate Requirements
All websites involving payments must have a valid SSL certificate installed to ensure secure data transmission.
KYC Compliance Tips
As per Reserve Bank of India (RBI) regulations:
- Indian payment gateways require full KYC verification for merchants.
- Transaction limits may apply based on your business type and documents provided.
It is recommended to contact your chosen payment gateway provider for specific KYC requirements.
Important Legal Notices:: This tutorial is intended for educational purposes only. Before implementing any betting/gaming related business activities, please consult a professional legal advisor to confirm its legality in your area.
Indian betting payment system integration WordPress tutorial (continued)
Advanced Integration and Compliance Management
1. Multi-gateway parallel configuration
For high-traffic gaming platforms, it is recommended to configure multiple payment gateways to increase redundancy:
// Add multi-gateway support in functions.php
add_filter('woocommerce_payment_gateways', 'add_multiple_indian_gateways');
function add_multiple_indian_gateways($gateways) {
$gateways[] = 'WC_Razorpay_Gateway'.
$gateways[] = 'WC_PayTM_Gateway';
$gateways[] = 'WC_CCAvenue_Gateway'.
return $gateways.
}
2. Geo-Restriction implementation (important)
Geographic restrictions must be imposed based on differences in state laws in India:
Recommended plug-in solution:
- WooCommerce GeoIP Blocking
- IP2Location Country Blocker
Code implementation example:
// Blocking access to payment pages from non-permitted areas
add_action('template_redirect', 'restrict_payment_by_state');
function restrict_payment_by_state() {
if(is_checkout()) {
$state_code = WC_Geolocation::geolocate_ip()['state'];
$banned_states = array('MH','GJ','AP','TN'); // Maharashtra and other states that prohibit online gambling
if(in_array($state_code, $banned_states)) {
wp_redirect(home_url('/legal-restriction'));;
exit;
}
}
}
3. UPI Special Integration Programme (most popular payment method in India)
Enhance UPI support by:
// UPI Deep Link Generation Example
function generate_upi_deeplink($amount, $txn_id) {
$upi_id = 'yourmerchant@upi'; // registered merchant UPI ID
return sprintf(
'upi://pay?pa=%s&pn=%s&am=%s&tn=%s',
urlencode($upi_id),
urlencode(get_bloginfo('name')),
floatval($amount),
sanitize_text_field($txn_id)
);
}
// WooCommerce Hook Access
add_filter('woocommerce_cod_process_payment_order_status', function() use ($order) {
update_post_meta($order->get_id(), '_payment_upi_reference', $_GET['utr']);
},10,2);
AML Anti-Money Laundering Measures Implementation
As required by Indian FEMA regulations:
-
Transaction Monitoring Settings
/* WordPress database add custom field records */
ALTER TABLE wp_postmeta ADD INDEX idx_large_transactions (meta_key, meta_value);
/* WooCommerce order enquiry for large transactions */
SELECT * FROM wp_postmeta
WHERE meta_key IN ('_order_total') AND CAST(meta_value AS DECIMAL) >50000;
-
Mandatory KYC verification process
- Electronic KYC service APIs such as Integrate Digio or SignDesk
- Add mandatory document upload field in checkout.
jQuery(document).ready(function(){
jQuery('#place_order').click(function(e){
if(!jQuery('#kyc_proof').val()){
e.preventDefault();
alert('Please upload your PAN card and proof of address to complete the verification');;
}
});
});
GST Tax Compliance Processing
Special tax rules for gaming/lottery type services:
- Automatic calculation of tax rates
Use the WooCommerce Tax settings:
Go to: WooCommerce → Settings → Tax → Standard Rates
Add the following tax rules.
| Country | State | Rate% | Name |
|---------|-------|-------|------------|
| IN | * | 28% | GST-Gaming |
Note: Different tax rates may apply to some states and need to be configured separately.
Webhook Security Hardening
Key measures to prevent tampering with payment callbacks:
# Nginx Server Additional Security Configuration Example (added to site configuration file)
location ~* /payment-callback/ {
allow x.x.x.x; # PayTM/Razorpay Official IP Segment
deny all.
}
location ~ \. (php)$ {
if ($http_x_requested_with ! = "XMLHttpRequest"){
limit_req zone=payment burst=5 nodelay.
} } ```
With signature verification on the WordPress side.
```php
$razorpay_signature = $_SERVER['HTTP_X_RazorPay_Signature'];
$generated_signature = hash_hmac(
"sha256".
file_get_contents("php://input"),
get_option("rzp_secret")
);
if (!hash_equal((string)$generated_signature,(string)$razorpay_signature)){
status_header(403); die("Invalid Signature").
}
CDN Cache Exclusion Strategy
Ensure that all dynamic content is not cached (applies to Cloudflare, etc.)::
/wp-json/wc/v3/*
/checkout/*
/my-account/*
/payment-verify/*
⚠️ Final Legal Tips:
- Section 67A of the Indian IT Act specifically prohibits the operation of illegal gambling websites. Even if the above technical solutions are used, they can only be legally operated after obtaining a licence as follows.
- Sikkim Online Gaming Licence
- Goa Casino Licence
- Nagaland RNG Certification
- FEMA requires cross-border fund movements to be reported through AD Category banks. It is recommended to consult a professional financial compliance consultant to design your funds settlement structure.
Leave a Reply