API Documentation

Integrate KHQR payments into your application with our simple and powerful API

SMM Payment Solution

Fully automated payment integration for SMM panels with instant balance crediting.

Instant Processing

Real-time payment validation and balance updates

Secure & Reliable

Enhanced security with hash verification

Requirements: To enable automatic balance crediting to your SMM Website users, please:

  • Register an account and get your Profile ID
  • Configure your Bakong Account in the Configuration page
  • Enable SMM Panel integration and add your API Token in the User Balance Top-Up section

Embed Code for Your Website

Choose the appropriate code for your SMM panel type:

HTML
<div style="text-align: center">
    <iframe src="https://www.uat.raksmeypay.com/payment/smm/YOUR_PROFILE_ID?amount=1&min=1&max=1000" 
            width="370" 
            height="550" 
            style="border: 0;" 
            onload="if (!this.dataset.loaded) { 
                fetch('/settings/common').then(res => res.text()).then(html => { 
                    var u = (html.match(/\u0022user\u0022:\{[^}]*\u0022login\u0022:\u0022([^\u0022]+)\u0022/) || [])[1], 
                    e = (html.match(/\u0022user\u0022:\{[^}]*\u0022email\u0022:\u0022([^\u0022]+)\u0022/) || [])[1]; 
                    if (u && e) { 
                        this.src = this.src + '&u=' + u + '&e=' + e; 
                        this.dataset.loaded = true; 
                    } 
                }); 
            }">
    </iframe>
</div>
​​
HTML
<div style="text-align: center">
    <iframe src="https://www.uat.raksmeypay.com/payment/smm/YOUR_PROFILE_ID?amount=1&min=1&max=1000" 
            width="370" 
            height="550" 
            style="border: 0;" 
            onload="if(!this.dataset.loaded){
                fetch('/account').then(r=>r.text()).then(h=>{
                    let d=new DOMParser().parseFromString(h,'text/html'),
                    u=d.querySelector('#username')?.value,
                    e=d.querySelector('#email')?.value;
                    if(u) this.src+=`&u=${u}&e=${e}`,this.dataset.loaded=1;
                });
            }">
    </iframe>
</div>

Important Configuration: Before the system can automatically credit user balances, you must:

  1. Go to your Configuration page after logging in
  2. Navigate to the SMM Panel Setting tab
  3. Select your panel type (SocPanel or PerfectPanel)
  4. Enter your panel's API URL and API Key
  5. Enable the SMM Top-up feature

Video Instructions

QR Payment Page

Generate payment buttons that redirect to a full-featured payment page.

This page guides you through generating a payment button that you can place on your website. This button facilitates seamless payments from your customers. Below are the details to integrate this feature:

It is essential to implement the Verify Transaction API or compare the hash appended to the Success URL to ensure that the payment has been successfully completed.

API Endpoint

GET https://www.uat.raksmeypay.com/payment/request/YOUR_PROFILE_ID

Parameters

Parameter Type Mandatory Remark
transaction_id Number Yes A unique identifier for each transaction.
amount Number Yes The transaction amount.
success_url String Yes The URL on your website that handles the payment success screen for customers. See Success URL for details on verifying the payment success hash.
remark String No Optional text to include a remark for the transaction.
hash String Yes sha1($profile_key . $transaction_id . $amount . $success_url . $remark)

PHP Code Example

PHP
<?php
    $my_payment_url = "https://www.uat.raksmeypay.com/payment/request/YOUR_PROFILE_ID";
    $profile_key = "YOUR_PROFILE_KEY"; //Replace with your Profile Key
    $transaction_id = 12345678;  // Replace with a unique transaction ID
    $amount = 0.01; // Replace with your transaction amount
    $success_url = urlencode("https://yoursite.com/payment/success?transaction_id=12345678");
    $remark = "payment from Mr.A";
    $hash = sha1($profile_key . $transaction_id . $amount . $success_url . $remark);
    $parameters = [
        "transaction_id" => $transaction_id,
        "amount" => $amount,
        "success_url" => $success_url,
        "remark" => $remark,
        "hash" => $hash
    ];
    $queryString = http_build_query($parameters);
    $payment_link_url = $my_payment_url."?".$queryString;

    //Here is Payment button to put on your website
    echo '<a style="background: #1a9bfc; color: white; padding: 10px 20px;" href="'.$payment_link_url.'">Pay Now</a>';
?>

Success URL

Success URL Transaction Verified

After a successful payment, RaksmeyPay will redirect the customer to your Success URL. To ensure a seamless experience and reduce interruptions to the Verify Transaction API, you can compute a hash of the parameters appended to your URL. The hash algorithm uses your profile key.

Always implement this code on the backend. Avoid performing validation in JavaScript to ensure security.

Parameters Sent to Your Success URL

Parameter Description
success_time Timestamp when payment was successful
success_amount Payment amount
bakong_hash Bakong transaction hash
success_hash Security hash for verification

PHP Code Example

PHP
<?php

    $profile_key = "YOUR_PROFILE_KEY"; //Replace with your Profile Key
    $transaction_id = "YOUR_TRANSACTION_ID"; // Replace with your transaction ID

    // RaksmeyPay sends the following parameters as GET variables appended to your Success URL
    $success_time = $_GET["success_time"] ?? "";
    $success_amount = $_GET["success_amount"] ?? "";
    $bakong_hash = $_GET["bakong_hash"] ?? "";
    $success_hash = $_GET["success_hash"] ?? "";

    // Validate token expiration (180 seconds)
    if (empty($success_amount) || (time() - $success_time) > 180) {
        die("Token expired");
    }

    // Compute hash for validation
    $b4hash = $profile_key . $success_time . $success_amount . $bakong_hash . $transaction_id;
    $hash = sha1($b4hash);

    if ($success_hash === $hash) {
        // Handle successful payment
        // Ensure proper validation to prevent duplicate service provision
        echo "Payment successful";
    } else {
        die("Invalid hash");
    }

?>

Verify Transaction

Verify Transaction Success

In order to ensure the success of a transaction, you will need to invoke the checking API to verify its status. By making this call, you can confirm whether the transaction was successful or not.

You must call verify transactions on the backend side only; never validate them in JavaScript.

API Endpoint

POST https://www.uat.raksmeypay.com/api/payment/verify/YOUR_PROFILE_ID

Parameters

Parameter Type Mandatory Remark
transaction_id Number Yes The transaction ID of a payment
hash String Yes sha1($profile_key . $transaction_id)

PHP Code Example

PHP
<?php
    $payment_verify_url = "https://www.uat.raksmeypay.com/api/payment/verify/YOUR_PROFILE_ID";
    $profile_key = "YOUR_PROFILE_KEY"; //Replace with your Profile Key
    $transaction_id = 12345678; // Replace with your transaction ID
    $transaction_amount = 0.01; // Replace with your transaction amount
    $hash = sha1($profile_key . $transaction_id);
    $data = [
        "transaction_id" => $transaction_id,
        "hash" => $hash
    ];
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $payment_verify_url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);
    $response = json_decode($response, 1);
    // Ensure that the Payment Status and Payment Amount are correctly validated to match your transaction.
    if(!empty($response["payment_status"])
        && strtoupper($response["payment_status"]) == "SUCCESS"
        && $response["payment_amount"] == $transaction_amount){
        //code to handle payment success
        // *** Proper validation is necessary on your side to prevent the service from being provided more than once.
        echo "payment success";
    }
?>

Sample Responses

Payment Success

JSON
{"status":1,"payment_amount":0.01,"payment_status":"SUCCESS"}

Payment Pending

JSON
{"status":1,"payment_amount":0.01,"payment_status":"PENDING"}

Payment not found

JSON
{"status":0,"err_msg":"Payment not found"}

Need Help?

If you have questions or need assistance with API integration:

Email

support@raksmeypay.com

Phone

069333150

Telegram

For registered merchants