Skip to main content

List User Tickets

List all tickets owned by the authenticated user

Authentication

Required

Response Fields

id
uuid
required
Unique ticket identifier
showing
object
Event showing details
event
object
Event details
type
string
Ticket type/category
owner
string
Owner’s full name
attended
boolean
Whether ticket holder attended the event
price
decimal
Ticket price in USD

Example Request

curl https://pennclubs.com/api/tickets/ \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

[
  {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "showing": {
      "id": 123,
      "start_time": "2024-10-15T19:00:00Z",
      "end_time": "2024-10-15T22:00:00Z",
      "location": "Houston Hall"
    },
    "event": {
      "id": 456,
      "name": "Fall Gala",
      "club": "social-club",
      "club_name": "Penn Social Club"
    },
    "type": "General Admission",
    "owner": "John Doe",
    "attended": false,
    "price": "15.00"
  }
]

Get Ticket Details

Retrieve details about a specific ticket

Authentication

Required - must be ticket owner or club officer

Path Parameters

id
uuid
required
Ticket UUID

Response

Same fields as list endpoint

Example Request

curl https://pennclubs.com/api/tickets/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Ticket QR Code

Generate QR code for ticket check-in

Authentication

Required - must be ticket owner

Path Parameters

id
uuid
required
Ticket UUID

Response

Returns a PNG image of the QR code that can be scanned at the event

Example Request

curl https://pennclubs.com/api/tickets/a1b2c3d4-e5f6-7890-abcd-ef1234567890/qr/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o ticket-qr.png

Update Ticket Attendance

Mark a ticket as attended (club officers only)

Authentication

Required - must be club officer for the event’s club

Path Parameters

id
uuid
required
Ticket UUID

Request Body

attended
boolean
required
Whether ticket holder attended

Example Request

curl -X PATCH https://pennclubs.com/api/tickets/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"attended": true}'

View Cart

View tickets currently in shopping cart

Authentication

Required

Response Fields

tickets
array
Array of ticket objects in cart
sold_out
array
Array of ticket types that became unavailable
Each sold_out item contains:
  • type: Ticket type name
  • showing: Showing ID
  • event: Event ID and name
  • count: Number of tickets that became unavailable

Example Request

curl https://pennclubs.com/api/tickets/cart/ \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "tickets": [
    {
      "id": "temp-uuid-1",
      "type": "General Admission",
      "price": "15.00",
      "showing": {
        "id": 123,
        "start_time": "2024-10-15T19:00:00Z"
      },
      "event": {
        "id": 456,
        "name": "Fall Gala"
      }
    }
  ],
  "sold_out": []
}

Initiate Checkout

Begin checkout process for cart tickets

Authentication

Required

Request Body

Empty object {}

Response Fields

success
boolean
Whether checkout initiation succeeded
sold_free_tickets
boolean
Whether free tickets were automatically claimed
cybersource_url
string
CyberSource payment page URL (if paid tickets)
payment_params
object
Payment parameters to POST to CyberSource (if paid tickets)

Notes

  • For free tickets, they are automatically claimed and no payment is needed
  • For paid tickets, returns CyberSource payment form parameters
  • Tickets are held for 10 minutes during checkout
  • If cart becomes stale (tickets sold), returns 403 error

Example Request

curl -X POST https://pennclubs.com/api/tickets/initiate_checkout/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Example Response (Free Tickets)

{
  "success": true,
  "sold_free_tickets": true,
  "detail": "Free tickets sold."
}

Example Response (Paid Tickets)

{
  "success": true,
  "sold_free_tickets": false,
  "cybersource_url": "https://secureacceptance.cybersource.com/pay",
  "payment_params": {
    "access_key": "abc123...",
    "profile_id": "xyz789...",
    "transaction_uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "amount": "30.00",
    "currency": "USD",
    "signature": "..."
  }
}

Transfer Ticket

Transfer ticket to another user

Authentication

Required - must be ticket owner and ticket must be transferable

Path Parameters

id
uuid
required
Ticket UUID

Request Body

username
string
required
Username of recipient

Response

Confirmation that ticket was transferred

Example Request

curl -X POST https://pennclubs.com/api/tickets/a1b2c3d4-e5f6-7890-abcd-ef1234567890/transfer/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"username": "janedoe"}'

Payment Flow

The ticket purchase flow for paid tickets:
  1. Add tickets to cart - User browses events and adds tickets
  2. View cart - GET /api/tickets/cart/ to review tickets
  3. Initiate checkout - POST /api/tickets/initiate_checkout/
    • Returns CyberSource payment URL and signed parameters
    • Tickets are held for 10 minutes
  4. Submit payment - Frontend POSTs payment_params to cybersource_url
  5. Payment processing - CyberSource processes payment
  6. Callback - CyberSource POSTs result to /api/tickets/payment_complete/
    • If successful, tickets are assigned to user
    • If failed, holds are released
  7. Confirmation - User receives email with ticket QR codes

Free Tickets Flow

  1. Add free tickets to cart
  2. Call POST /api/tickets/initiate_checkout/
  3. Response has sold_free_tickets: true
  4. Tickets immediately assigned to user
  5. Skip payment steps

Error Responses

Cart is Stale (403)

Tickets in cart were sold or became unavailable:
{
  "success": false,
  "detail": "Cart is stale or empty, invoke /api/tickets/cart to refresh",
  "sold_free_tickets": false
}
Solution: Call GET /api/tickets/cart/ to refresh and get available tickets

Empty Cart (400)

{
  "success": false,
  "detail": "No tickets selected for checkout.",
  "sold_free_tickets": false
}

Payment Declined

User is redirected to frontend with error in query params:
https://pennclubs.com/events/checkout?error=Your+payment+was+declined

Build docs developers (and LLMs) love