Accept your first payment in 5 minutes

Step 1 - Install the SDK

npm install @accend/sdk

Step 2 - Create a product

import { createAccend } from "@accend/sdk";

const accend = createAccend({
  apiKey: process.env.ACCEND_API_KEY!,
  baseUrl: "https://api.accend.now"
});

const product = await accend.products.create({
  name: "Pro Plan",
  type: "one_time",
  defaultPrice: {
    model: "one_time",
    amount: "97.00",
    currency: "BRL"
  }
});

Step 3 - Create a checkout

const customer = await accend.customers.create({
  externalId: "user_123",
  email: "owner@example.com"
});

const checkout = await accend.checkout.createSession({
  mode: "payment",
  customerId: customer.data.id,
  productId: product.data.id,
  amount: "97.00",
  currency: "BRL",
  successUrl: "https://yourapp.com/success",
  cancelUrl: "https://yourapp.com/cancel"
});
redirect(checkout.data.checkoutUrl);

Step 5 - Receive the webhook

app.post("/webhooks/accend", async (req, res) => {
  const event = req.body;

  if (event.type === "checkout.paid") {
    const { customerId, productId } = event.data;
    await grantAccess(customerId, productId);
  }

  res.sendStatus(200);
});
Your customer paid. Next, see Charge customers on a recurring basis and Charge customers based on what they use.