{"id":83769,"date":"2018-11-22T16:00:13","date_gmt":"2018-11-22T14:00:13","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=83769"},"modified":"2019-01-17T13:55:54","modified_gmt":"2019-01-17T11:55:54","slug":"j2pay-complete-example","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html","title":{"rendered":"J2Pay &#8211; Complete Example"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>In this section we will be looking in great detail of how to use a gateway and invoke all four methods successfully i.e. purchase, refund, void and rebill.<\/p>\n<p>For this example we will be using Authorize gateway. Let\u2019s begin.<\/p>\n<p>First of all we will get the Authorize gateway object.<\/p>\n<pre class=\"brush:java\">Gateway gateway = GatewayFactory.getGateway(AvailableGateways.AUTHORIZE);<\/pre>\n<p>But what if you would like to fetch the Authorize gateway dynamically for example you are getting its name from database.<\/p>\n<p>Here is how you could do this.<\/p>\n<pre class=\"brush:java\">Gateway gateway = GatewayFactory.getGateway(AvailableGateways.valueOf(\"AUTHORIZE\"));<\/pre>\n<p>Know you can understand both two approaches of how to get your desired gateway object.<\/p>\n<p>Since we are working in test environment second thing we will do is enable the test mode.<\/p>\n<pre class=\"brush:java\">gateway.setTestMode(true);<\/pre>\n<p>Note: Test mode will only work if it is supported by gateway otherwise it will be ignored by library.<\/p>\n<p>Next and most important thing is API parameters, these are the unique values provided my merchant service providers i.e. API user name and password which must be included in all requests and these are always different for all gateways.<\/p>\n<p>Since we are using J2pay we do not need to read any documentation for authorize gateway variables.<\/p>\n<p>This is where you will be using sample parameter methods <a href=\"http:\/\/www.j2pay.org\/introduction.php#sampleParameters\" target=\"_blank\" rel=\"noopener\">(see Sample Parameters section)<\/a><\/p>\n<p>Here is how you will do that.<\/p>\n<pre class=\"brush:java\">JSONObject apiSampleParameters = gateway.getApiSampleParameters();<\/pre>\n<p>Now we will print it to see what the parameters are.<\/p>\n<pre class=\"brush:java\">JSONObject apiSampleParameters = gateway.getApiSampleParameters();\n    System.out.println(apiSampleParameters);\n    \n    \/\/output\n    { \"name\" : \"also called api user name \/ api login id\", \"transactionKey\" : \"the transaction key\" }<\/pre>\n<p>As you can see for Authorize API parameters are name and transactionKey. We will populate these values and pass to purchase method.<\/p>\n<pre class=\"brush:java\">apiSampleParameters.put(\"name\", \"&lt;your acount's user name here&gt;\");\napiSampleParameters.put(\"transactionKey\", \"&lt;your account's transaction key here&gt;\");<\/pre>\n<h2>Purchase<\/h2>\n<p>Purchase method requires five parameters.<\/p>\n<ol>\n<li>JSONObject apiParamters, that is the gateway specific paramters always unique for each gateway.<\/li>\n<li>Customer customer, this class represents customer personal information.<\/li>\n<li>CustomerCard customerCard, this class represents the Customer card details.<\/li>\n<li>Currency currency, that is enum contains the list of currency in which amount will be charged.<\/li>\n<li>float amount, the amout that will be charged.<\/li>\n<\/ol>\n<p>We have already set the apiParameters above.<\/p>\n<p>Now creating customer and customer card object.<\/p>\n<p>Note: Customer and customercard classes support chaining setter methods and all field used below are required.<\/p>\n<pre class=\"brush:java\">Customer customer = new Customer();\n        \n    customer\n        .setFirstName(\"test first name\")\n        .setLastName(\"test last name\")\n        .setCountry(Country.US)\n        .setState(\"TX\")\n        .setCity(\"test city\")\n        .setAddress(\"test address\")\n        .setZip(\"12345\")\n        .setPhoneNumber(\"1234567890\")\n        .setEmail(\"email@domain.com\")\n        .setIp(\"127.0.0.1\");\n\n    CustomerCard customerCard = new CustomerCard();\n\n    customerCard\n        .setName(\"test card name\")\n        .setNumber(\"5424000000000015\")\n        .setCvv(123)\n        .setExpiryMonth(\"01\")\n        .setExpiryYear(\"2022\");<\/pre>\n<p>Note: 4th and 5th parameters does not require any explanation.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Now all parameters are ready we can pass them to purchase methods<\/p>\n<pre class=\"brush:java\">HTTPResponse response = gateway.purchase(apiSampleParameters, customer, customerCard, Currency.USD, 45);<\/pre>\n<p>You can check the status of purchase request by calling isSuccessful method and you can also get the JSON response by calling getJSONResponse method.<\/p>\n<pre class=\"brush:java\">response.isSuccessful();\n    response.getJSONResponse();<\/pre>\n<p>Let\u2019s put all code together.<\/p>\n<pre class=\"brush:java\">Gateway gateway = GatewayFactory.getGateway(AvailableGateways.AUTHORIZE);\n    JSONObject apiSampleParameters = gateway.getApiSampleParameters();\n\n    apiSampleParameters.put(\"name\", \"\");\n    apiSampleParameters.put(\"transactionKey\", \"\");\n\n    Customer customer = new Customer();\n\n    customer\n        .setFirstName(\"test first name\")\n        .setLastName(\"test last name\")\n        .setCountry(Country.US)\n        .setState(\"TX\")\n        .setCity(\"test city\")\n        .setAddress(\"test address\")\n        .setZip(\"12345\")\n        .setPhoneNumber(\"1234567890\");\n\n    CustomerCard customerCard = new CustomerCard();\n    \n    customerCard\n        .setName(\"test card name\")\n        .setNumber(\"5424000000000015\")\n        .setCvv(123)\n        .setExpiryMonth(\"01\")\n        .setExpiryYear(\"2022\");\n        \n    gateway.setTestMode(true);\n\n    HTTPResponse response = gateway.purchase(apiSampleParameters, customer, customerCard, Currency.USD, 45);\n\n    System.out.println (response.isSuccessful());\n    System.out.println (response.getJSONResponse());<\/pre>\n<p>Let\u2019s take a look at response we receive. Consider we are holding response in response variable.<\/p>\n<pre class=\"brush:java\">JSONObject response = response.getJSONResponse();<\/pre>\n<p>After printing response here is what we got.<\/p>\n<pre class=\"brush:js\">{\n        \"lr\": {\n            \"amount\": 2.5,\n            \"cardExpiryYear\": \"2017\",\n            \"message\": \"This transaction has been approved.\",\n            \"cardFirst6\": \"542400\",\n            \"cardExpiryMonth\": \"12\",\n            \"transactionId\": \"60036012175\",\n            \"maskedCard\": \"542400******0015\",\n            \"rebillParams\": {\n                \"customerProfileId\": \"1813844918\",\n                \"paymentProfileId\": \"1808509554\"\n            },\n            \"success\": true,\n            \"voidParams\": {\n                \"transactionId\": \"60036012175\"\n            },\n            \"currencyCode\": \"USD\",\n            \"cardLast4\": \"0015\",\n            \"refundParams\": {\n                \"transactionId\": \"60036012175\",\n                \"cardLast4\": \"0015\"\n            }\n        },\n        \"gr\": { \/\/long gateway response }\n    }<\/pre>\n<p>As you can see for further transaction like refund, void or rebill library itself created the required parameters<\/p>\n<p>For rebill<\/p>\n<pre class=\"brush:js\">\"rebillParams\": {\n        \"customerProfileId\": \"1813844918\",\n        \"paymentProfileId\": \"1808509554\"\n    },<\/pre>\n<p>For void<\/p>\n<pre class=\"brush:js\">\"voidParams\": {\n        \"transactionId\": \"60036012175\"\n    },<\/pre>\n<p>For refund<\/p>\n<pre class=\"brush:java\">\"refundParams\": {\n        \"transactionId\": \"60036012175\",\n        \"cardLast4\": \"0015\"\n    }<\/pre>\n<p>Note: You can save these parmeters in database and pass them to suitable methods.<\/p>\n<h2>Rebill<\/h2>\n<p>For rebill we will call the getRebillSampleParameters method.<\/p>\n<pre class=\"brush:java\">JSONObject rebillSampleParameters = gateway.getRebillSampleParameters();<\/pre>\n<p>After printing it you will see.<\/p>\n<pre class=\"brush:java\">{\"customerProfileId\":\"the customer profile id\",\"paymentProfileId\":\"the customer payment profile id\"}<\/pre>\n<p>If you match that with above purchase response rebillParams key you will see actually there is no difference. Purchase response already contains these parameters with populated values.<\/p>\n<p>So we are not creating them like getApiSampleParameters above but if you have not executed the purchase transaction from this library you have second option to create these parameters and pass them to rebill method. Below we have described both approaches so you could use whatever suits you better.<\/p>\n<h2>First Approach<\/h2>\n<p>This approach is fast forward. We will be using library generated parameters (rebillParams).<\/p>\n<p>Since rebill method required three parameters<\/p>\n<ol>\n<li>JSON apiParameters<\/li>\n<li>JSON rebillParameters<\/li>\n<li>float amount<\/li>\n<\/ol>\n<p>We have already discussed the apiParameters and just to remind you we saved gateway object in gateway variable and purchase response in response variable.<\/p>\n<p>Here is how we could easily call the rebill method.<\/p>\n<pre class=\"brush:java\">JSONObject rebillParams = response.getJSONObject(\"lr\").getJSONObject(\"rebillParams\")\n    HTTPResponse rebillResponse = gateway.rebill(apiSampleParameters, rebillParams, 105);<\/pre>\n<p>Wasn\u2019t that simple just two lines?<\/p>\n<h2>Second Approach<\/h2>\n<p>Second method is similar as we created apiParameters.<\/p>\n<pre class=\"brush:java\">JSONObject rebillParams = gateway.getRebillSampleParameters();<\/pre>\n<p>After printing rebillParams we got.<\/p>\n<pre class=\"brush:java\">System.out.println(rebillParams);\n    \n    \/\/output\n    {\"customerProfileId\":\"the customer profile id\",\"paymentProfileId\":\"the customer payment profile id\"}<\/pre>\n<p>Now we will populate these values.<\/p>\n<pre class=\"brush:java\">rebillParams.put(\"customerProfileId\", \"1813844918\");\n    rebillParams.put(\"paymentProfileId\", \"1808509554\");<\/pre>\n<p>Now we can call rebill method.<\/p>\n<pre class=\"brush:java\">HTTPResponse rebillResponse = gateway.rebill(apiSampleParameters, rebillParams, 105);<\/pre>\n<p>As you have seen above you can call the rebillResponse. getJSONResponse() method the get the response. And you could also check for whether the transaction was success or not by calling the rebillResponse.isSuccessful() method.<\/p>\n<p>you can also notice both approaches are really simple and you are free to use whatever suits you better but it is recommended to use first approach as it is also very simple and excludes the chances of any bug.<\/p>\n<p>Note: For rest of the example we will be using first approach.<\/p>\n<h2>Refund<\/h2>\n<p>Refund method required three parameters<\/p>\n<ol>\n<li>JSON apiParameters<\/li>\n<li>JSON refundParameters<\/li>\n<li>float amount<\/li>\n<\/ol>\n<p>It is very similar to refund. That\u2019s how we will call refund method.<\/p>\n<pre class=\"brush:java\">JSONObject refundParams = response.getJSONObject(\"lr\").getJSONObject(\"refundParams\")\n    HTTPResponse refundResponse = gateway.refund(apiSampleParameters, refundParams, 2.5);<\/pre>\n<p>Note: Rest of the work will remain same refundResponse contains the actual response.<\/p>\n<h2>Void<\/h2>\n<p>voidTransaction method requires two parameters.<\/p>\n<ol>\n<li>JSON apiParameters<\/li>\n<li>JSON voidParameters<\/li>\n<\/ol>\n<p>Below is the sample code.<\/p>\n<pre class=\"brush:java\">JSONObject voidParams= response.getJSONObject(\"lr\").getJSONObject(\"voidParams\")\n    HTTPResponse voidResponse = gateway.voidTransaction (apiSampleParameters, voidParams);<\/pre>\n<p>Note: Rest of the work will remain same voidResponse contains the actual response.<\/p>\n<p>Congratulations on completing example. You have fully understand the library.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Muhhamad 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\/example.php\" target=\"_blank\" rel=\"noopener\">Example<\/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 In this section we will be looking in great detail of how to use a gateway and invoke all four methods successfully i.e. purchase, refund, void and rebill. For this example we will be using Authorize gateway. Let\u2019s begin. First of all we will get the Authorize gateway object. Gateway gateway = GatewayFactory.getGateway(AvailableGateways.AUTHORIZE); But &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-83769","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 - Complete Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about J2Pay? Check our article introducing an example of how to use a gateway and invoke all four methods successfully.\" \/>\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\/11\/j2pay-complete-example.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"J2Pay - Complete Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about J2Pay? Check our article introducing an example of how to use a gateway and invoke all four methods successfully.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.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-11-22T14:00:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-01-17T11:55:54+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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html\"},\"author\":{\"name\":\"Muhammad Ilyas\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/1a01767a4d8df4dc489c5358581145ad\"},\"headline\":\"J2Pay &#8211; Complete Example\",\"datePublished\":\"2018-11-22T14:00:13+00:00\",\"dateModified\":\"2019-01-17T11:55:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html\"},\"wordCount\":834,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.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\\\/11\\\/j2pay-complete-example.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html\",\"name\":\"J2Pay - Complete Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2018-11-22T14:00:13+00:00\",\"dateModified\":\"2019-01-17T11:55:54+00:00\",\"description\":\"Interested to learn about J2Pay? Check our article introducing an example of how to use a gateway and invoke all four methods successfully.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/11\\\/j2pay-complete-example.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\\\/11\\\/j2pay-complete-example.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 &#8211; Complete Example\"}]},{\"@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 - Complete Example - Java Code Geeks","description":"Interested to learn about J2Pay? Check our article introducing an example of how to use a gateway and invoke all four methods successfully.","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\/11\/j2pay-complete-example.html","og_locale":"en_US","og_type":"article","og_title":"J2Pay - Complete Example - Java Code Geeks","og_description":"Interested to learn about J2Pay? Check our article introducing an example of how to use a gateway and invoke all four methods successfully.","og_url":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.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-11-22T14:00:13+00:00","article_modified_time":"2019-01-17T11:55:54+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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html"},"author":{"name":"Muhammad Ilyas","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/1a01767a4d8df4dc489c5358581145ad"},"headline":"J2Pay &#8211; Complete Example","datePublished":"2018-11-22T14:00:13+00:00","dateModified":"2019-01-17T11:55:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html"},"wordCount":834,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.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\/11\/j2pay-complete-example.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html","url":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html","name":"J2Pay - Complete Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2018-11-22T14:00:13+00:00","dateModified":"2019-01-17T11:55:54+00:00","description":"Interested to learn about J2Pay? Check our article introducing an example of how to use a gateway and invoke all four methods successfully.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2018\/11\/j2pay-complete-example.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\/11\/j2pay-complete-example.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 &#8211; Complete Example"}]},{"@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\/83769","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=83769"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/83769\/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=83769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=83769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=83769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}