Eventlayer / Build a flow
Issue tickets after payment
Issue a ticket when your backend confirms a payment.
Use your payment provider for checkout. Use Eventlayer to issue the ticket.
- 01Payment confirmed
- 02Your backend
- 03Ticket issued
1. Confirm the payment
Verify your payment provider’s webhook and match it to a paid order in your database. Use the order’s event and attendee IDs; a browser redirect is not proof of payment.
Create the attendee with the registration flow if you have not already saved one.
2. Issue the ticket
Once your backend confirms the order is paid, create its ticket.
import { Eventlayer } from "eventlayer";
const eventlayer = new Eventlayer();
const { data: ticket, error } = await eventlayer.tickets.create({
eventId: order.eventId,
attendeeId: order.attendeeId,
ticketTypeId: order.ticketTypeId,
});
if (error) throw error;Save ticket.id on the order and show your confirmation page. If a payment notification arrives again, reuse the saved ticket. See retries and recovery for partial failures.
Refunds and access removal
A refund through your payment provider does not remove the Eventlayer ticket. When your refund policy requires it, remove access using the saved ticket ID.
const { error } = await eventlayer.tickets.delete({
ticketId: order.ticketId,
});
if (error) throw error;This removes access. A registered Wallet device keeps a cancelled ticket record; otherwise the ticket is deleted. Keep the order in your own database.