Easy Labs
Payments

Payments quickstart

From zero to your first payments call.

This walks the shortest path: install @easylabs/node, create a Customer, mount an Embedded Checkout session, and verify the resulting Order. End-to-end this is a few minutes of typing.

1. Get an API key

Sign in to the Easy Labs dashboard, go to Developers → API keys, and create a sandbox key (sk_sandbox_...). Sandbox keys hit a fully isolated test environment — real money never moves. Switch to a production key (sk_live_...) once you are ready to go live; the SDK auto-routes based on the key prefix.

2. Install the SDK

npm install @easylabs/node
# pnpm add @easylabs/node
# yarn add @easylabs/node

For browser flows install one of:

npm install @easylabs/react   # React apps
npm install @easylabs/browser # vanilla JS

Other languages: see SDKs.

3. Create a Customer and start a checkout session

This snippet runs on your server. It creates a Customer and an Embedded Checkout session that you can hand to the browser.

import { createClient } from "@easylabs/node";

const easy = await createClient({ apiKey: process.env.EASY_API_KEY! });

// 1. Create the buyer.
const { data: customer } = await easy.createCustomer({
  first_name: "Ada",
  last_name: "Lovelace",
  email: "ada@example.com",
});

// 2. Start an embedded checkout session for one product price.
const { data: session } = await easy.createEmbeddedCheckoutSession({
  mode: "payment",
  customer_email: customer.entity.email,
  line_items: [{ price_id: "price_01HXXXXXXXXXXX", quantity: 1 }],
  success_url: "https://your-app.com/checkout/success",
  cancel_url: "https://your-app.com/checkout/cancel",
  payment_methods: ["card"],
});

// Send `session.client_secret` to the browser. Do NOT send the API key.
return Response.json({ clientSecret: session.client_secret });

On the browser, render the iframe. With React:

import { EmbeddedCheckout, EmbeddedCheckoutProvider } from "@easylabs/react";

export function Checkout({ clientSecret }: { clientSecret: string }) {
  return (
    <EmbeddedCheckoutProvider
      config={{
        clientSecret,
        onSuccess: ({ sessionId }) => console.log("paid", sessionId),
      }}
    >
      <EmbeddedCheckout clientSecret={clientSecret} />
    </EmbeddedCheckoutProvider>
  );
}

4. Verify

After the buyer completes the iframe, you can confirm server-side:

const { data: status } = await easy.getEmbeddedCheckoutSession(session.id);
console.log(status.status, status.payment_status);
// → "complete" "paid"

Or open the dashboard and look for the new Order under Payments → Orders.

5. Next steps

On this page