Build a flow

Eventlayer / Build a flow

Add events to your website

Turn a registration form submission into an attendee and a ticket.

Your form collects the attendee’s details. Your backend creates their ticket.

Registration
  1. 01Your form
  2. 02Your backend
  3. 03Attendee + ticket

Start with an event from the quickstart.

1. Collect a name and email

Post your form to a route in your application.

<form action="/api/register" method="post">
  <label for="name">Name</label>
  <input id="name" name="name" required />
  <label for="email">Email</label>
  <input id="email" name="email" type="email" required />
  <button type="submit">Register</button>
</form>

2. Issue the ticket

In your server handler, validate the form and use your event’s ID. The SDK reads your server’s EVENTLAYER_KEY.

Registration handler · server
import { Eventlayer } from "eventlayer";

const eventlayer = new Eventlayer();
const form = await request.formData();

const { data: attendee, error: attendeeError } = await eventlayer.attendees.create({
  eventId: "ev_your_event",
  name: String(form.get("name")),
  email: String(form.get("email")),
  createTicket: true,
});
if (attendeeError) throw attendeeError;

Save attendee.id and attendee.ticket.id with your registration, then show your confirmation page. Your application handles capacity and registration rules.

For paid events, confirm payment before issuing the ticket. The attendee and ticket are created together. If either fails, neither is saved. For duplicate submissions and lost responses, see retries and recovery.

Next steps

Add a Wallet pass or send a confirmation email.