Donation Modal

Display a customizable donation form in a modal that overlays your website though a button click

Loading preview

Usage

import { useDonationCheckoutModal } from "@everfund/react-sdk";
  const [success, setSuccess] = useState(false);
  const { isOpen, openModal } = useDonationCheckoutModal({
    code: "ggsm",
    onSuccess: (data) => {
      console.log("Everfund success", data);
      setSuccess(true);
    },
    onFailure: (err) => {
      console.log("Everfund failed", err);
      setSuccess(true);
    },
    onClose: () => {
      if (success) {
        console.log("Payment success");
      } else {
        console.log("Payment failed");
      }
    },
  });
 
  return (
    <button onClick={() => openModal()}>
      Donate Now
    </button>
  );

API Reference

PropValueDefault
closeOnSuccess
boolean | null
undefined
code
string
/
domain
string
undefined
onClose
() => void
undefined
onFailure
(data: Record<string, unknown>) => void
undefined
onSuccess
(data: SuccessResponse) => void
undefined
Edit this page