Skip to main content
This guide walks you through integrating ArcenPay SDKs into your application.
1

Finish dashboard setup

Before writing any code, complete these steps in the ArcenPay dashboard:
  • Create at least one published plan in Catalog → Plans.
  • Configure any add-ons, credits, or payment links you want to expose.
  • Create and publish a billing component in Components.
  • Generate an API key and copy your publishable key from Settings → API Keys.
You need a published plan and a published billing component before ArcenEmbed can render a checkout or portal surface. Complete this step first.
2

Install the SDKs

Install the SDKs relevant to your application architecture:
3

Add environment variables

Variables prefixed with NEXT_PUBLIC_ are safe to expose in the browser. Keep ARCENPAY_API_KEY, ARCENPAY_WEBHOOK_SECRET, and agent private keys strictly server-side.
See API keys and authentication for the definitive guide on which key works with which endpoint — including the modern sk_, pk_, and rk_ key types.
4

Wrap your app with ArcenPayProvider

ArcenPayProvider initializes the React SDK. Add it at the root of your app.
ArcenPayProvider must render on the client. In Next.js App Router, add "use client" to the file and import it from your server-rendered root layout.
5

Identify the active customer

Call identify() once your app has resolved the customer’s identity.
Render this component once near the top of your authenticated layout so billing state resolves before the customer navigates to a billing page.
6

Render ArcenEmbed

ArcenEmbed handles checkout, portal, payment, unsubscribe, and success states.
For server-issued tokens, mint one with the Node SDK and pass it via accessToken:
See Sessions and access tokens for details on server-issued tokens.
7

Enforce access on the server

Never rely solely on client-side entitlement checks. Use the Node SDK to verify access in your API routes.
Client-side hooks like useFlag and useEntitlement are for UI gating only. Always perform authoritative access checks server-side before executing sensitive or billable operations.
8

Enable AI Agents and MCP tools (Optional)

If your application interacts with AI agents or exposes autonomous billing workflows, use @arcenpay/agent to pay payment links or negotiate HTTP 402 micro-settlements:

Next steps

Last modified on October 6, 2026