Directory

← Back

Payment Request Addon

Experimental addon that provides Java API Payment Request for Vaadin 10

Author

Contributors

Rating

Java API for using the new Payment Request API in Vaadin 10. See Payment Request API in Vaadin 10 blog post for more info.

Sample code using this add-on can be found on (https://github.com/Wnt/PaymentRequestAddonDemo/blob/master/src/main/java/org/vaadin/testapp/DemoView.java)[Github].

Sample code

JsonArray supportedPaymentMethods = getSupportedMethods();

JsonObject paymentDetails = getPaymentDetails();

PaymentRequest paymentRequest = new PaymentRequest(supportedPaymentMethods, paymentDetails);
paymentRequest.setPaymentResponseCallback((paymentResponse) -> {
	JsonObject eventData = paymentResponse.getEventData();
	Notification.show("Please wait a moment while we finish the payment via our payment gateway.", 9000,
			Position.MIDDLE);

	Command onPaymentGatewayRequestComplete = () -> {
		// Close the Payment Request native dialog
		paymentResponse.complete();
		String cardNumber = eventData.getObject("details").getString("cardNumber");
		String cardEnding = cardNumber.substring(cardNumber.length() - 4);
		Notification
				.show("Purchase complete! We have charged the total (1337€) from your credit card ending in "
						+ cardEnding, 9000, Position.MIDDLE);
	};
	startPaymentGatewayQuery(paymentResponse, eventData, onPaymentGatewayRequestComplete);
});
paymentRequest.install(button);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Fixes visibility.

Released
2018-07-04
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 10+
Browser
N/A

Payment Request Addon - Vaadin Add-on Directory

Experimental addon that provides Java API Payment Request for Vaadin 10 Payment Request Addon - Vaadin Add-on Directory
Java API for using the new [Payment Request API](https://developers.google.com/web/fundamentals/payments/) in Vaadin 10. See [Payment Request API in Vaadin 10](https://vaadin.com/blog/payment-request-api-in-vaadin-10) blog post for more info. Sample code using this add-on can be found on (https://github.com/Wnt/PaymentRequestAddonDemo/blob/master/src/main/java/org/vaadin/testapp/DemoView.java)[Github].
Online