/// <summary> /// Kiem tra trang thai giao dich offline /// </summary> /// <param name="partnerCode">Ma doi tac do momo cung cap</param> /// <param name="merchantRefId">Ma don hang luu tren he thong momo</param> /// <param name="publicKey">Public key do momo cung cap</param> /// <param name="requestId">Request id</param> /// <param name="description"></param> /// <param name="test">Test=true la moi truong test, test=false la moi truong production. Mac dinh la false</param> /// <returns></returns> public static string QueryTransactionStatusPayOffline(string partnerCode, string merchantRefId, string publicKey, string requestId, string description, bool test = false) { string endpoint = test ? "https://test-payment.momo.vn/pay/query-status" : "https://payment.momo.vn/pay/query-status"; string version = CommonConstant.MOMO_VERSION; publicKey = RsaKeyConverter.PemToXml(RsaKeyConverter.FormatPem(publicKey, "PUBLIC KEY")); //get hash MoMoSecurity momoCrypto = new MoMoSecurity(); string hash = momoCrypto.buildQueryHash(partnerCode, merchantRefId, requestId, publicKey); //request to MoMo string jsonRequest = "{\"partnerCode\":\"" + partnerCode + "\",\"partnerRefId\":\"" + merchantRefId + "\",\"description\":\"" + description + "\",\"version\":" + version + ",\"hash\":\"" + hash + "\"}"; //response from MoMo string responseFromMomo = PaymentRequest.sendPaymentRequest(endpoint, jsonRequest); Logger.Debug(responseFromMomo); return(responseFromMomo); }