Plants
& More
   
Example product

Potted plant

Monstera

Price: $24.99

Checkout with 3D Secure

Checkout enables you to quickly and easily add payment buttons to your website.

You can change some parts of Checkout (such as the title text or logo image), and we'll handle the rest. If you need more than that, you can use Custom Form to integrate payments on your website.

The following example shows a stripped-down, basic version of Checkout.

Use these card details to test different scenarios

Enrolled for 3-D Secure 2
4012 0018 0000 0016
Copied
Not enrolled for 3-D Secure
4242 4242 4242 4242
Copied

		<form action="/examples/checkout-with-3d-secure/payment" method="post">
			<script src="https://dev.shift4.com/checkout.js"
				class="shift4-button"
				data-key="pu_test_WVMFC9GFuvm54b0uorifKkCh"
				data-checkout-request="MGEwZDc0OTAxZWExOTFhMTZjOGM4NzZkMGI2OGU0YmY2MjBhMmM1ZTgzZTIyYjA3MDQxN2IwNWIwYWZiMTA4ZHx7ImNoYXJnZSI6eyJhbW91bnQiOjI0OTksImN1cnJlbmN5IjoiVVNEIn0sInRocmVlRFNlY3VyZSI6eyJlbmFibGUiOnRydWV9fQ=="
				data-name="Shift4"
				data-description="Checkout example"
				data-checkout-button="Buy now"
				data-class="btn btn-primary btn-lg">
			</script>
		</form>
	

		@Controller
		@RequestMapping("/examples")
		public class ExamplesController {
		
			private static final String PRIVATE_KEY = "pr_test_tXHm9qV9qV9bjIRHcQr9PLPa";

			@RequestMapping(value = "/examples/checkout-with-3d-secure", method = GET)
			public String checkout(Model model) throws IOException {
				try (Shift4Gateway shift4Gateway = new Shift4Gateway(PRIVATE_KEY)) {
					CheckoutRequest checkoutRequest = new CheckoutRequest()
							.charge(2499, "USD")
							.threeDSecureRequired(true);
					
					String signedCheckoutRequest = shift4Gateway.signCheckoutRequest(checkoutRequest);
					
					model.addAttribute("signedCheckoutRequest", signedCheckoutRequest);
				}

				return "examples/checkout";
			}
	
			@RequestMapping(value = "/examples/checkout-with-3d-secure/payment", method = POST)
			public String checkoutSubmit(Model model, @RequestParam String shift4ChargeId) {
				model.addAttribute("chargeId", shift4ChargeId);

				return "examples/checkout";
			}
		}