Embed Code
- Java
- .Net
- PHP
- Python
- Node.js
Step 1 : Import
Import library for making HTTP requests.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
Step 2 : Source Code
Construct HTTP request body and send this data as a POST request.
.....
String jsonMessage = "{'MsgVer' : '" + msgVer +
    "', 'PmtType' : '" + pmtType +
    "', 'IsPreauthInd' : '" + isPreauthInd +
    "', 'CallerDeviceType' : '" + callerDevice +
    "', 'CallerDeviceVer' : '" + callerDeviceVer +
    "', 'TxnID' : '" + txnID +
    "', 'LocalTxnDTTime' : '" + txnDateTime +
    "', 'Email' : '" + email +
    "', 'DeviceSN' : '" + deviceSN +
    "', 'AmtTxn' : '" + amt +
    "', 'CrcyTxn' : '" + crcyCde +
    "', 'MID' : '" + mid +
    "', 'sourceSystem' : '" + sourceSystem +
    "', 'sequenceNo' : '" + sequenceNo +
    "', 'OptInPrintReceipt' : '" + isOptInPrintReceipt +
    "', 'OptInSendEReceipt' : '" + isOptInSendEReceipt +
    "', 'OptInEReceipt' : '" + isOptInEReceipt +
    "', 'OptInPmtAckmnt' : '" + isOptInPmtAckmnt +
    "', 'Description' : '" + desc +
    "', 'signature' : '" + signature + "'}";
URL url = new URL("https://xxx.finexusgroup.com/fnx-fintech/xxx/mqpos-host/thirdparty/paymentAuthorization");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json; utf-8");
connection.setRequestProperty("Accept", "application/json");
connection.setDoOutput(true);
OutputStream os = connection.getOutputStream();
byte[] input = jsonMessage.getBytes("utf-8");
os.write(input, 0, input.length);
os.close();
int responseCode = connection.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = in.readLine()) != null) {
    response.append(responseLine.trim());
}
in.close();
.....
Step 1 : Namespace
Use Namespace for making HTTP requests.
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
Step 2 : Source Code
Construct HTTP request body and send this data as a POST request.
.....
string jsonMessage = $"{{" +
    $"\"MsgVer\":\"{msgVer}\"," +
    $"\"PmtType\":\"{pmtType}\"," +
    $"\"IsPreauthInd\":\"{isPreauthInd}\"," +
    $"\"CallerDeviceType\":\"{callerDevice}\"," +
    $"\"CallerDeviceVer\":\"{callerDeviceVer}\"," +
    $"\"TxnID\":\"{txnID}\"," +
    $"\"LocalTxnDTTime\":\"{txnDateTime}\"," +
    $"\"Email\":\"{email}\"," +
    $"\"DeviceSN\":\"{deviceSN}\"," +
    $"\"AmtTxn\":\"{amt}\"," +
    $"\"CrcyTxn\":\"{crcyCde}\"," +
    $"\"MID\":\"{mid}\"," +
    $"\"sourceSystem\":\"{sourceSystem}\"," +
    $"\"sequenceNo\":\"{sequenceNo}\"," +
    $"\"OptInPrintReceipt\":\"{isOptInPrintReceipt}\"," +
    $"\"OptInSendEReceipt\":\"{isOptInSendEReceipt}\"," +
    $"\"OptInEReceipt\":\"{isOptInEReceipt}\"," +
    $"\"OptInPmtAckmnt\":\"{isOptInPmtAckmnt}\"," +
    $"\"Description\":\"{desc}\"," +
    $"\"signature\":\"{signature}\"" +
    $"}}";
using (HttpClient client = new HttpClient())
{
    client.BaseAddress = new Uri("https://xxx.finexusgroup.com/");
    client.DefaultRequestHeaders.Accept.Clear();
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    var content = new StringContent(jsonMessage, Encoding.UTF8, "application/json");
    HttpResponseMessage response = await client.PostAsync("fnx-fintech/xxx/mqpos-host/thirdparty/paymentAuthorization", content);
    response.EnsureSuccessStatusCode();
    string responseBody = await response.Content.ReadAsStringAsync();
    Console.WriteLine(responseBody);
}
.....
Step 1 : Source Code
Construct HTTP request body and send this data as a POST request.
<?php
.....
$jsonMessage = json_encode([
    "MsgVer" => $msgVer,
    "PmtType" => $pmtType,
    "IsPreauthInd" => $isPreauthInd,
    "CallerDeviceType" => $callerDevice,
    "CallerDeviceVer" => $callerDeviceVer,
    "TxnID" => $txnID,
    "LocalTxnDTTime" => $txnDateTime,
    "Email" => $email,
    "DeviceSN" => $deviceSN,
    "AmtTxn" => $amt,
    "CrcyTxn" => $crcyCde,
    "MID" => $mid,
    "sourceSystem" => $sourceSystem,
    "sequenceNo" => $sequenceNo,
    "OptInPrintReceipt" => $isOptInPrintReceipt,
    "OptInSendEReceipt" => $isOptInSendEReceipt,
    "OptInEReceipt" => $isOptInEReceipt,
    "OptInPmtAckmnt" => $isOptInPmtAckmnt,
    "Description" => $desc,
    "signature" => $signature
]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://xxx.finexusgroup.com/fnx-fintech/xxx/mqpos-host/thirdparty/paymentAuthorization");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "Accept: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonMessage);
$response = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
} else {
    echo $response;
}
curl_close($ch);
.....
?>
Step 1 : Import
Import library for making HTTP requests.
import requests
import json
Step 2 : Source Code
Construct HTTP request body and send this data as a POST request.
.....
json_message = {
    "MsgVer": msgVer,
    "PmtType": pmtType,
    "IsPreauthInd": isPreauthInd,
    "CallerDeviceType": callerDevice,
    "CallerDeviceVer": callerDeviceVer,
    "TxnID": txnID,
    "LocalTxnDTTime": txnDateTime,
    "Email": email,
    "DeviceSN": deviceSN,
    "AmtTxn": amt,
    "CrcyTxn": crcyCde,
    "MID": mid,
    "sourceSystem": sourceSystem,
    "sequenceNo": sequenceNo,
    "OptInPrintReceipt": isOptInPrintReceipt,
    "OptInSendEReceipt": isOptInSendEReceipt,
    "OptInEReceipt": isOptInEReceipt,
    "OptInPmtAckmnt": isOptInPmtAckmnt,
    "Description": desc,
    "signature": signature
}
url = "https://xxx.finexusgroup.com/fnx-fintech/xxx/mqpos-host/thirdparty/paymentAuthorization"
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json"
}
response = requests.post(url, headers=headers, json=json_message)
if response.status_code == 200:
    print(response.text)
.....
Step 1 : Install
Install library for making HTTP requests.
npm install axios
Step 2 : Source Code
Construct HTTP request body and send this data as a POST request.
.....
const axios = require('axios');
const jsonMessage = {
    MsgVer: msgVer,
    PmtType: pmtType,
    IsPreauthInd: isPreauthInd,
    CallerDeviceType: callerDevice,
    CallerDeviceVer: callerDeviceVer,
    TxnID: txnID,
    LocalTxnDTTime: txnDateTime,
    Email: email,
    DeviceSN: deviceSN,
    AmtTxn: amt,
    CrcyTxn: crcyCde,
    MID: mid,
    sourceSystem: sourceSystem,
    sequenceNo: sequenceNo,
    OptInPrintReceipt: isOptInPrintReceipt,
    OptInSendEReceipt: isOptInSendEReceipt,
    OptInEReceipt: isOptInEReceipt,
    OptInPmtAckmnt: isOptInPmtAckmnt,
    Description: desc,
    signature: signature
};
// Send the POST request
const url = 'https://xxx.finexusgroup.com/fnx-fintech/xxx/mqpos-host/thirdparty/paymentAuthorization';
axios.post(url, jsonMessage, {
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json'
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(`Error: ${error.response.status} - ${error.response.data}`);
});
.....