Skip to main content
@buckspay/nextjs exports two App Router route factories. They act as the BFF (Backend for Frontend) boundary described in Facilitator and BFF: the browser POSTs to your same-origin routes; the routes forward to the facilitator with the secret credentials server-side.
@buckspay/nextjs is server-only. Never import it in a Client Component or a file that ends up in the browser bundle. The API key and provider secrets you pass to these factories are captured in a server closure and are never serialized or echoed to the client.

Full example

The snippet below shows all three route handlers in a single file for reference. In production, each goes in its own route.ts under app/.

Next

Facilitator and BFF

Why the API key must stay server-side and how the BFF slot fits the payment flow.

Web - @buckspay/react

The browser-side hooks that POST to your BFF relay route.