// NextPay.IR Java Sample // docs : https://nextpay.org/nx/docs //////////// // step 1 // //////////// Unirest.setTimeouts(0, 0); HttpResponse response = Unirest.post("https://nextpay.org/nx/gateway/token") .header("Content-Type", "application/x-www-form-urlencoded") .field("api_key", "b11ee9c3-d23d-414e-8b6e-f2370baac97b") .field("amount", "74250") .field("order_id", "85NX85s427") .field("customer_phone", "09121234567") .field("custom_json_fields", "{ \"productName\":\"Shoes752\" , \"id\":52 }") .field("callback_uri", "https://yourWebsite.com/callback") .asString(); //////////// // step 5 // //////////// Unirest.setTimeouts(0, 0); HttpResponse response = Unirest.post("https://nextpay.org/nx/gateway/verify") .header("Content-Type", "application/x-www-form-urlencoded") .field("api_key", "b11ee9c3-d23d-414e-8b6e-f2370baac97b") .field("amount", "74250") .field("trans_id", "f7c07568-c6d1-4bee-87b1-4a9e5ed2e4c1") .asString();