NAV
shell go python javascript php

Introduction

Monex stands as a beacon of advancement in transaction processing and blockchain integration, boasting a robust infrastructure designed to empower merchants with unparalleled efficiency. This upgraded iteration introduces a plethora of new endpoints, including the addition of comprehensive features such as the getTransactionDetail endpoint, enabling merchants to retrieve detailed transaction information, including minting hash. Furthermore, the introduction of the Webhook Subscription endpoint revolutionizes communication, allowing merchants to seamlessly subscribe to webhook callbacks. Previously exclusive to 3D merchants, this feature now extends to 2D merchants, ensuring they receive notifications for every status change, such as transaction refunds.

One of the standout features of Monex is the introduction of three distinct blockchains—Ethereum, Polygon, and Stellar—for minting successful transactions. This pivotal enhancement grants merchants the flexibility to choose the blockchain that best aligns with their business requirements, further optimizing their operational efficiency. Powered by an in-house minting engine, transactions are seamlessly minted without delays, ensuring a streamlined process from transaction initiation to minting. The minting engine boasts remarkable speed, capable of handling both single and batch minting tasks, with an impressive capacity of minting up to 200 transactions per minute as NFTs.

Another cornerstone enhancements of Monex lies in its reporting capabilities, with the inclusion of reporting endpoints enabling merchants to access transaction listings with pagination. This empowers merchants with greater insights into their transactional activities, fostering informed decision-making and operational efficiency.

System Information

Contract Address: 0x079857b66cd38cf5d0fba9057ebe884c082bb428

Check Minting Status

Visit Token (NFT) Tracker

API Environments

Monex support team provides a sandbox environment for developers to test their integration before going live. Here are the base URL for the different environments that you must set up according to your deployment strategy.

HTTP Request

Sandbox https://api-uat.monex-nft.com

Production Environment https://api.monex-nft.com

Quote Request

The first step before making payments is to request a quote. The endpoint POST /v3/get-quote/getQuote will take an x-api-key in the header to authorize the request, and the user will send the order amount in the body of the request. After validating the API Key, the system will generate a JWT Token and return it in the response of this authorization call.

package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "os"

    "github.com/gin-gonic/gin"
)

func main() {
    r := gin.Default()

    apiKey := os.Getenv("API_KEY")

    r.GET("/get-quote", func(c *gin.Context) {
        orderAmount := c.Query("orderAmount")

        url := "{END_POINT}/v3/get-quote/getQuote"

        // Prepare the request body
        requestBody, err := json.Marshal(map[string]string{
            "orderAmount": orderAmount,
        })
        if err != nil {
            c.JSON(http.StatusInternalServerError, gin.H{"error": "Internal server error"})
            return
        }

        // Make the POST request
        req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
        if err != nil {
            c.JSON(http.StatusInternalServerError, gin.H{"error": "Internal server error"})
            return
        }
        req.Header.Set("x-api-key", apiKey)
        req.Header.Set("Content-Type", "application/json")

        client := &http.Client{}
        resp, err := client.Do(req)
        if err != nil {
            c.JSON(http.StatusInternalServerError, gin.H{"error": "Internal server error"})
            return
        }
        defer resp.Body.Close()

        // Read the response body
        var responseBody map[string]interface{}
        if err := json.NewDecoder(resp.Body).Decode(&responseBody); err != nil {
            c.JSON(http.StatusInternalServerError, gin.H{"error": "Internal server error"})
            return
        }

        c.JSON(resp.StatusCode, responseBody)
    })

    // Run the server
    port := ":8080"
    fmt.Printf("Server running on port %s\n", port)
    if err := r.Run(port); err != nil {
        fmt.Println("Error starting server:", err)
    }
}
from flask import Flask, jsonify, request
import requests

app = Flask(_name_)

API_KEY = 'YOUR_API_KEY_HERE'

@app.route('/get-quote', methods=['GET'])
def get_quote():
    try:
        order_amount = request.args.get('orderAmount')  # Assuming orderAmount is passed as a query parameter

        # Make the API call using requests
        response = requests.post('{END_POINT}/v3/get-quote/getQuote', json={'orderAmount': order_amount}, headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'})

        # Return the response from the API to the client
        return jsonify(response.json())
    except Exception as e:
        # Handle errors
        print('Error:', str(e))
        return jsonify({'error': 'Internal server error'}), 500

if _name_ == '_main_':
    app.run(debug=True)
curl --location '{END_POINT}/v3/get-quote/getQuote' \
--header 'x-api-key: YOUR_API_KEY_HERE' \
--header 'Content-Type: application/json' \
--data '{
    "orderAmount": 11
}'
const express = require('express');
const axios = require('axios');

const app = express();
const PORT = 3000;

const API_KEY = 'YOUR_API_KEY_HERE';

// Endpoint to handle the request
app.get('/get-quote', async (req, res) => {
  try {
    const orderAmount = req.query.orderAmount; // Assuming orderAmount is passed as a query parameter

    // Make the API call using Axios
    const response = await axios.post('{END_POINT}/v3/get-quote/getQuote', {
      orderAmount
    }, {
      headers: {
        'x-api-key': API_KEY,
        'Content-Type': 'application/json'
      }
    });

    // Return the response from the API to the client
    res.json(response.data);
  } catch (error) {
    // Handle errors
    console.error('Error:', error.message);
    res.status(500).json({ error: 'Internal server error' });
  }
});

// Start the server
app.listen(PORT, () => {
  console.log(Server is running on `http://localhost:${PORT}`);
});
<?php

$apiKey = 'YOUR_API_KEY_HERE';
$orderAmount = 11;

$url = '{END_POINT}/v3/get-quote/getQuote';

$data = array(
    'orderAmount' => $orderAmount
);

$data_string = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'x-api-key: ' . $apiKey,
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string))
);

$result = curl_exec($ch);

if ($result === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    echo $result;
}

curl_close($ch);

?>

Request

{
  "orderAmount": 11
}

Response:

{
  "success": true,
  "subTotal": 9,
  "fee": 1.44,
  "orderTotal": 10.44,
  "token": "XXXXX-JWT_TOKEN_STRING-XXXXX",
  "tokenExpire": "600",
  "timestamp": 1705322334267
}

HTTP Request

POST /v3/get-quote/getQuote

Parameter Type Description
x-api-key String Get your api key from support.
content-type String application/json.

Post Body

Parameter Type Description
orderAmount Numeric Order amount must be a numeric two decimal value.

Payments

curl --location '{END_POINT}/v3/submit-transaction/deposit-transaction' \
--header 'Content-Type: application/json' \
--data-raw '{
    "paymentInformation": {
        "cardNumber": "4918190000000002",
        "cardHolderName": "Abelardo Heller",
        "CVV": "123",
        "monthExpire": "10",
        "yearExpire": "2029",
        "billingAddress": "3993 Werninger Street",
        "billingAddress2": "Appartment 1A",
        "city": "Houston",
        "state": "Texas",
        "country": "US",
        "zip": "77002"
    },

    "ipAddress": "103.167.235.255",
    "email": "abelardo.heller@gmail.com",
    "redirecturl": "https://www.redirecturl.com/",
    "token": "<<JWT_TOKEN_HERE>>",
    "promptText": "This is Prompt Text"
}'
const express = require("express");
const axios = require("axios");
const app = express();

// Define the route
app.get("/submit-transaction", async (req, res) => {
  try {
    const url = "{END_POINT}/v3/submit-transaction/deposit-transaction";
    const data = {
      paymentInformation: {
        cardNumber: "4918190000000002",
        cardHolderName: "Abelardo Heller",
        CVV: "123",
        monthExpire: "10",
        yearExpire: "2029",
        billingAddress: "3993 Werninger Street",
        billingAddress2: "Appartment 1A",
        city: "Houston",
        state: "Texas",
        country: "US",
        zip: "77002",
      },
      ipAddress: "103.167.235.255",
      email: "abelardo.heller@gmail.com",
      redirecturl: "https://www.redirecturl.com/",
      token: "<<JWT_TOKEN_HERE>>",
      promptText: "This is Prompt Text",
    };

    const response = await axios.post(url, data, {
      headers: {
        "Content-Type": "application/json",
      },
    });

    res.json(response.data);
  } catch (error) {
    console.error(
      "Error:",
      error.response ? error.response.data : error.message,
    );
    res.status(500).json({ error: "Internal Server Error" });
  }
});

// Start the server
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "{END_POINT}/v3/submit-transaction/deposit-transaction"
    payload := []byte(`{
    "paymentInformation": {
        "cardNumber": "4918190000000002",
        "cardHolderName": "Abelardo Heller",
        "CVV": "123",
        "monthExpire": "10",
        "yearExpire": "2029",
        "billingAddress": "3993 Werninger Street",
        "billingAddress2": "Appartment 1A",
        "city": "Houston",
        "state": "Texas",
        "country": "US",
        "zip": "77002"
    },

    "ipAddress": "103.167.235.255",
    "email": "abelardo.heller@gmail.com",
    "redirecturl": "https://www.redirecturl.com/",
    "token": "<<JWT_TOKEN_HERE>>",
    "promptText": "This is Prompt Text"
}`)

    req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
    if err != nil {
        fmt.Println("Error creating request:", err)
        return
    }
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error sending request:", err)
        return
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println("Error reading response body:", err)
        return
    }

    fmt.Println(string(body))
}

import requests

url = '{END_POINT}/v3/submit-transaction/deposit-transaction'
payload = {
    "paymentInformation": {
        "cardNumber": "4918190000000002",
        "cardHolderName": "Abelardo Heller",
        "CVV": "123",
        "monthExpire": "10",
        "yearExpire": "2029",
        "billingAddress": "3993 Werninger Street",
        "billingAddress2": "Appartment 1A",
        "city": "Houston",
        "state": "Texas",
        "country": "US",
        "zip": "77002"
    },
    "ipAddress": "103.167.235.255",
    "email": "abelardo.heller@gmail.com",
    "redirecturl": "https://www.redirecturl.com/",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjaGFudF9pZCI6IiIsIm9yZGVyX2Ftb3VudCI6MTEsIm9yZGVyX3RvdGFsIjoxMSwicGxhdGZvcm1fZmVlIjowLCJ0eF9mZWUiOjAsInRva2VuX2V4cGlyZSI6IjYwMCIsIndhbGxldF9pZCI6IjZjZTNiOGE1LTczOTgtNDQxZS1iODk3LThhNTE1ZDNlNjBhMyIsInV1aWQiOiI1YzA3OTEyNy02ODMxLTQ1NWEtODZhZC1hN2QzMGVhNGIyMjEiLCJpYXQiOjE3MTAwODc1OTgsImV4cCI6MTcxMDA4ODE5OH0.PKP5VJ2QDWeHxuxClhXMwLF-kBbt3B3H5DyanJLLBZk",
    "promptText": "This is Prompt Text"
}

headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)
<?php

$url = '{END_POINT}/v3/submit-transaction/deposit-transaction';
$data = array(
    "paymentInformation" => array(
        "cardNumber" => "4918190000000002",
        "cardHolderName" => "Abelardo Heller",
        "CVV" => "123",
        "monthExpire" => "10",
        "yearExpire" => "2029",
        "billingAddress" => "3993 Werninger Street",
        "billingAddress2" => "Appartment 1A",
        "city" => "Houston",
        "state" => "Texas",
        "country" => "US",
        "zip" => "77002"
    ),
    "ipAddress" => "103.167.235.255",
    "email" => "abelardo.heller@gmail.com",
    "redirecturl" => "https://www.redirecturl.com/",
    "token" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjaGFudF9pZCI6IiIsIm9yZGVyX2Ftb3VudCI6MTEsIm9yZGVyX3RvdGFsIjoxMSwicGxhdGZvcm1fZmVlIjowLCJ0eF9mZWUiOjAsInRva2VuX2V4cGlyZSI6IjYwMCIsIndhbGxldF9pZCI6IjZjZTNiOGE1LTczOTgtNDQxZS1iODk3LThhNTE1ZDNlNjBhMyIsInV1aWQiOiI1YzA3OTEyNy02ODMxLTQ1NWEtODZhZC1hN2QzMGVhNGIyMjEiLCJpYXQiOjE3MTAwODc1OTgsImV4cCI6MTcxMDA4ODE5OH0.PKP5VJ2QDWeHxuxClhXMwLF-kBbt3B3H5DyanJLLBZk",
    "promptText" => "This is Prompt Text"
);

$options = array(
    'http' => array(
        'header'  => "Content-Type: application/json\r\n",
        'method'  => 'POST',
        'content' => json_encode($data)
    )
);

$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);

echo $response;

?>

Request for 2D payment

{
  "paymentInformation": {
    "cardNumber": "4938730000000001",
    "cardHolderName": "Abelardo Heller",
    "CVV": "123",
    "monthExpire": "10",
    "yearExpire": "2029",
    "billingAddress": "3993 Werninger Street",
    "billingAddress2": "Appartment 1A",
    "city": "Houston",
    "state": "Texas",
    "country": "US",
    "zip": "77002"
  },
  "ipAddress": "103.167.235.255",
  "email": "abelardo.heller@gmail.com",
  "token": "XXXXX-JWT_TOKEN_STRING-XXXXX",
  "promptText": "This is Prompt Text"
}

Request for 3D payment

{
  "paymentInformation": {
    "cardNumber": "4938730000000001",
    "cardHolderName": "Abelardo Heller",
    "CVV": "123",
    "monthExpire": "10",
    "yearExpire": "2029",
    "billingAddress": "3993 Werninger Street",
    "billingAddress2": "Appartment 1A",
    "city": "Houston",
    "state": "Texas",
    "country": "US",
    "zip": "77002"
  },
  "ipAddress": "103.167.235.255",
  "email": "abelardo.heller@gmail.com",
  "redirecturl": "https://<<URL_HERE>>/",
  "token": "XXXXX-JWT_TOKEN_STRING-XXXXX",
  "promptText": "This is Prompt Text"
}

Success Response 2D

{
    "success": true,
    "data": {
        "paymentStatus": "PENDING",
        "nftStatus": "PENDING",
        "txID": 24152,
        "paymentUrl": "https://<<URL_HERE>>" // Optional
        "orderTotal": 9.56,
        "mintHash": "",
        "mintDate": "",
        "quote_id": "d7f7c77e-acd8-43e7-8621-2f1496d8519e",
        "timestamp": 1705585639882,
    }
}

Success Response 3D

{
  "success": true,
  "data": {
    "paymentStatus": "APPROVED",
    "nftStatus": "APPROVED",
    "txID": 24152,
    "orderTotal": 9.56,
    "mintHash": "",
    "mintDate": "",
    "quote_id": "d7f7c77e-acd8-43e7-8621-2f1496d8519e",
    "timestamp": 1705585639882
  }
}

POST /v3/submit-transaction/deposit-transaction

deposit-transaction can only be called once a quote has been generated and is active, meaning that the quote was generated within 10 minutes of the request to authorize a payment.

When a payment is authorized for a given quote, the user's billing information is processed for the orderTotal amount generated in getQuote.

Below is the list of parameters use to send as JSON Body in the post request while calling deposit-transaction

Parameters

Parameter Required/Optional Description
cardNumber Required Payment card number.
cardHolderName Required Name of the cardholder.
CVV Required Card verification value.
monthExpire Required Expiration month of the card.
yearExpire Required Expiration year of the card.
billingAddress Required Billing address for the payment.
billingAddress2 Required Additional billing address details.
city Required Billing city.
state Required Billing state or region.
country Required Billing country.
zip Required Billing ZIP or postal code.
ipAddress Required User's IP address for the transaction.
email Required User's email address.
redirecturl Required for 3DS URL to redirect after payment completion.
token Required JWT Authorization Token for payment authorization.
promptText Required Prompt text for user interaction (optional).

Payment Details

curl --location '{END_POINT}/v3/submit-transaction/getDetails' \
--header 'x-api-key: YOUR_API_KEY_HERE' \
--header 'Content-Type: application/json' \
--data '{
    "txID": "998469", // Optional if 'quote_id' provided
    "quote_id": "1ab1e866-45e5-429a-9p12-4b6a8b9c2daf" // Optional if 'txID' provided
}'
const express = require("express");
const axios = require("axios");

const app = express();
const PORT = 3000;

app.use(express.json());

app.post("/getDetails", async (req, res) => {
  const { txID, quote_id } = req.body;
  const API_KEY = "YOUR_API_KEY_HERE";

  try {
    const response = await axios.post(
      "{END_POINT}/v3/submit-transaction/getDetails",
      {
        txID, // Optional if 'quote_id' provided
        quote_id, // Optional if 'txID' provided
      },
      {
        headers: {
          "x-api-key": API_KEY,
          "Content-Type": "application/json",
        },
      },
    );

    res.json(response.data);
  } catch (error) {
    res
      .status(500)
      .json({ error: "An error occurred while fetching data from the API." });
  }
});

app.listen(PORT, () => {
  console.log(`Server is running on http://localhost:${PORT}`);
});
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    http.HandleFunc("/getDetails", getDetailsHandler)
    http.ListenAndServe(":8080", nil)
}

func getDetailsHandler(w http.ResponseWriter, r *http.Request) {
    apiURL := "{END_POINT}/v3/submit-transaction/getDetails"
    apiKey := "YOUR_API_KEY_HERE"

    reqBody, err := json.Marshal(map[string]string{
        "txID":     "998469", // Optional if 'quote_id' provided
        "quote_id": "1ab1e866-45e5-429a-9p12-4b6a8b9c2daf", // Optional if 'txID' provided
    })
    if err != nil {
        http.Error(w, "Failed to marshal request body", http.StatusInternalServerError)
        return
    }

    req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(reqBody))
    if err != nil {
        http.Error(w, "Failed to create HTTP request", http.StatusInternalServerError)
        return
    }
    req.Header.Set("x-api-key", apiKey)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        http.Error(w, "Failed to make request to API", http.StatusInternalServerError)
        return
    }
    defer resp.Body.Close()

    respBody, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        http.Error(w, "Failed to read response body", http.StatusInternalServerError)
        return
    }

    w.Header().Set("Content-Type", "application/json")
    w.WriteHeader(resp.StatusCode)
    w.Write(respBody)
}


import requests

def main():
    url = '{END_POINT}/v3/submit-transaction/getDetails'
    api_key = 'YOUR_API_KEY_HERE'

    payload = {
        "txID": "998469",  # Optional if 'quote_id' provided
        "quote_id": "1ab1e866-45e5-429a-9p12-4b6a8b9c2daf"  # Optional if 'txID' provided
    }
    headers = {
        'x-api-key': api_key,
        'Content-Type': 'application/json'
    }

    response = requests.post(url, json=payload, headers=headers)

    print("Status Code:", response.status_code)
    print("Response:", response.text)

if __name__ == "__main__":
    main()

<?php

// API endpoint URL
$url = '{END_POINT}/v3/submit-transaction/getDetails';

// Your API key
$api_key = 'YOUR_API_KEY_HERE';

// Data to be sent in the request
$data = array(
    'txID' => '998469', // Optional if 'quote_id' provided
    'quote_id' => '1ab1e866-45e5-429a-9p12-4b6a8b9c2daf' // Optional if 'txID' provided
);

// Headers to be sent in the request
$headers = array(
    'x-api-key: ' . $api_key,
    'Content-Type: application/json'
);

// Initialize cURL session
$curl = curl_init();

// Set cURL options
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session
$response = curl_exec($curl);

// Check for errors
if ($response === false) {
    echo 'Error: ' . curl_error($curl);
} else {
    // Print response
    echo 'Response: ' . $response;
}

// Close cURL session
curl_close($curl);

?>

Response

{
  "success": true,
  "data": {
    "createdAt": "1707218551239",
    "txID": "998469",
    "orderAmount": 53.76,
    "totalAmount": 53.76,
    "paymentStatus": "FAILED",
    "quote_id": "d059a586-836b-46d2-b303-f16ff51dd3ae",
    "mintStatus": "PENDING",
    "mintHash": null,
    "tokenId": null,
    "reason": "Did not attempt to make the payment.",
    "reasonCode": null
  }
}

Header

Parameter Required/Optional Type Description
x-api-key Required string Get your api key from support.

Query Parameters

Parameter Required/Optional Type Description
txID Optional string Optional if 'quote_id' provided
quote_id Optional string/UUID Optional if 'txID' provided

Reports

curl --location '{END_POINT}/v3/transactions/search?page=1&pageSize=10' \
--header 'x-api-key: YOUR_API_KEY_HERE' \
--data ''
const express = require("express");
const axios = require("axios");

const app = express();
const PORT = process.env.PORT || 3000;

// Define your API endpoint without pagination
const API_URL = "{END_POINT}/v3/transactions/search";
// Replace 'YOUR_API_KEY_HERE' with your actual API key
const API_KEY = "YOUR_API_KEY_HERE";

// Define a route to handle the request with pagination
app.get("/search-transactions", (req, res) => {
  const page = req.query.page || 1;
  const pageSize = req.query.pageSize || 10;

  // Make the request to the API using Axios with pagination parameters
  axios
    .get(API_URL, {
      params: {
        page,
        pageSize,
      },
      headers: {
        "x-api-key": API_KEY,
      },
    })
    .then((response) => {
      // Send the API response back to the client
      res.json(response.data);
    })
    .catch((error) => {
      // Handle any errors that occur during the request
      console.error("Error fetching transactions:", error);
      res
        .status(500)
        .json({ error: "An error occurred while fetching transactions" });
    });
});

// Start the server
app.listen(PORT, () => {
  console.log(`Server is running on http://localhost:${PORT}`);
});
package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

const (
    apiURL = "{END_POINT}/v3/transactions/search"
    apiKey = "YOUR_API_KEY_HERE"
)

func searchTransactions(w http.ResponseWriter, r *http.Request) {
    // Parse query parameters for pagination
    page := r.URL.Query().Get("page")
    pageSize := r.URL.Query().Get("pageSize")

    // Make the request to the API
    resp, err := http.Get(apiURL + "?page=" + page + "&pageSize=" + pageSize)
    if err != nil {
        http.Error(w, "Failed to fetch transactions", http.StatusInternalServerError)
        return
    }
    defer resp.Body.Close()

    // Read response body
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        http.Error(w, "Failed to read response body", http.StatusInternalServerError)
        return
    }

    // Write response back to client
    w.Header().Set("Content-Type", "application/json")
    w.Write(body)
}

func main() {
    http.HandleFunc("/search-transactions", searchTransactions)

    fmt.Println("Server is running on http://localhost:8080")
    http.ListenAndServe(":8080", nil)
}
import requests

API_URL = "{END_POINT}/v3/transactions/search"
API_KEY = "YOUR_API_KEY_HERE"

def search_transactions(page=1, page_size=10):
    headers = {
        "x-api-key": API_KEY,
        "Content-Type": "application/json"
    }

    params = {
        "page": page,
        "pageSize": page_size
    }

    response = requests.get(API_URL, headers=headers, params=params)
    if response.status_code == 200:
        return response.json()
    else:
        return None

# Example usage:
transactions = search_transactions(page=1, page_size=10)
print(transactions)
<?php

$API_URL = '{END_POINT}/v3/transactions/search';
$API_KEY = 'YOUR_API_KEY_HERE';

function searchTransactions($page = 1, $pageSize = 10) {
    global $API_URL, $API_KEY;

    $url = $API_URL . '?page=' . $page . '&pageSize=' . $pageSize;
    $headers = [
        'x-api-key: ' . $API_KEY,
        'Content-Type: application/json'
    ];

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    $response = curl_exec($ch);
    $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    curl_close($ch);

    if ($statusCode == 200) {
        return json_decode($response, true);
    } else {
        return null;
    }
}

// Example usage:
$transactions = searchTransactions(1, 10);
print_r($transactions);

?>

Response

{
  "message": "Data Retrieved",
  "data": {
    "count": 4997,
    "data": [
      {
        "name": "3d-prl-003",
        "createdAt": "1707312905499",
        "txID": null,
        "orderAmount": 26.93,
        "totalAmount": 26.93,
        "paymentStatus": "FAILED",
        "quote_id": "10906a65-1203-5630-0940-0a8fba033690",
        "mintStatus": "PENDING",
        "mintHash": null,
        "tokenId": null,
        "reason": "Merchant site is inactive! Please contact support.",
        "reasonCode": null
      }
    ]
  }
}

GET /v3/transactions/search Search for transactions.

This endpoint allows you to search for transactions with pagination support. You can specify the page number and page size to retrieve a subset of transactions. The response contains information about the transactions, such as their name, creation date, order amount, total amount, payment status, mint status, and more.

Header

Parameter Required/Optional Type Description
x-api-key Required string Get your api key from support.

Query Parameters

Parameter Required/Optional Type Description
page Optional integer Default 1
pageSize Optional integer Default 10, cannot be greater than 50

Subscription

Webhook Subscription

curl --location --request PATCH '{END_POINT}/v3/subscription/request' \
--header 'x-api-key: YOUR_API_KEY_HERE' \
--data ''
const express = require("express");
const axios = require("axios");

const app = express();
const PORT = 3000;

// Define your endpoint and API key
const END_POINT = "{END_POINT}/v3/subscription/request";
const API_KEY = "YOUR_API_KEY_HERE";

// Define a route handler for the PATCH request
app.patch("/subscription/request", async (req, res) => {
  try {
    // Make the PATCH request using axios
    const response = await axios.patch(
      END_POINT,
      {},
      {
        headers: {
          "x-api-key": API_KEY,
        },
      },
    );

    // Send the response from the external API to the client
    res.status(response.status).json(response.data);
  } catch (error) {
    // Handle any errors that occur during the request
    console.error("Error:", error.message);
    res.status(500).json({ error: "Internal server error" });
  }
});

// Start the server
app.listen(PORT, () => {
  console.log(`Server is running on http://localhost:${PORT}`);
});
package main

import (
    "bytes"
    "net/http"
)

func main() {
    // Define the endpoint and API key
    endpoint := "{END_POINT}/v3/subscription/request"
    apiKey := "YOUR_API_KEY_HERE"

    // Prepare the request body, if any
    requestBody := []byte(`{}`) // Add your request body here if needed

    // Create a new HTTP client
    client := &http.Client{}

    // Create a new PATCH request
    req, err := http.NewRequest("PATCH", endpoint, bytes.NewBuffer(requestBody))
    if err != nil {
        panic(err)
    }

    // Add the API key to the request headers
    req.Header.Set("x-api-key", apiKey)

    // Send the request
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    // Print the response status code
    fmt.Println("Response Status:", resp.Status)
}
import requests

def main():
    # Define the endpoint and API key
    END_POINT = '{END_POINT}/v3/subscription/request'
    API_KEY = 'YOUR_API_KEY_HERE'

    # Define the request headers
    headers = {
        'x-api-key': API_KEY
    }

    # Define the request body, if needed
    data = {}

    # Make the PATCH request
    try:
        response = requests.patch(END_POINT, headers=headers, json=data)

        # Check if the request was successful (status code 2xx)
        if response.status_code // 100 == 2:
            print('Request successful!')
            print('Response:', response.json())
        else:
            print('Request failed with status code:', response.status_code)
            print('Response:', response.text)
    except Exception as e:
        print('An error occurred:', e)

if __name__ == "__main__":
    main()
<?php
// Define the endpoint and API key
$END_POINT = '{END_POINT}/v3/subscription/request';
$API_KEY = 'YOUR_API_KEY_HERE';

// Define the request headers
$headers = array(
    'x-api-key: ' . $API_KEY
);

// Define the request body, if needed
$data = json_encode(array());

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $END_POINT);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL request
$response = curl_exec($ch);

// Check for errors
if($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Get response status code
    $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    // Check if the request was successful (status code 2xx)
    if ($status_code >= 200 && $status_code < 300) {
        echo 'Request successful!' . PHP_EOL;
        echo 'Response: ' . $response;
    } else {
        echo 'Request failed with status code: ' . $status_code . PHP_EOL;
        echo 'Response: ' . $response;
    }
}

// Close cURL session
curl_close($ch);
?>

Response

{
  "message": "OTP sent on all emails associated with API key"
}

PATCH /v3/subscription/request

This API endpoint is used to trigger the sending of a One-Time Password (OTP) to all email addresses associated with the provided API key for the purpose of subscription management.

Header

Parameter Required/Optional Type Description
x-api-key Required string Get your api key from support.

Webhook OTP Verify

curl --location '{END_POINT}/v3/subscription/verify-otp' \
--header 'x-api-key: YOUR_API_KEY_HERE' \
--header 'Content-Type: application/json' \
--data '{
    "otp": "541095",
    "webhook_url": "https://<<URL_HERE>>"
}'
const express = require("express");
const axios = require("axios");

const app = express();
const PORT = 3000;

// Define the endpoint and API key
const END_POINT = "{END_POINT}/v3/subscription/verify-otp";
const API_KEY = "YOUR_API_KEY_HERE";

// Define a route handler for the POST request
app.post("/subscription/verify-otp", async (req, res) => {
  try {
    // Extract the otp and webhook_url from the request body
    const { otp, webhook_url } = req.body;

    // Make the POST request using axios
    const response = await axios.post(
      END_POINT,
      {
        otp,
        webhook_url,
      },
      {
        headers: {
          "x-api-key": API_KEY,
          "Content-Type": "application/json",
        },
      },
    );

    // Send the response from the external API to the client
    res.status(response.status).json(response.data);
  } catch (error) {
    // Handle any errors that occur during the request
    console.error("Error:", error.message);
    res.status(500).json({ error: "Internal server error" });
  }
});

// Start the server
app.listen(PORT, () => {
  console.log(`Server is running on http://localhost:${PORT}`);
});
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

// Define the endpoint and API key
const (
    END_POINT = "{END_POINT}/v3/subscription/verify-otp"
    API_KEY   = "YOUR_API_KEY_HERE"
)

// RequestBody struct for request body
type RequestBody struct {
    OTP         string `json:"otp"`
    WebhookURL  string `json:"webhook_url"`
}

func main() {
    // Define the URL
    url := END_POINT

    // Define the request body
    requestBody := RequestBody{
        OTP:        "541095",
        WebhookURL: "https://<<URL_HERE>>",
    }

    // Marshal the request body into JSON
    requestBodyBytes, err := json.Marshal(requestBody)
    if err != nil {
        fmt.Println("Error marshalling request body:", err)
        return
    }

    // Create a new HTTP request
    req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(requestBodyBytes))
    if err != nil {
        fmt.Println("Error creating HTTP request:", err)
        return
    }

    // Set the request headers
    req.Header.Set("x-api-key", API_KEY)
    req.Header.Set("Content-Type", "application/json")

    // Send the HTTP request
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error sending HTTP request:", err)
        return
    }
    defer resp.Body.Close()

    // Read the response body
    var responseBodyBytes []byte
    _, err = resp.Body.Read(responseBodyBytes)
    if err != nil {
        fmt.Println("Error reading response body:", err)
        return
    }

    // Print the response status code
    fmt.Println("Response Status:", resp.Status)

    // Print the response body
    fmt.Println("Response Body:", string(responseBodyBytes))
}
import requests

# Define the endpoint and API key
END_POINT = "{END_POINT}/v3/subscription/verify-otp"
API_KEY = "YOUR_API_KEY_HERE"

# Define the request body
request_body = {
    "otp": "541095",
    "webhook_url": "https://<<URL_HERE>>"
}

# Define the request headers
headers = {
    "x-api-key": API_KEY,
    "Content-Type": "application/json"
}

def main():
    try:
        # Make the POST request
        response = requests.post(END_POINT, json=request_body, headers=headers)

        # Print the response status code
        print("Response Status:", response.status_code)

        # Print the response body
        print("Response Body:", response.json())

    except Exception as e:
        print("An error occurred:", e)

if __name__ == "__main__":
    main()
<?php
// Define the endpoint and API key
$END_POINT = '{END_POINT}/v3/subscription/verify-otp';
$API_KEY = 'YOUR_API_KEY_HERE';

// Define the request body
$request_body = json_encode(array(
    'otp' => '541095',
    'webhook_url' => 'https://<<URL_HERE>>'
));

// Define the request headers
$headers = array(
    'x-api-key: ' . $API_KEY,
    'Content-Type: application/json'
);

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $END_POINT);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $request_body);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL request
$response = curl_exec($ch);

// Check for errors
if($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Get response status code
    $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    // Print the response status code
    echo 'Response Status: ' . $status_code . PHP_EOL;

    // Print the response body
    echo 'Response Body: ' . $response;
}

// Close cURL session
curl_close($ch);
?>

Request

{
  "otp": "576439",
  "webhook_url": "https://<<URL_HERE>>"
}

Response

{
  "message": "Webhook URL updated successfully"
}

POST /v3/subscription/verify-otp

This API endpoint is used to update the webhook URL associated with subscription management. The webhook URL is the address where notifications related to subscription events, such as renewals or cancellations, are sent. By updating the webhook URL, users can ensure that subscription-related notifications are delivered to the desired destination.

Header

Parameter Required/Optional Type Description
x-api-key Required string Get your api key from support.

Parameters

Parameter Required/Optional Type Description
otp Required string
webhook_url Required string

Merchant Webhook Notification

curl --location 'MERCHANT_WEBHOOK_URL' \
--header 'Content-Type: application/json' \
--data '{
    "success": true,
    "data": {
        "paymentApproved": "APPROVED",
        "paymentStatus": "APPROVED",
        "txID": "703299",
        "orderTotal": "45",
        "nftStatus": "PENDING",
        "qouteId": "10906a65-1203-5630-0940-0a8fba033690",
        "reason": ""
    }
}'

Payload

{
  "success": true,
  "data": {
    "paymentApproved": "APPROVED",
    "paymentStatus": "APPROVED",
    "txID": "003299",
    "orderTotal": "45",
    "nftStatus": "PENDING",
    "qouteId": "10906a65-1203-5630-0940-0a8fba033690",
    "reason": ""
  }
}

POST <<MERCHANT_WEBHOOK_URL>>

The "Merchant Webhook Notification" endpoint facilitates real-time communication between Monex and the merchant's system by sending HTTP POST requests to the specified webhook URL. This endpoint is designed to notify the merchant about various events and updates related to payment processing and transaction status.

Request Body:

The request body is a JSON object containing information about the payment transaction. Here are the key-value pairs typically included in the request body:

Health Check

curl --location '{END_POINT}/health-check' \
--data ''
package main

import (
    "bytes"
    "fmt"
    "net/http"
)

func main() {
    // Define the base URL
    baseURL := "{END_POINT}"

    // Define the endpoint
    endpoint := "/health-check"

    // Prepare the URL
    url := baseURL + endpoint

    // Create a new HTTP request
    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        fmt.Println("Error creating request:", err)
        return
    }

    // Set the Content-Type header if necessary
    // req.Header.Set("Content-Type", "application/json")

    // Send the request
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error sending request:", err)
        return
    }
    defer resp.Body.Close()

    // Read the response body
    // responseBody, err := ioutil.ReadAll(resp.Body)
    // if err != nil {
    //  fmt.Println("Error reading response body:", err)
    //  return
    // }

    // Print the response status code and body
    fmt.Println("Response Status:", resp.Status)
    // fmt.Println("Response Body:", string(responseBody))
}
import requests

def main():
    # Define the base URL
    BASE_URL = "{END_POINT}"

    # Define the endpoint
    endpoint = "/health-check"

    # Prepare the URL
    url = BASE_URL + endpoint

    # Send the request
    response = requests.get(url)

    # Check if the request was successful
    if response.status_code == 200:
        # Print the response body
        print("Response Body:", response.json())
    else:
        print("Error:", response.status_code)

if __name__ == "__main__":
    main()
const express = require("express");
const bodyParser = require("body-parser");
const axios = require("axios");
const app = express();

// Middleware to parse JSON bodies
app.use(bodyParser.json());

// Health check endpoint
app.post("/health-check", async (req, res) => {
  try {
    // Make a POST request to the health-check API
    const response = await axios.get("{END_POINT}/health-check");

    // Return the response from the API
    res.json(response.data);
  } catch (error) {
    // If there's an error, return an error response
    console.error("Error calling health-check API:", error.message);
    res.status(500).json({ error: "Internal server error" });
  }
});

// Start the server
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});
<?php
// Function to make GET request
function callHealthCheckAPI() {
    // Define the base URL
    $baseUrl = "{END_POINT}";

    // Define the endpoint
    $endpoint = "/health-check";

    // Prepare the URL
    $url = $baseUrl . $endpoint;

    // Initialize cURL session
    $ch = curl_init();

    // Set the URL
    curl_setopt($ch, CURLOPT_URL, $url);

    // Set the request type to GET
    curl_setopt($ch, CURLOPT_HTTPGET, true);

    // Return the response instead of outputting it
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    // Execute the request
    $response = curl_exec($ch);

    // Close cURL session
    curl_close($ch);

    // Check if the request was successful
    if ($response === false) {
        // If there's an error, return null or handle it accordingly
        return null;
    } else {
        // Decode the JSON response
        return json_decode($response, true);
    }
}

// Call the health check API
$response = callHealthCheckAPI();

// Check if the response is valid
if ($response !== null) {
    // Print the response
    print_r($response);
} else {
    // Handle the error
    echo "Error: Failed to call health-check API";
}
?>

Response

{
  "timestamp": 1713189385229,
  "version": 3.0,
  "status": "active"
}

GET /health-check

The purpose of this API is to perform a health check on the server to ensure it is operational and functioning correctly.

Errors

Monex Errors - JSON Failure Response - (status code 422)

{
    "success": false,
    "message": "Missing paymentInformation object."
}
{
    "success": false,
    "message": "Card data is incomplete/invalid"
}

Monex Errors - JSON Failure Response - (status code 409)

{
    "success": false,
    "message": "Quote has expired, request a new quote and try again."
}

Monex Errors - JSON Failure Response - (status code 404)

{
    "success": false,
    "message": "Invalid Token, Quote not found."
}
{
    "success": false,
    "message": "Invalid Token. Wallet not found."
}

Monex Errors - JSON Failure Response - (status code 400)

{
    "success": false,
    "message": "Server Error. Try again or contact support for assistance"
}

Gateway Errors - JSON Failure Response - (status code 400)

{
    "message": "We regret to inform you that transactions from your card's BIN are not allowed at this time.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "We regret to inform you that transactions from your card's country locations are not allowed at this time.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "We regret to inform you that transactions from your card's country are not allowed at this time.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "Transaction amount limit is not in the allowed range! Please contact support.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "Maxmind configurations are missing. Contact support for assistance.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "High risk detected. Contact support for assistance.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "We regret to inform you that transactions from your IP address are not allowed at this time.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "Missing processors configuration! Please contact support.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "Order with same information(id) already placed.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "No 2D gateway configured for this merchant site. Please contact support.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "No default gateway is configured for this merchant site. Please contact support.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "We regret to inform you that transactions from your Gateway daily limit exceeded.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "No 3D gateway configured for this merchant site. Please contact support.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}
{
    "message": "We regret to inform you that transactions from your Gateway daily limit exceeded.",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}

Gateway Errors - JSON Failure Response - (status code 401)

{
    "message": "Invalid securehash!",
    "status": "FAILED",
    "amount": null,
    "hash": null,
    "payment_url": null
}

System Errors - JSON Failure Response - (status code 500)

{
    "message": "Something went wrong"
}
Error Code Meaning
400 Bad Request -- When there is no account exist.
401 Unauthorized -- When gateway failed to authorized a request.
404 Unauthorized -- When token or Quote not found.
409 Quote expiry time is 10 minutes, This will be the result of sending expired quote
422 Payment Details are missing.
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.