Postback Security

This page will guide you through the integration security in your postback

To make postbacks safe, you should verify the signature received in the postback. This is an important feature for you to make sure that the postback, which you use as a base to reward your users, is coming from Revlum and is not fake. By checking the hash, you can be sure that the postback was sent by us and that it is legit.
The signature parameter should match the MD5 of the subId transactionId reward secretkey.

The formula to be checked is as follows:

<?php
   $secret = ""; // Get your secret key from Revlum

   $subId = isset($_GET['subId']) ? $_GET['subId'] : null;
   $transId = isset($_GET['transId']) ? $_GET['transId'] : null;
   $reward = isset($_GET['reward']) ? $_GET['reward'] : null;
   $signature = isset($_GET['signature']) ? $_GET['signature'] : null;

   // Validate Signature
   if(md5($subId . $transId . $reward . $secret) != $signature)
   {
       echo "ERROR: Signature doesn't match";
       return;
   }

   // Further processing can be done here
   echo "Signature is valid. Process the postback.";
?>
from flask import Flask, request, jsonify
import hashlib

app = Flask(__name__)
secret = ""  # Get your secret key from Revlum

@app.route('/postback', methods=['GET'])
def postback():
    subId = request.args.get('subId')
    transId = request.args.get('transId')
    reward = request.args.get('reward')
    signature = request.args.get('signature')

    # Validate Signature
    if hashlib.md5((subId + transId + reward + secret).encode()).hexdigest() != signature:
        return "ERROR: Signature doesn't match", 400

    # Further processing can be done here
    return "Signature is valid. Process the postback."

if __name__ == '__main__':
    app.run()
const express = require('express');
const crypto = require('crypto');
const app = express();
const port = 3000;
const secret = ""; // Get your secret key from Revlum

app.get('/postback', (req, res) => {
    const { subId, transId, reward, signature } = req.query;

    // Validate Signature
    const hash = crypto.createHash('md5').update(subId + transId + reward + secret).digest('hex');
    if (hash !== signature) {
        res.status(400).send("ERROR: Signature doesn't match");
        return;
    }

    // Further processing can be done here
    res.send("Signature is valid. Process the postback.");
});

app.listen(port, () => {
    console.log(`Server is running on http://localhost:${port}`);
});
require 'sinatra'
require 'digest'

secret = "" # Get your secret key from Revlum

get '/postback' do
  subId = params['subId']
  transId = params['transId']
  reward = params['reward']
  signature = params['signature']

  # Validate Signature
  if Digest::MD5.hexdigest(subId + transId + reward + secret) != signature
    halt 400, "ERROR: Signature doesn't match"
  end

  # Further processing can be done here
  "Signature is valid. Process the postback."
end
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

@RestController
public class PostbackController {

    private final String secret = ""; // Get your secret key from Revlum

    @GetMapping("/postback")
    public String postback(@RequestParam String subId, @RequestParam String transId,
                           @RequestParam String reward, @RequestParam String signature) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            String data = subId + transId + reward + secret;
            md.update(data.getBytes());
            byte[] digest = md.digest();
            StringBuilder sb = new StringBuilder();
            for (byte b : digest) {
                sb.append(String.format("%02x", b));
            }
            if (!sb.toString().equals(signature)) {
                return "ERROR: Signature doesn't match";
            }
        } catch (NoSuchAlgorithmException e) {
            return "ERROR: Unable to process signature";
        }

        // Further processing can be done here
        return "Signature is valid. Process the postback.";
    }
}
using Microsoft.AspNetCore.Mvc;
using System.Security.Cryptography;
using System.Text;

[ApiController]
[Route("postback")]
public class PostbackController : ControllerBase
{
    private readonly string secret = ""; // Get your secret key from Revlum

    [HttpGet]
    public IActionResult Postback(string subId, string transId, string reward, string signature)
    {
        using (var md5 = MD5.Create())
        {
            var input = Encoding.UTF8.GetBytes(subId + transId + reward + secret);
            var hashBytes = md5.ComputeHash(input);
            var hash = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();

            if (hash != signature)
            {
                return BadRequest("ERROR: Signature doesn't match");
            }
        }

        // Further processing can be done here
        return Ok("Signature is valid. Process the postback.");
    }
}

Our servers wait for a response for a maximum time of 60 seconds before the timeout. In this case, postback will be marked as failed. Please, check if the transaction ID sent to you was already entered in your database, this will prevent giving twice the same amount of virtual currency to the user.

Whitelist our IP

We will be sending postbacks from any of the following IP addresses. Please make sure they are whitelisted if needed to be on your server.

👍

209.159.156.198

Our servers will expect your website to respond with "ok". If your postback doesn't return "ok" as a response, the postback will be marked as failed (even if the postback was successfully called) and you will be able to resend it manually from our website.