Skip to main content
Use these handlers after installing the SDK. They are integration examples: provide your own application authentication and authorization, and configure the recipient allowlist before exposing a payment route. For a runnable terminal example, use First payment.

Framework Integration

Next.js

Express

Do not pass an untrusted request body directly to payments.pay(). Put authentication, local limits, a recipient allowlist, and a caller-supplied idempotency key in front of the SDK. This shared server helper is used by both examples below:
Set PAYMENT_RECIPIENT_ALLOWLIST to comma-separated EVM addresses and MAX_PAYMENT_AMOUNT to your application-level cap. Then wire the helper to an authenticated and authorized Express route. The middleware must verify a user or service identity, enforce your application’s payment-operator permission, and set res.locals.subject; replace the sample import with your implementation.

Serverless (AWS Lambda)

Configure this function behind an API Gateway JWT authorizer and require a payments:create scope on the route. It also checks that scope in the handler, rejects requests without a verified subject, validates and caps the body, requires idempotency, and uses the same recipient allowlist and error mapping as the Express route.
Continue with payment recovery and webhook delivery.