|
| 1 | +<!doctype html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta http-equiv="X-UA-Compatible" content="chrome=1"> |
| 6 | + <title>Adyen-java-api-library by Adyen</title> |
| 7 | + |
| 8 | + <link rel="stylesheet" href="stylesheets/styles.css"> |
| 9 | + <link rel="stylesheet" href="stylesheets/github-light.css"> |
| 10 | + <meta name="viewport" content="width=device-width"> |
| 11 | + <!--[if lt IE 9]> |
| 12 | + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> |
| 13 | + <![endif]--> |
| 14 | +</head> |
| 15 | +<body> |
| 16 | +<div class="wrapper"> |
| 17 | + <header> |
| 18 | + <h1>Adyen-java-api-library</h1> |
| 19 | + <p>Adyen API Library for Java</p> |
| 20 | + |
| 21 | + <p class="view"><a href="https://github.com/Adyen/adyen-java-api-library">View the Project on GitHub |
| 22 | + <small>Adyen/adyen-java-api-library</small> |
| 23 | + </a></p> |
| 24 | + |
| 25 | + |
| 26 | + <ul> |
| 27 | + <li><a href="https://github.com/Adyen/adyen-java-api-library/zipball/master">Download <strong>ZIP |
| 28 | + File</strong></a></li> |
| 29 | + <li><a href="https://github.com/Adyen/adyen-java-api-library/tarball/master">Download <strong>TAR |
| 30 | + Ball</strong></a></li> |
| 31 | + <li><a href="https://github.com/Adyen/adyen-java-api-library">View On <strong>GitHub</strong></a></li> |
| 32 | + </ul> |
| 33 | + </header> |
| 34 | + <section> |
| 35 | + <h1>Checkout API integration</h1> |
| 36 | + <p> |
| 37 | + The Checkout API service has the following methods: |
| 38 | + </p> |
| 39 | + <h2><a id="paymentMethods_27"></a>paymentMethods</h2> |
| 40 | + <p>Queries the available payment methods for a transaction based on the transaction context (like amount, |
| 41 | + country, and currency). Besides giving back a list of the available payment methods, the response also |
| 42 | + returns which input details you need to collect from the shopper (to be submitted to <strong>payments( |
| 43 | + )</strong>).</p> |
| 44 | + <p>Although we highly recommend using this endpoint to ensure you are always offering the most up-to-date list |
| 45 | + of payment methods, its usage is optional. You can, for example, also cache the <strong>paymentMethods( |
| 46 | + )</strong> response and update it once a week.</p> |
| 47 | + <pre><code class="language-java">Checkout checkout = <span class="hljs-keyword">new</span> Checkout(client); |
| 48 | +PaymentMethodsRequest paymentMethodsRequest = <span class="hljs-keyword">new</span> PaymentMethodsRequest(); |
| 49 | +paymentMethodsRequest.setMerchantAccount(<span class="hljs-string">"YourMerchantAccount"</span>); |
| 50 | +PaymentMethodsResponse response = checkout.paymentMethods(paymentMethodsRequest); |
| 51 | +</code></pre> |
| 52 | + |
| 53 | + <h2><a id="payments_0"></a>payments</h2> |
| 54 | + <p>Sends payment parameters (like amount, country, and currency) together with the input details collected from |
| 55 | + the shopper. The response returns the result of the payment request:</p> |
| 56 | + <ul> |
| 57 | + <li>For some payment methods (e.g. Visa, Mastercard, and SEPA Direct Debits) you’ll get a final state in the |
| 58 | + <strong>resultCode</strong> (e.g. <strong>authorised</strong> or <strong>refused</strong>). |
| 59 | + </li> |
| 60 | + <li>For other payment methods, you’ll receive <strong>redirectShopper</strong> as |
| 61 | + <strong>resultCode</strong> together with a <strong>redirectUrl</strong>. In this case, the shopper must |
| 62 | + finalize the payment on the page behind the redirectUrl. |
| 63 | + </li> |
| 64 | + </ul> |
| 65 | + <pre><code class="language-java">Checkout checkout = <span class="hljs-keyword">new</span> Checkout(client); |
| 66 | +PaymentsRequest paymentsRequest = <span class="hljs-keyword">new</span> PaymentsRequest(); |
| 67 | +Amount amount = <span class="hljs-keyword">new</span> Amount(); |
| 68 | +amount.setCurrency(<span class="hljs-string">"USD"</span>); |
| 69 | +amount.setValue(<span class="hljs-number">1000L</span>); |
| 70 | +paymentsRequest.setReference(<span class="hljs-string">"Your order number"</span>); |
| 71 | +paymentsRequest.setAmount(amount); |
| 72 | +paymentsRequest.setPaymentMethod(<span class="hljs-keyword">new</span> HashMap<String, String>()); |
| 73 | +paymentsRequest.putPaymentMethodItem(<span class="hljs-string">"number"</span>, <span class="hljs-string">"4111111111111111"</span>); |
| 74 | +paymentsRequest.putPaymentMethodItem(<span class="hljs-string">"type"</span>, <span class="hljs-string">"scheme"</span>); |
| 75 | +paymentsRequest.putPaymentMethodItem(<span class="hljs-string">"expiryMonth"</span>, <span |
| 76 | + class="hljs-string">"08"</span>); |
| 77 | +paymentsRequest.putPaymentMethodItem(<span class="hljs-string">"expiryYear"</span>, <span |
| 78 | + class="hljs-string">"2018"</span>); |
| 79 | +paymentsRequest.putPaymentMethodItem(<span class="hljs-string">"holderName"</span>, <span class="hljs-string">"John Smith"</span>); |
| 80 | +paymentsRequest.putPaymentMethodItem(<span class="hljs-string">"cvc"</span>, <span class="hljs-string">"737"</span>); |
| 81 | +paymentsRequest.setReturnUrl(<span class="hljs-string">"https://your-company.com/..."</span>); |
| 82 | +paymentsRequest.setMerchantAccount(<span class="hljs-string">"YOUR_MERCHANT_ACCOUNT"</span>); |
| 83 | +PaymentsResponse paymentResponse = checkout.payments(paymentsRequest); |
| 84 | +</code></pre> |
| 85 | + |
| 86 | + <h2><a id="paymentsDetails_37"></a>payments/details</h2> |
| 87 | + <p>Submits details for a payment created using <strong>payments( )</strong>. This step is only needed when no |
| 88 | + final state has been reached on the <strong>payments( )</strong> request (for example for 3D Secure, or when |
| 89 | + getting redirected back directly from a payment method using an app switch).</p> |
| 90 | + <p>The exact details, which need to be sent to this endpoint, are always specified in the response of the |
| 91 | + associated <strong>payments( )</strong> request. When sending in the request to <strong>paymentsDetails( |
| 92 | + )</strong>, make sure you send the corresponding paymentData as obtained during the <strong>payments( |
| 93 | + )</strong> call.</p> |
| 94 | + <p>In addition, the endpoint can be used to verify a <strong>payload</strong>, which is returned after coming |
| 95 | + back from the Checkout SDK or any of the redirect based methods on the Checkout API.</p> |
| 96 | + <pre><code class="language-java">Checkout checkout = <span class="hljs-keyword">new</span> Checkout(client); |
| 97 | +PaymentsDetailsRequest paymentsDetailsRequest = <span class="hljs-keyword">new</span> PaymentsDetailsRequest(); |
| 98 | +paymentsDetailsRequest.setPaymentData(<span class="hljs-string">"Hee57361f99...."</span>); |
| 99 | +HashMap<String, String> details = <span class="hljs-keyword">new</span> HashMap<>(); |
| 100 | +details.put(<span class="hljs-string">"MD"</span>, <span class="hljs-string">"sdfsdfsdf..."</span>); |
| 101 | +details.put(<span class="hljs-string">"PaRes"</span>, <span class="hljs-string">"sdfsdfsdf..."</span>); |
| 102 | +paymentsDetailsRequest.setDetails(details); |
| 103 | +PaymentsResponse paymentsResponse = checkout.paymentsDetails(paymentsDetailsRequest); |
| 104 | +</code></pre> |
| 105 | + |
| 106 | + |
| 107 | + </section> |
| 108 | + <footer> |
| 109 | + <p>This project is maintained by <a href="https://github.com/Adyen">Adyen</a></p> |
| 110 | + <p> |
| 111 | + <small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a> |
| 112 | + </small> |
| 113 | + </p> |
| 114 | + </footer> |
| 115 | +</div> |
| 116 | +<script src="javascripts/scale.fix.js"></script> |
| 117 | + |
| 118 | +</body> |
| 119 | +</html> |
0 commit comments