Potted plant
Monstera
Price: $24.99
Use Checkout to quickly and easily add payment buttons to your website.
Let us handle all the backend complexities while you customize some of the Checkout elements yourself (like logo image or title text). If you need more than that, you can always integrate via Custom Form.
Checkout with additional Terms and conditions confirmation page is shown in this example.
Use these card details to test different scenarios
<form action="/examples/checkout-with-terms-and-conditions/payment" method="post">
<script src="https://dev.shift4.com/checkout.js"
class="shift4-button"
data-key="pu_test_WVMFC9GFuvm54b0uorifKkCh"
data-checkout-request="MTY3YTVjOTg4ZTI0YjgyZGMwNWI5YjBjM2JiNmJhYjhiYWFhZDE4MjliMzlkZGUxODRmZmMzMjVjNzEyMDVhNnx7ImNoYXJnZSI6eyJhbW91bnQiOjI0OTksImN1cnJlbmN5IjoiVVNEIn0sInRlcm1zQW5kQ29uZGl0aW9uc1VybCI6Imh0dHBzOi8vZXhhbXBsZS5jb20vdGVybXMtYW5kLWNvbmRpdGlvbnMifQ=="
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-terms-and-conditions", method = GET)
public String checkout(Model model) throws IOException {
try (Shift4Gateway shift4Gateway = new Shift4Gateway(PRIVATE_KEY)) {
CheckoutRequest checkoutRequest = new CheckoutRequest()
.charge(2499, "USD")
.termsAndConditionsUrl("https://example.com/terms-and-conditions");
String signedCheckoutRequest = shift4Gateway.signCheckoutRequest(checkoutRequest);
model.addAttribute("signedCheckoutRequest", signedCheckoutRequest);
}
return "examples/checkout";
}
@RequestMapping(value = "/examples/checkout-with-terms-and-conditions/payment", method = POST)
public String checkoutSubmit(Model model, @RequestParam String shift4ChargeId) {
model.addAttribute("chargeId", shift4ChargeId);
return "examples/checkout";
}
}