NAV Navbar
cURL PHP

Overview

Mahnee API is a fast and convenient way for our Mahnee Merchant to have their software, website, mobile application or system to integrate with Mahnee System. This will ease the flow of sending out the points to their users, registering up their user to Mahnee as well.

Documentation

Obtaining Auth from Mahnee system

This step will guide you on getting the ACCESS_TOKEN:

curl --header "Authorization: APP_ID" -X POST https://connect.mahnee.com/api/getAuth -d api_server=sandbox
<?php

  $input = array('api_server' => 'sandbox');
  $ch = curl_init(); 
  curl_setopt($ch,CURLOPT_URL,  "https://connect.mahnee.com/api/getAuth"); 
  curl_setopt($ch,CURLOPT_HTTPHEADER,
              array(
                'Authorization: '.$_SERVER["HTTP_AUTHORIZATION"] ,
                "content-type: application/x-www-form-urlencoded; charset=UTF-8"
              )); 
  curl_setopt($ch,CURLOPT_POST,1); 
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
  curl_setopt($ch,CURLOPT_POST, count($input));
  curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($input, '', '&'));
  $server_output = curl_exec($ch);
  curl_close ($ch);
  die(json_encode($server_output));

The above command returns JSON structured like this:

{
  "status": "success",
  "hash": "ACCESS_TOKEN",
}

HTTP Request

POST http://connect.mahnee.com/api/getAuth

Query Parameters

Parameter Default Description
api_server null sandbox, real (You're responsible for the action if you set the api_server to real)

Get lists of countries that we supported

curl --header "Authorization: ACCESS_TOKEN" -X POST https://connect.mahnee.com/api/getCountries -d api_server=sandbox
<?php
  $input = array(
    "api_server" => "sandbox"
  );
  $ch = curl_init(); 
  curl_setopt($ch,CURLOPT_URL, "https://connect.mahnee.com/api/getCountries"); 
  curl_setopt($ch,CURLOPT_HTTPHEADER,
              array(
                'Authorization: ACCESS_TOKEN' ,
                "content-type: application/x-www-form-urlencoded; charset=UTF-8"
              )); 
  curl_setopt($ch,CURLOPT_POST,1); 
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
  curl_setopt($ch,CURLOPT_POST, count($input));
  curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($input, '', '&'));
  $server_output = curl_exec($ch);
  curl_close ($ch);
  die(json_encode($server_output));

The above command returns JSON structured like this:

{
  "status" : "success",
  "data" : [
    {"name":"Malaysia","code":"MY","dialCode":"60","currency":"MYR"},
    {"name":"Singapore","code":"SG","dialCode":"65","currency":"SGD"},
    {"name":"New Zealand","code":"NZ","dialCode":"64","currency":"NZD"},
    {"name":"Australia","code":"AU","dialCode":"61","currency":"AUD"},
    {"name":"United States","code":"US","dialCode":"1","currency":"USD"},
    ....
  ]
}

HTTP Request

POST http://connect.mahnee.com/api/getCountries

Query Parameters

Parameter Default Description
api_server null sandbox, real (You're responsible for the action if you set the api_server to real)

Sending Point to client

curl --header "Authorization: ACCESS_TOKEN" -X POST https://connect.mahnee.com/api/sendPoint -d api_server=sandbox
<?php
  $input = array(
    'receiver_email' => '[email protected]', 
    'type' => 'big', 
    'point_original' => '100', 
    'api_server' => 'sandbox'
  );
  $ch = curl_init(); 
  curl_setopt($ch,CURLOPT_URL, "https://connect.mahnee.com/api/sendPoint"); 
  curl_setopt($ch,CURLOPT_HTTPHEADER,
              array(
                'Authorization: ACCESS_TOKEN' ,
                "content-type: application/x-www-form-urlencoded; charset=UTF-8"
              )); 
  curl_setopt($ch,CURLOPT_POST,1); 
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
  curl_setopt($ch,CURLOPT_POST, count($ret));
  curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($ret, '', '&'));
  $server_output = curl_exec($ch);
  curl_close ($ch);
  die(json_encode($server_output));

The above command returns JSON structured like this:

{
  "status" : "success"
}

HTTP Request

POST http://connect.mahnee.com/api/sendPoint

Query Parameters

Parameter Default Description
api_server null sandbox, real (You're responsible for the action if you set the api_server to real)
receiver_email null email of the receiver
type null big, small, micro, nano
point_original 0 amount of you want to send, currency based on the country that you registered for the merchant

Check existing user based on referral code

curl --header "Authorization: ACCESS_TOKEN" -X POST https://connect.mahnee.com/api/checkUserExists -d api_server=sandbox -d referral_code=XXXXX
<?php
  $input = array(
    "referral_code" => "XXXXX"
  );
  $ch = curl_init(); 
  curl_setopt($ch,CURLOPT_URL, "https://connect.mahnee.com/api/checkUserExists"); 
  curl_setopt($ch,CURLOPT_HTTPHEADER,
              array(
                'Authorization: ACCESS_TOKEN',
                "content-type: application/x-www-form-urlencoded; charset=UTF-8"
              )); 
  curl_setopt($ch,CURLOPT_POST,1); 
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
  curl_setopt($ch,CURLOPT_POST, count($input));
  curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($input, '', '&'));
  $server_output = curl_exec($ch);
  curl_close ($ch);
  die(json_encode($server_output));

The above command returns JSON structured like this:

{
  "status" : "success"
}

HTTP Request

POST http://connect.mahnee.com/api/checkUserExists

Query Parameters

Parameter Default Description
api_server null sandbox, real (You're responsible for the action if you set the api_server to real)
referral_code null referral code of the users https://join.mahnee.com/users/referral_code

Check Balance

curl --header "Authorization: p27mIuQr81RtbDTX-Z4FGVyL60vfqE3k" -X POST https://connect.mahnee.com/api/checkBalance -d api_server=sandbox
<?php
  $input = array(
    "api_server" => "sandbox"
  );
  $ch = curl_init(); 
  curl_setopt($ch,CURLOPT_URL, "https://connect.mahnee.com/api/checkBalance"); 
  curl_setopt($ch,CURLOPT_HTTPHEADER,
              array(
                'Authorization: ACCESS_TOKEN' ,
                "content-type: application/x-www-form-urlencoded; charset=UTF-8"
              )); 
  curl_setopt($ch,CURLOPT_POST,1); 
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
  curl_setopt($ch,CURLOPT_POST, count($input));
  curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($input, '', '&'));
  $server_output = curl_exec($ch);
  curl_close ($ch);
  die(json_encode($server_output));

The above command returns JSON structured like this:

{
    "status":"success",
    "point": {
      "big":"30.0000000000",
      "small":"23.34932139",
      "micro":"14.1238129",
      "nano":"18.85473848"
    }
}

HTTP Request

POST http://connect.mahnee.com/api/checkBalance

Query Parameters

Parameter Default Description
api_server null sandbox, real (You're responsible for the action if you set the api_server to real)

Use Cases

E-Commerce

First Scenario

During the checkout page, the system should allow user to fill in their email on Mahnee System. Once they filled in the email, you should use Mahnee API to check is the email in Mahnee system. If the email is not exists, you can redirect them to your referral link to sign them up. After confirmed user has an Mahnee account, you can send them point using Mahnee API. When to send point to the user is up to your standard procedure. The point should giving once order confirmed.

How to list your website to Mahnee System

In order for you to list your website to our Mahnee System, you're required to have multi parameters affiliate system. For example, https://www.your_website_domain.com?args1=Mahnee&args2=ABCDE With this you can understand that this traffic is come from Mahnee with args2 ABCDE. When checkout, instead of checking the user have Mahnee account or not. You can prefill this into their transaction. So once transaction confirmed, you can send the point to them.

Possible Errors

Below are the errors that might arise when running this API:

(NOTE: You, Mahnee Merchant, are responsible in handling the errors accordingly).

Error Description
invalid_auth invalid key when used to request for the access token.
expired_auth access token received has expired (need to request new access token).
invalid_api_server api_server is required (sandbox, real)
invalid_bonus_type bonus type is required (big, small, micro, nano)
invalid_receiver_code receiver code that you pass to the server is not in our database
invalid_receiver_email receiver email that you pass to the server is not in our database
insufficient_balance you, the merchant, has insufficient balance for points to transfer to the user
mismatch_receiver_detail if you pass receiver email and receiver code together, the email and the code is mismatch, not from the same user