How to Integrate RukkyHub Using the Official SDKs for PHP, JavaScript, and Python
Home / How to Integrate RukkyHub Using the Official SDKs for PHP, JavaScript, and Python
Home / How to Integrate RukkyHub Using the Official SDKs for PHP, JavaScript, and Python
Learn how to get started with the official RukkyHub SDKs for PHP, JavaScript, and Python. Follow installation instructions, configure API credentials securely, make your first request, and troubleshoot common integration problems.
RukkyHub provides official software development kits (SDKs) to help developers integrate its API into websites, applications, and business systems. The SDKs make it easier to send API requests from supported programming environments.
This tutorial covers the official PHP, JavaScript, and Python packages, installation commands, secure API key configuration, and a basic balance request.
An SDK is a software package that helps developers communicate with an API without having to write every part of the HTTP request themselves.
RukkyHub's SDKs use the same action based API pattern as the standard API. Requests are sent to a single endpoint, and the action parameter specifies the operation to perform.
Official package installation commands and code examples are available in the RukkyHub SDKs and Libraries documentation.
Before integrating an SDK, make sure you have:
Never publish your secret API key in frontend code, a public repository, or a client-side application bundle.
For PHP projects, install the official Composer package using:
composer require rukkyhub/php
Use Composer to manage the dependency and follow the package's current documentation for its supported methods and configuration options.
If you are using Laravel or another PHP framework, make sure Composer dependencies are installed in the environment where your application runs.
For JavaScript projects using Node.js, install the official NPM package:
npm install rukkyhub-js
Keep your secret API key in a server-side environment variable. Although JavaScript can run in a browser, secret API credentials should not be embedded in public browser code.
If your application has a frontend and backend, make the RukkyHub API request from the backend and return only the information the frontend needs.
For Python projects, install the official package from PyPI using:
pip install rukkyhub-sdk
Use a virtual environment where appropriate to manage dependencies for your project and reduce conflicts with other Python packages.
Store your API key in a server-side environment variable rather than writing the actual key directly into source code.
For example, an environment variable named RUKKYHUB_API_KEY can hold your credential. Your application should read the variable at runtime.
The following shell command illustrates how to set the variable for a local development session:
export RUKKYHUB_API_KEY="YOUR_API_KEY"
Replace the placeholder with your own key in your private environment. Do not commit secrets or real credentials to source control.
Use the configuration method recommended for your hosting platform in production.
The official RukkyHub API base URL is:
https://developers.rukkyhub.com/api/v1
API requests use the POST method and form-encoded parameters. Authentication is recommended through the X-API-KEY HTTP header, and responses are returned as JSON.
The action parameter identifies the operation. For example:
Your API key must have the appropriate scope for the action you request.
Start with a balance request to test your connection and authentication. The following examples show the basic request pattern using standard HTTP libraries. Refer to the official SDK documentation for package-specific client methods.
PHP using cURL
<?php $apiUrl = "https://developers.rukkyhub.com/api/v1"; $apiKey = getenv("RUKKYHUB_API_KEY"); if (!$apiKey) { throw new RuntimeException("API key is not configured."); } $ch = curl_init($apiUrl); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query([ "action" => "balance" ]), CURLOPT_RETURNTRANSFER => true, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 20, CURLOPT_HTTPHEADER => [ "X-API-KEY: " . $apiKey, "Accept: application/json" ] ]); $response = curl_exec($ch); if ($response === false) { $error = curl_error($ch); curl_close($ch); throw new RuntimeException("API connection failed: " . $error); } $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $result = json_decode($response, true); if (!is_array($result)) { throw new RuntimeException("The API returned an invalid JSON response."); } if ($statusCode < 200 || $statusCode >= 300) { throw new RuntimeException("The API request failed with HTTP status " . $statusCode); } print_r($result); ?>
This example uses PHP's built-in cURL extension to demonstrate the documented API request format. It does not rely on an assumed SDK-specific method name.
JavaScript using Node.js fetch
const apiUrl = "https://developers.rukkyhub.com/api/v1"; const apiKey = process.env.RUKKYHUB_API_KEY; async function getBalance() { if (!apiKey) { throw new Error("API key is not configured."); } const body = new URLSearchParams({ action: "balance" }); const response = await fetch(apiUrl, { method: "POST", headers: { "X-API-KEY": apiKey, "Content-Type": "application/x-www-form-urlencoded", "Accept": "application/json" }, body }); const result = await response.json(); if (!response.ok) { throw new Error(`API request failed: HTTP ${response.status}`); } return result; } getBalance() .then(console.log) .catch(console.error);
This example is intended for a server-side Node.js environment. Do not place the secret key in frontend JavaScript.
Python using requests
import os import requests API_URL = "https://developers.rukkyhub.com/api/v1" API_KEY = os.environ.get("RUKKYHUB_API_KEY") if not API_KEY: raise RuntimeError("API key is not configured.") response = requests.post( API_URL, headers={ "X-API-KEY": API_KEY, "Accept": "application/json" }, data={ "action": "balance" }, timeout=20 ) response.raise_for_status() result = response.json() print(result)
The PHP, JavaScript, and Python examples demonstrate the official API's HTTP request pattern. If you want to use a package-specific SDK client, consult its current documentation and examples in the official repository.
After your basic request works, you can add the actions your application needs. Each action may require different parameters and scopes.
For VTU purchase actions, follow the documented parameter requirements, including the required transaction PIN where applicable. Test transaction-creating requests carefully and never assume that a timeout means the transaction failed.
A production integration should check both the HTTP response and the JSON data returned by the API. Do not assume that receiving JSON automatically means the operation succeeded.
For documented error meanings, consult the RukkyHub API Error Codes page.
The official SDK repository contains source code, examples, and release notes:
Open the RukkyHub SDK Repository on GitHub
Review the latest package documentation and repository instructions before relying on package-specific class names, methods, or configuration options.
Which programming languages have official RukkyHub SDKs?
The official SDK documentation lists packages for PHP, JavaScript, and Python.
Can I integrate RukkyHub without an SDK?
Yes. You can send standard HTTP POST requests to the documented API endpoint using any language that supports HTTP requests.
Can I use my secret API key in frontend JavaScript?
No. Keep secret API credentials on your backend server and make API requests from a trusted server-side environment.
Where can I find the correct installation command?
Use the official SDKs and Libraries documentation for the current PHP, JavaScript, and Python package commands.
Our support team is ready to assist you.
For instant reply, reach out to our live chat.
Login to Contact SupportSecure payment gateways, automation providers, and infrastructure.