diff --git a/.idea/aws.xml b/.idea/aws.xml
new file mode 100644
index 0000000..56a6c7f
--- /dev/null
+++ b/.idea/aws.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index bc7cbcf..a228f47 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,15 +1,13 @@
+
+
+
-
-
-
-
-
@@ -18,47 +16,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -78,12 +35,16 @@
+
+
+
+
@@ -122,21 +83,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -147,6 +100,7 @@
1566183491220
+
1566185128966
@@ -189,6 +143,9 @@
+
+
+
diff --git a/src/main/java/Mpesa.java b/src/main/java/Mpesa.java
index 7c60a82..892ccf0 100644
--- a/src/main/java/Mpesa.java
+++ b/src/main/java/Mpesa.java
@@ -335,4 +335,37 @@ public String registerURL(String shortCode, String responseType, String confirm
return response.body().string();
}
+ public String dynamicQR(String trxCode, String creditPartyIdentifier, String merchantName, double amount, String refNo) throws IOException{
+ JSONArray jsonArray=new JSONArray();
+ JSONObject jsonObject=new JSONObject();
+ jsonObject.put("MerchantName", merchantName);
+ jsonObject.put("RefNo", refNo);
+ jsonObject.put("Amount", amount);
+ jsonObject.put("TrxCode", trxCode);
+ jsonObject.put("CPI", creditPartyIdentifier);
+
+ jsonArray.put(jsonObject);
+
+ String requestJson=jsonArray.toString().replaceAll("[\\[\\]]","");
+ System.out.println(requestJson);
+
+ OkHttpClient client = new OkHttpClient();
+
+ MediaType mediaType = MediaType.parse("application/json");
+ RequestBody body = RequestBody.create(mediaType, requestJson);
+
+ Request request = new Request.Builder()
+ .url("https://sandbox.safaricom.co.ke/mpesa/stkpushquery/v1/query")
+ .post(body)
+ .addHeader("content-type", "application/json")
+ .addHeader("authorization", "Bearer "+authenticate())
+ .addHeader("cache-control", "no-cache")
+ .build();
+
+ Response response = client.newCall(request).execute();
+ System.out.println(response.body().string());
+ return response.body().string();
+ }
+
+
}