{"id":84214,"date":"2018-12-06T07:00:05","date_gmt":"2018-12-06T05:00:05","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=84214"},"modified":"2019-01-17T13:55:06","modified_gmt":"2019-01-17T11:55:06","slug":"j2pay-implementing-gateway","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html","title":{"rendered":"J2Pay \u2013 Implementing A Gateway"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>We are very excited to welcome contributors, if you have worked on any gateway you can implement that gateway in our library and support the open source world.<\/p>\n<p>You can find our github repository <a href=\"https:\/\/github.com\/tranxactive\/J2PAY\">here<\/a><\/p>\n<p>Before you begin to implement a gateway there are some other classes you should see first.<\/p>\n<p>Below are the classes defined briefly.<\/p>\n<h2>HTTPClient<\/h2>\n<p>The main thing when working with gateways you post some data to gateway and parse the response.<\/p>\n<p>To work with http post request this class provides two overloaded static httpPost methods.<\/p>\n<ol>\n<li>public static HTTPResponse httpPost(String url, String postParams, ContentType contentType)<\/li>\n<li>public static HTTPResponse httpPost(String url, String postParams, ContentType contentType, Charset charset)<\/li>\n<\/ol>\n<p>So you don\u2019t have to worry about handling http requests.<\/p>\n<h2>Helpers<\/h2>\n<p>While you are working with multiple gateways the main problem developer usually face is some gateways receive xml while some receive JSON or query string since J2pay always returns JSON Response so you do not have to worry about data conversion from between any of these xml, JSON or query string.<\/p>\n<p>Here is the list of helper classes located in com.tranxactive.paymentprocessor.net package.<\/p>\n<ol>\n<li>QueryStringHelper<\/li>\n<li>JSONHelper<\/li>\n<li>StringHelper<\/li>\n<li>XMLHelper<\/li>\n<\/ol>\n<p>Note: All of the methods defined in helper classes are static.<\/p>\n<h2>Responses<\/h2>\n<p>To provide generic response j2pay provides five response classes located in com.tranxactive.paymentprocessor.gateways.responses package.<\/p>\n<ol>\n<li>ErrorResponse<\/li>\n<li>PurchaseResponse<\/li>\n<li>RebillResponse<\/li>\n<li>RefundResponse<\/li>\n<li>VoidResponse<\/li>\n<\/ol>\n<p>As you can identify by their names if you are working with purchase method you will be using PurchaseResponse class if working with rebill method you will be using RebillRespons class and so on<\/p>\n<p>ErrorResponse class is the only class which will be used in all four methods.<\/p>\n<p>One thing you should also know four classes except ErrorResponse considered as success response. So we will be returning them if and only if transaction was successful.<\/p>\n<h2>ParamList<\/h2>\n<p>ParamList is an enum located in com.tranxactive.paymentprocessor.gateways.parameters package contains the list of variables that must be keep generic in all transactions like if you would like to assign transaction id to variable transactionId there are some chances of typo, but if you will be using paramList enum you are very safe.<\/p>\n<p>Here is how could you use that while assigning transactionId In JSON.<\/p>\n<pre class=\"brush:java\">JSONObject json = new JSONObject();\n    Json.put(ParamList.TRANSACTION_ID.getName(), \"1234567890\");<\/pre>\n<h2>Example<\/h2>\n<p>Now you have all the knowledge required to integrate a new gateway. In this example we will be integrating NMI gateway.<\/p>\n<p>While working on this example we assumed you have read the NMI official documentation.<\/p>\n<h2>Let\u2019s code.<\/h2>\n<p>To integrate NMI gateway we will create a class in com.tranxactive.paymentprocessor.gateways package with the name NMIGateway.<\/p>\n<p>Next we will extends the Gateway class which lead us to implementing all the methods that must be present in a gateway.<\/p>\n<p>Here is how our class will look like.<\/p>\n<pre class=\"brush:java\">public class NMIGateway  extends Gateway{\n\n        @Override\n        public HTTPResponse purchase(JSONObject apiParameters, Customer customer, CustomerCard customerCard, Currency currency, float amount) { }\n\n        @Override\n        public HTTPResponse refund(JSONObject apiParameters, JSONObject refundParameters, float amount) { }\n\n        @Override\n        public HTTPResponse rebill(JSONObject apiParameters, JSONObject rebillParameters, float amount) { }\n\n        @Override\n        public HTTPResponse voidTransaction(JSONObject apiParameters, JSONObject voidParameters) { }\n\n        @Override\n        public JSONObject getApiSampleParameters() { }\n\n        @Override\n        public JSONObject getRefundSampleParameters() { }\n\n        @Override\n        public JSONObject getRebillSampleParameters() { }\n\n        @Override\n        public JSONObject getVoidSampleParameters() { }\n    }<\/pre>\n<p>Next we will add four below methods at the end of our class. These will be helping us to build the final parameters that need to be posted on the gateway.<\/p>\n<pre class=\"brush:java\">private JSONObject buildPurchaseParameters(JSONObject apiParameters, Customer customer, CustomerCard customerCard, Currency currency, float amount){}\n    private JSONObject buildVoidParameters(JSONObject apiParameters, JSONObject voidParameters) {}\n    private JSONObject buildRefundParameters(JSONObject apiParameters, JSONObject refundParameters, float amount){}\n    private JSONObject buildRebillParameters(JSONObject apiParameters, JSONObject rebillParameters, float amount){}<\/pre>\n<p>Next we will define apiURL variable globally where all request will be posted.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">private final String apiURL = \"https:\/\/secure.networkmerchants.com\/api\/transact.php\";<\/pre>\n<p>Next we will work on four SampleParameters methods.<\/p>\n<p>First and most important is getApiSampleParameters method which is required to perform all transactions.<\/p>\n<p>If you have read the NMI documentation you will see API parameters are username and password.<\/p>\n<p>Here is how getApiSampleParameters method will look like.<\/p>\n<pre class=\"brush:java\">@Override\n    public JSONObject getApiSampleParameters() {\n        return new JSONObject()\n            .put(\"username\", \"the api user name use demo as the user name for testing\")\n            .put(\"password\", \"the api password use password  as the password for testing\");\n    }<\/pre>\n<p>Below are the three remaining methods after updating.<\/p>\n<pre class=\"brush:java\">@Override\n    public JSONObject getRefundSampleParameters() {\n        return new JSONObject()\n                .put(ParamList.TRANSACTION_ID.getName(), \"the transaction id which will be refunded\");\n    }\n\n    @Override\n    public JSONObject getRebillSampleParameters() {\n        return new JSONObject()\n                .put(\"customerVaultId\", \"the customer vault id\");\n    }\n\n    @Override\n    public JSONObject getVoidSampleParameters() {\n        return new JSONObject()\n                .put(ParamList.TRANSACTION_ID.getName(), \"the transaction id which will be void\");\n    }<\/pre>\n<p>Next we will be working on four buildparameters methods. Here is how these look like after inserting our code.<\/p>\n<pre class=\"brush:java\">private JSONObject buildPurchaseParameters(JSONObject apiParameters, Customer customer, CustomerCard customerCard, Currency currency, float amount) {\n\n        JSONObject object = new JSONObject();\n        object\n                .put(\"type\", \"sale\")\n                .put(\"username\", apiParameters.getString(\"username\"))\n                .put(\"password\", apiParameters.getString(\"password\"))\n                .put(\"ccnumber\", customerCard.getNumber())\n                .put(\"ccexp\", customerCard.getExpiryMonth() + customerCard.getExpiryYear().substring(2))\n                .put(\"cvv\", customerCard.getCvv())\n                .put(\"amount\", amount)\n                .put(\"currency\", currency)\n                .put(\"first_name\", customer.getFirstName())\n                .put(\"last_name\", customer.getLastName())\n                .put(\"address1\", customer.getAddress())\n                .put(\"city\", customer.getCity())\n                .put(\"state\", customer.getState())\n                .put(\"zip\", customer.getZip())\n                .put(\"country\", customer.getCountry().getCodeISO2())\n                .put(\"phone\", customer.getPhoneNumber())\n                .put(\"email\", customer.getEmail())\n                .put(\"ipaddress\", customer.getIp())\n                .put(\"customer_vault\", \"add_customer\");\n\n        return object;\n\n    }\n\n    private JSONObject buildVoidParameters(JSONObject apiParameters, JSONObject voidParameters) {\n\n        JSONObject object = new JSONObject();\n        object\n                .put(\"type\", \"void\")\n                .put(\"username\", apiParameters.getString(\"username\"))\n                .put(\"password\", apiParameters.getString(\"password\"))\n                .put(\"transactionid\", voidParameters.getString(ParamList.TRANSACTION_ID.getName()));\n\n        return object;\n    }\n\n    private JSONObject buildRefundParameters(JSONObject apiParameters, JSONObject refundParameters, float amount) {\n\n        JSONObject object = new JSONObject();\n        object\n                .put(\"type\", \"refund\")\n                .put(\"username\", apiParameters.getString(\"username\"))\n                .put(\"password\", apiParameters.getString(\"password\"))\n                .put(\"transactionid\", refundParameters.getString(ParamList.TRANSACTION_ID.getName()))\n                .put(\"amount\", Float.toString(amount));\n\n        return object;\n    }\n\n    private JSONObject buildRebillParameters(JSONObject apiParameters, JSONObject rebillParameters, float amount) {\n\n        JSONObject object = new JSONObject();\n        object\n                .put(\"username\", apiParameters.getString(\"username\"))\n                .put(\"password\", apiParameters.getString(\"password\"))\n                .put(\"customer_vault_id\", rebillParameters.getString(\"customerVaultId\"))\n                .put(\"amount\", Float.toString(amount));\n\n        return object;\n    }<\/pre>\n<p>Next we will be working on purchase method.<\/p>\n<p>First of all we will build our final parameters that need to be posted on gateway with the help of buildPurchaseParameters method.<\/p>\n<pre class=\"brush:java\">JSONObject requestObject = this.buildPurchaseParameters(apiParameters, customer, customerCard, currency, amount);<\/pre>\n<p>Next we will define some variables to handle the request don\u2019t worry it\u2019s all depends on how you code.<\/p>\n<pre class=\"brush:java\">JSONObject responseObject;\n    String requestString;\n    String responseString;\n    int responseCode;\n    requestObject = JSONHelper.encode(requestObject);\n    requestString = QueryStringHelper.toQueryString(requestObject);\n    HTTPResponse httpResponse;\n\n    PurchaseResponse successResponse = null;\n    ErrorResponse errorResponse = new ErrorResponse();<\/pre>\n<p>Since NMI requires queryString data to be posted so we are using two helper class.<\/p>\n<p><b>JSONHelper<\/b> and\u00a0<b>QueryStringHelper<\/b><\/p>\n<p>First we will urlencode the json returned by buildPurchaseParameters with the help of this code.<\/p>\n<pre class=\"brush:java\">requestObject = JSONHelper.encode(requestObject);<\/pre>\n<p>Next we converted the encoded json to query string with the help of this code.<\/p>\n<pre class=\"brush:java\">requestString = QueryStringHelper.toQueryString(requestObject);<\/pre>\n<p>You must be wondering why we initialized errorResponse but set successResponse as null. That all for some programming login to handle the request easily.<\/p>\n<p>Next we will be posting the data to gateway, here is how we will do that.<\/p>\n<pre class=\"brush:java\">httpResponse = HTTPClient.httpPost(this.apiURL, requestString, ContentType.APPLICATION_FORM_URLENCODED);<\/pre>\n<p>Here are two scenarios that must keep in mind.<\/p>\n<ol>\n<li>Communication with gateway servers was successful.<\/li>\n<li>There was some network issue or gateway server was temporary not available.<\/li>\n<\/ol>\n<p>Here is how you will handle second scenario.<\/p>\n<pre class=\"brush:java\">if (httpResponse.getStatusCode() == -1) {\n        return httpResponse;\n    }<\/pre>\n<p>If the communication with gateway server was successful then our code will not return from this point and continue.<\/p>\n<p>Next we will get the gateway response and parse it to JSON so we can easily work on response.<\/p>\n<pre class=\"brush:java\">responseString = httpResponse.getContent();\n    responseObject = JSONHelper.decode(QueryStringHelper.toJson(responseString));\n    responseCode = responseObject.getInt(\"response_code\");<\/pre>\n<p>As you can see we again used the QueryStringHelper and JSONHelper. Wasn\u2019t that easy with the help of helper class.<\/p>\n<p>As we know if gateway response was successful than it must return response code 100. See below code.<\/p>\n<pre class=\"brush:java\">if (responseCode == 100) {\n        httpResponse.setSuccessful(true);\n        successResponse = new PurchaseResponse();\n        successResponse.setMessage(responseObject.getString(\"responsetext\"));\n        successResponse.setTransactionId(responseObject.get(\"transactionid\").toString());\n        successResponse.setCardValuesFrom(customerCard);\n        successResponse.setAmount(amount);\n        successResponse.setCurrencyCode(currency);\n\n        successResponse.setRebillParams(new JSONObject()\n                .put(\"customerVaultId\", responseObject.get(\"customer_vault_id\").toString())\n        );\n\n        successResponse.setRefundParams(new JSONObject()\n                .put(ParamList.TRANSACTION_ID.getName(), responseObject.get(\"transactionid\").toString())\n        );\n\n        successResponse.setVoidParams(new JSONObject()\n                .put(ParamList.TRANSACTION_ID.getName(), responseObject.get(\"transactionid\").toString())\n        );\n\n    } else {\n        errorResponse.setMessage(responseObject.getString(\"responsetext\"));\n    }<\/pre>\n<p>Let\u2019s understand the above code line by line.<\/p>\n<pre class=\"brush:java\">httpResponse.setSuccessful(true);<\/pre>\n<p>httpResponse by default set the success to false, so we are only setting it to true in success case as we did above.<\/p>\n<pre class=\"brush:java\">successResponse = new PurchaseResponse();<\/pre>\n<p>We initialized successResponse variable defined in the beginning of method.<\/p>\n<p>When you take a look at the code of PurchaseResponse class you will see all the parameters that must be set before returning the response.<\/p>\n<pre class=\"brush:java\">\/\/this sets the gateway success message.\n    successResponse.setMessage(responseObject.getString(\"responsetext\"));<\/pre>\n<pre class=\"brush:java\">\/\/this sets the gateway returned transaction id.\n    successResponse.setTransactionId(responseObject.get(\"transactionid\").toString());<\/pre>\n<pre class=\"brush:java\">\/\/this is our standard we provide some card detail in purchase response. You will see in final response.\n    successResponse.setCardValuesFrom(customerCard);<\/pre>\n<pre class=\"brush:java\">successResponse.setAmount(amount);\n    successResponse.setCurrencyCode(currency);<\/pre>\n<p>Next we set the amount and currency that was charged.<\/p>\n<p>Since it\u2019s our responsibility to provide the ready to use parameters required for rebill, refund or void.<\/p>\n<p>Here is how we did this.<\/p>\n<pre class=\"brush:java\">successResponse.setRebillParams(new JSONObject()\n        .put(\"customerVaultId\", responseObject.get(\"customer_vault_id\").toString())\n    );\n\n    successResponse.setRefundParams(new JSONObject()\n        .put(ParamList.TRANSACTION_ID.getName(), responseObject.get(\"transactionid\").toString())\n    );\n\n    successResponse.setVoidParams(new JSONObject()\n        .put(ParamList.TRANSACTION_ID.getName(), responseObject.get(\"transactionid\").toString())\n    );<\/pre>\n<p>But what if response what not success and we got some error like insufficient fund or avs error.<\/p>\n<p>Here is how we did this in else block.<\/p>\n<pre class=\"brush:java\">errorResponse.setMessage(responseObject.getString(\"responsetext\"));<\/pre>\n<p>Next we will return the final response that will be HTTPResponse.<\/p>\n<pre class=\"brush:java\">if (successResponse != null) {\n        successResponse.setGatewayResponse(responseObject);\n        httpResponse.setContent(successResponse.getResponse().toString());\n    } else {\n        errorResponse.setGatewayResponse(responseObject);\n        httpResponse.setContent(errorResponse.getResponse().toString());\n    }\n\n    return httpResponse;<\/pre>\n<p>That\u2019s all we have successfully integrated the NMI purchase method, next three methods will be same except you will be using different Response classes for each of them i.e. you will be using<\/p>\n<p>RebillResponse in rebill method.<br \/>\nRefundResponse in refund method.<br \/>\nVoidResponse in voidTransaction method.<br \/>\nInstead of PurchaseResponse.<\/p>\n<p>It is highly recommended to see source of all the these response class and also sample responses (given here)<\/p>\n<p>To see the complete code of NMI gateway you can see on our <a href=\"https:\/\/github.com\/tranxactive\/J2PAY\">github repository<\/a>.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Muhammad Ilyas, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/j2pay.tranxactive.com\/implement_gateway.php\" target=\"_blank\" rel=\"noopener\">Implementing A Gateway<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction We are very excited to welcome contributors, if you have worked on any gateway you can implement that gateway in our library and support the open source world. You can find our github repository here Before you begin to implement a gateway there are some other classes you should see first. Below are the &hellip;<\/p>\n","protected":false},"author":36887,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[1823],"class_list":["post-84214","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-j2pay"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>J2Pay \u2013 Implementing A Gateway - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about J2Pay? Check our article presenting how to implement any gateway in J2pay library and support the open source world.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"J2Pay \u2013 Implementing A Gateway - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about J2Pay? Check our article presenting how to implement any gateway in J2pay library and support the open source world.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/muhammad.ilyas.756412\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-06T05:00:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-01-17T11:55:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Muhammad Ilyas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Muhammad Ilyas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html\"},\"author\":{\"name\":\"Muhammad Ilyas\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/1a01767a4d8df4dc489c5358581145ad\"},\"headline\":\"J2Pay \u2013 Implementing A Gateway\",\"datePublished\":\"2018-12-06T05:00:05+00:00\",\"dateModified\":\"2019-01-17T11:55:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html\"},\"wordCount\":1088,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"J2Pay\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html\",\"name\":\"J2Pay \u2013 Implementing A Gateway - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2018-12-06T05:00:05+00:00\",\"dateModified\":\"2019-01-17T11:55:06+00:00\",\"description\":\"Interested to learn about J2Pay? Check our article presenting how to implement any gateway in J2pay library and support the open source world.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/12\\\/j2pay-implementing-gateway.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"J2Pay \u2013 Implementing A Gateway\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/1a01767a4d8df4dc489c5358581145ad\",\"name\":\"Muhammad Ilyas\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fda302610ed7b18fbe45e22ceee70735b16e928a11617633749eb74631eba46d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fda302610ed7b18fbe45e22ceee70735b16e928a11617633749eb74631eba46d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fda302610ed7b18fbe45e22ceee70735b16e928a11617633749eb74631eba46d?s=96&d=mm&r=g\",\"caption\":\"Muhammad Ilyas\"},\"description\":\"Muhammad is a senior Software Engineer having expertise in famous programming languages like Java, php, c#, perl. He has also worked on mysql and mongodb. He is a co-founder of J2pay.\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/muhammad.ilyas.756412\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/muhammad-ilyas-2012\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/muhammad-ilyas\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"J2Pay \u2013 Implementing A Gateway - Java Code Geeks","description":"Interested to learn about J2Pay? Check our article presenting how to implement any gateway in J2pay library and support the open source world.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html","og_locale":"en_US","og_type":"article","og_title":"J2Pay \u2013 Implementing A Gateway - Java Code Geeks","og_description":"Interested to learn about J2Pay? Check our article presenting how to implement any gateway in J2pay library and support the open source world.","og_url":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/muhammad.ilyas.756412","article_published_time":"2018-12-06T05:00:05+00:00","article_modified_time":"2019-01-17T11:55:06+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Muhammad Ilyas","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Muhammad Ilyas","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html"},"author":{"name":"Muhammad Ilyas","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/1a01767a4d8df4dc489c5358581145ad"},"headline":"J2Pay \u2013 Implementing A Gateway","datePublished":"2018-12-06T05:00:05+00:00","dateModified":"2019-01-17T11:55:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html"},"wordCount":1088,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["J2Pay"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html","url":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html","name":"J2Pay \u2013 Implementing A Gateway - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2018-12-06T05:00:05+00:00","dateModified":"2019-01-17T11:55:06+00:00","description":"Interested to learn about J2Pay? Check our article presenting how to implement any gateway in J2pay library and support the open source world.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2018\/12\/j2pay-implementing-gateway.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"J2Pay \u2013 Implementing A Gateway"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/1a01767a4d8df4dc489c5358581145ad","name":"Muhammad Ilyas","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fda302610ed7b18fbe45e22ceee70735b16e928a11617633749eb74631eba46d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/fda302610ed7b18fbe45e22ceee70735b16e928a11617633749eb74631eba46d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fda302610ed7b18fbe45e22ceee70735b16e928a11617633749eb74631eba46d?s=96&d=mm&r=g","caption":"Muhammad Ilyas"},"description":"Muhammad is a senior Software Engineer having expertise in famous programming languages like Java, php, c#, perl. He has also worked on mysql and mongodb. He is a co-founder of J2pay.","sameAs":["https:\/\/www.facebook.com\/muhammad.ilyas.756412","https:\/\/www.linkedin.com\/in\/muhammad-ilyas-2012\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/muhammad-ilyas"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/84214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/36887"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=84214"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/84214\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=84214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=84214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=84214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}