Potted plant
Monstera
Price: $24.99
Use Checkout to quickly add payment buttons to your website.
When using Checkout, we will handle all the difficult tasks on your behalf. Some Checkout elements can be customized (like logo image or title text). If this is insufficient, you may always integrate using Custom Form.
This example shows Checkout with a customer-selected payment amount (which is an ideal solution for donation buttons).
Use these card details to test different scenarios
<form action="/examples/checkout-with-donation/payment" method="post">
<script src="https://dev.shift4.com/checkout.js"
class="shift4-button"
data-key="pu_test_WVMFC9GFuvm54b0uorifKkCh"
data-checkout-request="NzkxMTUzMzExOGE2ZjlhMWYwY2NlNTlmYjI4ZDU2OWVhODdkYmY5YzgyNjRkNWJkYmFkMDQyNzE3YjMyOTBiMnx7ImN1c3RvbUNoYXJnZSI6eyJhbW91bnRPcHRpb25zIjpbMTAwLDIwMCw1MDAsMTAwMCwyMDAwXSwiY3VzdG9tQW1vdW50Ijp7Im1pbiI6MTAwLCJtYXgiOjEwMDAwfSwiY3VycmVuY3kiOiJVU0QifX0="
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-donation", method = GET)
public String checkout(Model model) throws IOException {
try (Shift4Gateway shift4Gateway = new Shift4Gateway(PRIVATE_KEY)) {
CheckoutRequest checkoutRequest = new CheckoutRequest()
.customCharge(new CustomCharge()
.currency("USD")
.amountOptions(100, 200, 500, 1000, 2000)
.customAmount(100, 10000));
String signedCheckoutRequest = shift4Gateway.signCheckoutRequest(checkoutRequest);
model.addAttribute("signedCheckoutRequest", signedCheckoutRequest);
}
return "examples/checkout";
}
@RequestMapping(value = "/examples/checkout-with-donation/payment", method = POST)
public String checkoutSubmit(Model model, @RequestParam String shift4ChargeId) {
model.addAttribute("chargeId", securionpayChargeId);
return "examples/checkout";
}
}