🔗 Zoho-Selcom API Integration

Simple PHP endpoints for integrating Selcom payment gateway with Zoho

✅ API is Ready!
Use these endpoints from Zoho or any HTTP client to interact with Selcom payment gateway.

📋 Available Endpoints

POST Create Payment Order

URL: /api/create_order.php

Description: Creates a new payment order in Selcom

Request Body (JSON):

{ "order_id": "INV-12345", "amount": 50000, "currency": "TZS", "buyer_email": "customer@example.com", "buyer_name": "John Doe", "buyer_phone": "+255712345678", "buyer_remarks": "Payment for invoice", "redirect_url": "https://yoursite.com/success", "cancel_url": "https://yoursite.com/cancel", "webhook": "https://yoursite.com/webhook" }

Response (Success):

{ "success": true, "message": "Order created successfully", "data": { "order_id": "INV-12345", "payment_url": "https://...", "reference": "..." } }

GET Check Order Status

URL: /api/order_status.php?order_id=INV-12345

Description: Checks the status of a payment order

Parameters:

Response (Success):

{ "success": true, "message": "Order status retrieved successfully", "data": { "order_id": "INV-12345", "status": "COMPLETED", "amount": 50000, "transaction_id": "..." } }

🔧 Configuration

⚠️ Important: Before using these APIs, update the configuration in config.php:

📝 Using from Zoho

Zoho Deluge Script Example - Create Order:

// Create payment order orderData = { "order_id": invoice.get("Invoice_Number"), "amount": invoice.get("Grand_Total") * 100, "currency": "TZS", "buyer_email": invoice.get("Email"), "buyer_name": invoice.get("Customer_Name"), "buyer_phone": invoice.get("Phone") }; response = invokeurl [ url: "https://yourdomain.com/api/create_order.php" type: POST parameters: orderData.toString() headers: {"Content-Type": "application/json"} ]; info response;

Zoho Deluge Script Example - Check Status:

// Check order status orderId = "INV-12345"; response = invokeurl [ url: "https://yourdomain.com/api/order_status.php?order_id=" + orderId type: GET ]; info response;

📚 Documentation

🔍 Testing

You can test these endpoints using:

cURL Example:

curl -X POST http://localhost/zoho-backend/public/api/create_order.php \ -H "Content-Type: application/json" \ -d '{ "order_id": "TEST-001", "amount": 1000, "currency": "TZS", "buyer_email": "test@example.com" }'