Next.js

Start using Everfund's donation elements with Next.js.

Everfund Donation Elements are fully compatible with the latest version of Next.js, supporting both app and page routers. It works with both server and client components, due to the 'use client' directive added to the components.

Follow the instructions on this page to add Everfund Donation Elements into your Next.js project.

Install Donation Elements

pnpm add @everfund/react-sdk
  1. Download the domain association file found here.
  2. Add the verification file to your public directory. The typical location would be:
    • For Next.js pages router: public/.well-known/apple-developer-merchantid-domain-association
    • For Next.js app router: app/.well-known/apple-developer-merchantid-domain-association
  3. Navigate to the domain page found in your Organization’s settings page in the Everfund dashboard.
  4. Enter your domain name in the new domain form. These are the domains that you want to enable browser payments on, and they must be the same as the domain that you are hosting your donation portal on.
  5. Click on the verify button in the Everfund dashboard

That’s all

You can now start using the components in your application.

"use client";
 
import { useDonationCheckoutModal } from "@everfund/react-sdk";
 
export default function Example() {
  const { openModal } = useDonationCheckoutModal({
    code: "ggsm",
  });
 
  return <button onClick={() => openModal()}>Donate Now</button>;
}
Edit this page