Skip to content

Documentation

Apply once. Get matched. Integrate once. Accept payments.

Every integration is self-service: copy the code, install the plugin, or share a payment link. Signed-in merchants see these guides prefilled with their own URLs under Integrate in the dashboard.

Hosted checkout

Low codeabout 15 min

Redirect to a branded payment page. One server call.

  1. Create a secret key

    Developers → API keys → Create secret key. It is shown once; store it as PAYMENTS_SECRET_KEY on your server (keys start with al_sk_test_…). Never put it in browser code.

  2. Create a session and redirect

    When the customer clicks Pay, your server creates a checkout session with the amount you calculated and redirects to its url.

    // server.js, Node 18+ (fetch is built in). npm i express
    import express from "express";
    
    const API = "https://api.allidian.com/v1";
    const SECRET_KEY = process.env.PAYMENTS_SECRET_KEY; // al_sk_test_…
    
    const app = express();
    
    app.post("/checkout", async (req, res) => {
      const order = { id: "1001" }; // REPLACE with your real order: amount from YOUR server, and a unique id per order (it is the idempotency key)
      const r = await fetch(`${API}/checkout/sessions`, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${SECRET_KEY}`,
          "Content-Type": "application/json",
          "Idempotency-Key": `order-${order.id}`, // safe to retry
        },
        body: JSON.stringify({
          currency: "usd",
          line_items: [{ name: "T-shirt", quantity: 1, unit_amount: 2500 }], // $25.00 in cents
          success_url: "https://your-site.example/thanks",
          cancel_url: "https://your-site.example/cart",
          merchant_reference: order.id,
          metadata: { order_id: order.id },
        }),
      });
      const session = await r.json();
      if (!r.ok) return res.status(502).send(session.error.message);
      res.redirect(303, session.url); // hosted checkout on https://pay.allidian.com
    });
    
    app.listen(4242);
  3. Fulfil from the webhook

    The success page is for display only. Ship the order when your server receives checkout.session.completed. See the Webhooks guide.

  4. Test

    Pay with a test card on the hosted page, then run the connection tests (Dashboard → Integrate → Connection tests).