how to integrate migs payament gateway in website

Hi,
I am not using opencart. Migs payment services provide by bank.I have document detail only so i need help of sample code for java

I have read the reference guide but it's unhelpful!

i worte pice of code can anyone say were i missed

String MerchantId = "00000078";
    String Amount = "100";
    String PhoneNumber = "9940414243";
    String AccessCode = "4AF13253";
    String SECURE_SECRET = "A1A3999770F5893719AE0076C7F18834";
    String ReturnUrl = "http://localhost:8084/PaymentGateway/payus.jsp";
    String DestinationUrl = "https://migs.mastercard.com.au/vpcpay?";
    String MerchantTransactionRef = Amount + DateTime.now();
    String Command = "Pay";
//    var HashData = SECURE_SECRET;
    public HttpsURLConnection createOpenAPIConnection() {

        HttpsURLConnection con = null;
        try {
            String urlAppenddata = "vpc_Merchant=" + MerchantId;
            urlAppenddata += ("&vpc_Amount=" + Amount);
            urlAppenddata += ("&vpc_AccessCode=" + AccessCode);
            urlAppenddata += ("&vpc_Command=" + Command);
            urlAppenddata += ("&vpc_MerchTxnRef=" + MerchantTransactionRef);
            urlAppenddata += ("&vpc_ReturnURL=" + ReturnUrl);
            urlAppenddata += ("&vpc_SecureHashType=" + "SHA256");
            urlAppenddata += ("&vpc_OrderInfo=" + PhoneNumber);
            urlAppenddata += ("&vpc_Version=" + "1.0");
            urlAppenddata += ("&vpc_SecureHash=" + SECURE_SECRET);
            String method = "POST";
            DestinationUrl=DestinationUrl+urlAppenddata;
            System.out.println("DestinationUrl:"+DestinationUrl);
            URL url = new URL(DestinationUrl);
            con = (HttpsURLConnection) url.openConnection();
            System.out.println("con::::"+con.getResponseCode());
            con.setRequestMethod(method);
            con.setSSLSocketFactory((SSLSocketFactory) SSLSocketFactory.getDefault());
            con.setDoOutput(true);
            con.setDoInput(true);
//            con.setRequestMethod(urlAppenddata);
            if (urlAppenddata != null && urlAppenddata.length() > 0) {
                con.addRequestProperty("content-type", "application/xml; charset=UTF-8");
                con.addRequestProperty("content-length", Integer.toString(urlAppenddata.length()));
            }
            con.connect();

        } catch (Exception e) {
            System.out.println("Exception found in :" + e);
        }
        return con;

    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.