Overview
The @1stdigital/prism-nextjs package provides middleware for Next.js API routes and App Router route handlers. Supports both Pages Router and App Router architectures.App Router
Support for Next.js 13+ App Router
Pages Router
Works with traditional API routes
Edge Runtime
Compatible with Edge Runtime
Installation
- npm
- yarn
- pnpm
The canonical SDK config is
identifyToken (PRISM_IDENTIFY_TOKEN env var) — formerly apiKey / PRISM_API_KEY. SDKs accept the legacy names as fallback during the migration window; new code should use the canonical names.Quick Start (App Router)
Quick Start (Pages Router)
Configuration
App Router Options
Pages Router Options
App Router Routes
Single Route
Multiple Methods
Accessing Payment Info
App Router
Pages Router
Settlement Validation
Coming soon: transaction hash in the
X-PAYMENT-RESPONSE response header. The Next.js SDK currently confirms settlement internally before returning the response, but does not yet surface the transaction hash to the client. If your application needs the on-chain transaction hash on the client side, use the Express SDK — it returns this header today.