Visit my blog or connect with me on Twitter
git init
or
const payment = await request.show(); | |
// This payment method handles everything and returns a final result | |
if (payment.details.bobpay_token_id) { | |
await payment.complete("success"); | |
window.location.href = "/result/success"; | |
return false; | |
} |
# Clone this repo | |
$ git clone https://github.com/deepu105/payment-request-api-example | |
$ cd payment-request-api-example | |
# Install dependencies | |
$ npm install | |
# create a file named `.env` with values `API_KEY="your_Adyen_API_key"` and `MERCHANT_ACCOUNT="your_Adyen_merchant_account"` | |
$ vi .env | |
# start application | |
$ npm start |
async function checkout() { | |
try { | |
const adyenPaymentMethods = await callServer("/api/getPaymentMethods"); | |
// create a new payment request | |
const request = new PaymentRequest(buildSupportedPaymentMethodData(adyenPaymentMethods), buildShoppingCartDetails()); | |
// show payment sheet | |
const payment = await request.show(); | |
// Here we would process the payment. | |
const response = await callServer("/api/initiatePayment", { | |
// This works only for PCI compliant credit card payments. |
async function checkout() { | |
try { | |
const adyenPaymentMethods = await callServer("/api/getPaymentMethods"); | |
// create a new payment request | |
const request = new PaymentRequest(buildSupportedPaymentMethodData(adyenPaymentMethods), buildShoppingCartDetails()); | |
// payment logic goes here | |
} catch (error) { | |
console.error(error); | |
alert(`Error occurred: ${error.message}`); |
Visit my blog or connect with me on Twitter
git init
or
<p>E-commerce applications are the backbone of today's online shopping world. In this post, we will see how to build an e-commerce application easily using Java, JHipster, Spring Boot, and React. Since we will be scaffolding the application, the post will focus on how to build a shopping cart and payment integration rather than how to build a Java web application.</p> | |
<h2 id="tools-and-technology-we-will-use">Tools and technology we will use</h2> | |
<p>We will use the below tools and technology to build this application:</p> | |
<ul> | |
<li><a href="https://www.jhipster.tech/"><strong>JHipster</strong></a>: JHipster is a rapid application development platform. It can quickly create web applications and microservices with production-grade code. Head over to the <a href="https://www.jhipster.tech/installation/">installation instructions</a> to set it up. JHipster can scaffold applications with a wide variety of languages, frameworks, and configurations. For this tutorial, we will stick with the following major option |
export ADYEN_API_KEY=yourAdyenApiKey | |
export ADYEN_MERCHANT_ACCOUNT=yourAdyenMerchantAccount | |
export ADYEN_ORIGIN_KEY=yourAdyenOriginKeyForCorrectDomain |
//import ...; | |
export interface ICheckoutProp extends StateProps, DispatchProps {} | |
class CheckoutContainer extends React.Component<ICheckoutProp> { | |
private paymentContainer = React.createRef<HTMLDivElement>(); | |
//... | |
componentDidMount() { | |
this.props.getEntityForCurrentUser(); |
implementation group: "com.adyen", name: "adyen-java-api-library", version: "5.0.0" |