Aevify

@aevify/react

A Pay button and checkout modal for React 18+ (Next.js App Router included). It's about 10 KB with no wallet libraries: the wallet and payment logic live on Aevify's hosted checkout, which this package opens.

npm install @aevify/react

Before you start, add your site under Developers → Allowed domains in the dashboard (http://localhost works without that in development).

AevifyButton

import { AevifyButton } from "@aevify/react";

<AevifyButton
  publishableKey="pk_test_..."
  baseUrl="https://aevify.vercel.app"
  createPayment={async () => {
    const res = await fetch("/api/checkout", { method: "POST" });
    return (await res.json()).id;           // the pay_... ID from your server
  }}
  onSuccess={({ paymentId, txHash }) => router.push(`/thanks?payment=${paymentId}`)}
  onCancel={() => console.log("closed")}
  onError={(error) => console.error(error)}
>
  Pay with tUSD8
</AevifyButton>
Prop
publishableKeyrequiredpk_test_…. A secret key here is refused.
baseUrlrequiredYour Aevify app's URL
createPaymentone of these twoCalled on click; return the payment ID (or an object with id)
paymentIdAn existing payment ID
mode"auto""auto": modal on desktop, redirect on phones. Or "modal" / "redirect".
onSuccess({ paymentId, txHash }) after the customer pays
onCancel({ paymentId }) when they close without paying
onErrorConfiguration problems, or the checkout couldn't be embedded
className, style, disabled, childrenStyling. Passing className removes the default styles.

In redirect mode the customer returns to the successUrl / cancelUrl you set when creating the payment.

AevifyCheckout

The modal on its own, for full control:

import { AevifyCheckout } from "@aevify/react";

const [open, setOpen] = useState(false);

<AevifyCheckout
  publishableKey="pk_test_..."
  baseUrl="https://aevify.vercel.app"
  paymentId={paymentId}
  open={open}
  onClose={() => setOpen(false)}
  onSuccess={handlePaid}
  closeOnSuccess={true}   // default: closes 2 seconds after payment
/>

Behaviour

Helpers

import { checkoutUrl } from "@aevify/react";

checkoutUrl({ publishableKey, baseUrl }, "pay_123");                  // hosted page
checkoutUrl({ publishableKey, baseUrl }, "pay_123", { embed: true, origin: location.origin });