Purchasing Reserved Seating Tickets

In this article we will run through a basic process for finding reserved seating performance at AMC Studio 30, and purchasing 2 reserved tickets with a credit card.


Finding a Performance

To get started with purchasing tickets we will need to begin by selecting a theatre and a performance we would like tickets for. We will start by using AMC Studio 30, and pulling the showtimes for today. We'll construct the url using Studio 30's Theatre number 610 and today's date, to keep things simple we will set the page size to one and just use the first result.

GET  /v2/theatres/610/showtimes/10-22-2014?page-size=1

Response

{
  "pageSize": 1,
  "pageNumber": 10,
  "count": 33,
  "_links": {
    "self": {
      "href": "https://api.amctheatres.com/v2/theatres/610/showtimes/05-30-2014?page-number=1&page-size=1",
      "templated": false
    },
    "next": {
      "href": "https://api.amctheatres.com/v2/theatres/610/showtimes/05-30-2014?page-number=2&page-size=1",
      "templated": false
    }
  },
  "_embedded": {
    "showtimes": [
      {
        "id": 26250458,
        "performanceNumber": 97027,
        "sortableTitleName": "Mortal Instruments",
        "showDateTimeUtc": "2014-05-30T19:00:00Z",
        "showDateTimeLocal": "2014-05-30T14:00:00",
        "isSoldOut": false,
        "isCanceled": false,
        "auditorium": 7,
        "runTime": 90,
        "mpaaRating": "PG13",
        "purchaseUrl": "https://amctheatres.com/order/towncenter/05-30-2014/97027",
        "mobilePurchaseUrl": "https://amctheatres.com/order/towncenter/05-30-2014/97027",
        "attributes": [
          {
            "name": "RealD 3D",
            "description": "Forget the days of red-and-green glasses and eyestrain - feast your eyes on the mind-blowing RealD
 3D experience at AMC. Using a new digital approach, you can watch movies like they’ve never been seen before with amazing depth 
and clarity without sacrificing comfort. Experience your favorite films in a new dimension at AMC"
          }
        ],
        "ticketPrices": [
          {
            "price": 7.50,
            "type": "ADULT",
            "sku": "TICKET-RS-26250946-ADULT",
            "tax": 0.60
          }
        ],
        "media": {
          
        },
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v2/showtimes/26250458",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/movie": {
            "href": "https://api.amctheatres.com/v2/movies/41653",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/theatre": {
            "href": "https://api.amctheatres.com/v2/theatres/610",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/seating-layout": {
            "href": "https://api.amctheatres.com/v2/seating-layouts/610/97027",
            "templated": false
          }
        }
      }
    ]
  }
}             

Using the results for showtimes we can select the showtime we want, and inside find 2 types of tickets. For this example we want ADULT tickets, so we pick tickets with that type and grab the Sku and Performance number.

"sku": "TICKET-RS-26250946-ADULT"
"performanceNumber": 97027

Please note: The ticket prices on showtimes are not final and are for display only.


Creating an empty order

To create a simple guest order we just need to send a quick post to the order service with an email address:

POST  /v3/orders

Request

{
    "email": "[email protected]"
}
                    

Response

HTTP/1.1 201 Created
Location: https://api.amctheatres.com/v3/orders/98096
                    

Assuming our email address is valid we should get back a 201 Created result, and the location to our new order.

Location: https://api.amctheatres.com/v3/orders/98096 

Following the new Location Url found in the Location Header we get our empty order and can use the hypermedia links to complete the order.

GET  /v3/orders/98096

Response

{
  "email": "[email protected]",
  "status": "Pending",
  "createdDateUtc": "2014-05-30T20:33:14.513Z",
  "total": 0.00,
  "subtotal": 0.0,
  "paid": 0.0,
  "token": "92e325ab-2b96-429f-ae67-3815a1b3449b",
  "paymentOptions": [
    "creditCard",
    "giftCard"
  ],
  "fees": [
    
  ],
  "_embedded": {
    "products": [
      
    ],
    "payments": [
      
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.amctheatres.com/v3/orders/98096",
      "templated": false
    },
    "https://api.amctheatres.com/rels/v2/order-payments": {
      "href": "https://api.amctheatres.com/v3/orders/98096/payments",
      "templated": false
    },
    "https://api.amctheatres.com/rels/v2/order-products": {
      "href": "https://api.amctheatres.com/v3/orders/98096/products",
      "templated": false
    },
    "https://api.amctheatres.com/rels/v2/order-fulfillment": {
      "href": "https://api.amctheatres.com/v3/orders/98096/fulfill",
      "templated": false
    }
  }
}
                    

As you can see in the above example, we provide a list of links to endpoints (payments, products, and fulfill) which allow you to perform order actions or review the order (self).


Adding Tickets

The first step to adding any product to the order is to find the Sku, which we located in step one, and post it to the products endpoint from inside the order's links. We will do this twice because we want 2 tickets.

POST  /v3/orders/98096/products

Request

{
    "sku": "TICKET-RS-26250946-ADULT",
    "quantity": 1
}
                    

Response

HTTP/1.1 201 Created
Location: https://api.amctheatres.com/v3/orders/98096/products/1
                    

Next we pull down the updated order and find our new product is added inside the embedded products list with a status of "PENDING". This status means that the api needs more information to complete holding the product, in our case this is the specific row and column of the seat.

GET  /v3/orders/98077

Response

                       
{
  "email": "[email protected]",
  "status": "Pending",
  "createdDateUtc": "2014-05-30T20:33:14.513Z",
  "total": 18.00,
  "subtotal": 15.00,
  "paid": 0.0,
  "token": "92e325ab-2b96-429f-ae67-3815a1b3449b",
  "paymentOptions": [
    "creditCard",
    "giftCard"
  ],
  "fees": [
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 1
    },
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 1
    }
  ],
  "expirationDateUtc": "2014-05-30T20:46:06.643Z",
  "_embedded": {
    "products": [
      {
        "sku": "TICKET-RS-26250946-ADULT",
        "quantity": 2,
        "status": "Held",
        "cost": 7.50,
        "name": "ADULT Ticket",
        "theatre": "AMC Studio 30",
        "movie": "Mortal Instruments",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97027,
        "format": "RealD 3D",
        "internalReleaseNumber": 38895,
        "expirationDate": "2014-05-30T20:46:06.643Z",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/98096/products/1",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/movie": {
            "href": "https://api.amctheatres.com/v2/movies/40722",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/theatre": {
            "href": "https://api.amctheatres.com/v2/theatres/38",
            "templated": false
          }
        }
      },
      {
        "sku": "TICKET-RS-26250946-ADULT",
        "quantity": 2,
        "status": "Held",
        "cost": 7.50,
        "name": "ADULT Ticket",
        "theatre": "AMC Studio 30",
        "movie": "Mortal Instruments",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97027,
        "format": "RealD 3D",
        "internalReleaseNumber": 38895,
        "expirationDate": "2014-05-30T20:46:06.643Z",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/98096/products/1",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/movie": {
            "href": "https://api.amctheatres.com/v2/movies/40722",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/theatre": {
            "href": "https://api.amctheatres.com/v2/theatres/38",
            "templated": false
          }
        }
      }
    ],
    "payments": [
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.amctheatres.com/v3/orders/98096",
      "templated": false
    },
    "payments": {
      "href": "https://api.amctheatres.com/v3/orders/98096/payments",
      "templated": false
    },
    "products": {
      "href": "https://api.amctheatres.com/v3/orders/98096/products",
      "templated": false
    }
  }
}
                    

To find out which seats are available we will need to get an updated seating chart. We can construct the url using the AMC Studio 30's theatre number 610, and the Performance number 97027 which we picked up earlier.

GET  /v2/seating-layouts/610/97027

Response

                       
{
  "theatreNumber": 610,
  "performanceNumber": 97027,
  "rows": 7,
  "columns": 16,
  "seats": [
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 1,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 2,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 3,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 4,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 5,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 6,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 7,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 8,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 9,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 10,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 11,
      "type": "NotASeat"
    }
  ],
  "_links": {
    "self": {
      "href": "https://api.amctheatres.com/v2/seating-layout/610/97027",
      "templated": false
    }
  }
}
                    

In the result we get an array of all the seats with their current status and we can just pick the first 2 with the type of "CanReserve" and an "available" property of true.

    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 1,
      "type": "CanReserve"
    },
    {
      "available": true,
      "row": 1,
      "seatName": "",
      "column": 2,
      "type": "CanReserve"
    }

We can then update our pending seats to the seats we've selected from the layout by making a post with the row and column.

PUT  /v3/orders/98096/products/1 

Request

                       
{
    "sku": "TICKET-RS-26250946-ADULT",
    "row": 1,
    "column": 1
}
                    

Response

                       
HTTP/1.1 200 OK
                    

Adding a credit card payment

If we examine the order from the previous step, we find that creditCard is one of the available payment options, so we can proceed with adding a credit card payment through our credit card processor, BrainTree. To add a payment to our order we will first need to cretae a transaction via the Braintree Api. Unfortunately thats beyond the scope of this guide, but you can learn more at Braintree Developers. Once you've created a transaction with Braintree, we will use the provided braintree transaction id to add a new payment to the order. For this example we will use a single transaction for the full purchase price with an id of "cr8tbw".

POST  /v3/orders/97027/payments

Request

{
    "type":"creditCard",
    "amount": 18.00,
    "gateway": "braintree",
    "merchantTransactionId": "cr8tbw"
}
                    

Response

HTTP/1.1 201 Created
Location: https://api.amctheatres.com/v3/orders/97027/payments/1
                    

When we pull down our modified order, we find our new payment with an Authorized status, this means the payment had been approved for processing, but hasn't been billed to the client yet. We also find a new fulfillment link that indicates our order is ready to be committed for final processing.

GET  /v3/orders/98077

Response

                       
{
  "email": "[email protected]",
  "status": "Pending",
  "createdDateUtc": "2014-05-30T20:33:14.513Z",
  "total": 18.00,
  "subtotal": 15.00,
  "paid": 18.00,
  "token": "92e325ab-2b96-429f-ae67-3815a1b3449b",
  "paymentOptions": [
    "creditCard",
    "giftCard"
  ],
  "fees": [
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 1
    },
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 1
    }
  ],
  "expirationDateUtc": "2014-05-30T20:46:06.643Z",
  "_embedded": {
    "products": [
      {
        "sku": "TICKET-RS-26250946-ADULT",
        "quantity": 1,
        "status": "Held",
        "cost": 7.50,
        "name": "ADULT Ticket",
        "theatre": "AMC Studio 30",
        "movie": "Mortal Instruments",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97027,
        "format": "RealD 3D",
        "internalReleaseNumber": 38895,
        "row": 1,
        "column": 1,
        "seatName": "23",
        "expirationDate": "2014-05-30T20:46:06.643Z",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/98096/products/1",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/movie": {
            "href": "https://api.amctheatres.com/v2/movies/40722",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/theatre": {
            "href": "https://api.amctheatres.com/v2/theatres/610",
            "templated": false
          }
        }
      },
        {
        "sku": "TICKET-RS-26250946-ADULT",
        "quantity": 1,
        "status": "Held",
        "cost": 7.50,
        "name": "ADULT Ticket",
        "theatre": "AMC Studio 30",
        "movie": "Mortal Instruments",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97027,
        "format": "RealD 3D",
        "internalReleaseNumber": 38895,
        "row": 1,
        "column": 2,
        "seatName": "24",
        "expirationDate": "2014-05-30T20:46:06.643Z",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/98096/products/2",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/movie": {
            "href": "https://api.amctheatres.com/v2/movies/40722",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/theatre": {
            "href": "https://api.amctheatres.com/v2/theatres/610",
            "templated": false
          }
        }
      }
    ],
    "payments": [
      {
        "type": "Visa",
        "balance": 0.0,
        "amount": 18.00,
        "status": "Authorized",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/98096/payments/1",
            "templated": false
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.amctheatres.com/v3/orders/98096",
      "templated": false
    },
    "https://api.amctheatres.com/rels/v2/order-payments": {
      "href": "https://api.amctheatres.com/v3/orders/98096/payments",
      "templated": false
    },
    "https://api.amctheatres.com/rels/v2/order-products": {
      "href": "https://api.amctheatres.com/v3/orders/98096/products",
      "templated": false
    },
    "https://api.amctheatres.com/rels/v2/order-fulfillment": {
      "href": "https://api.amctheatres.com/v3/orders/98096/fulfill",
      "templated": false
    }
  }
}
                    

Committing the order for Fulfillment

Finally we will complete the order by issueing a POST to the fulfillment link provided by the order links with a null body. If everything goes as planned we will get a 200 OK result, and we can continue by pulling the order back down with a simple GET. Inside our order we will find our confirmation number for picking up tickets at will-call as well as urls for a receipt page and a qr-code for ticketless entry (at select theatres).

POST  /v3/orders/98096/fulfill

Response

                       
HTTP/1.1 200 OK
                    
GET  /v3/orders/98096

Response

                       
                        {
  "email": "[email protected]",
  "status": "Fulfilled",
  "createdDateUtc": "2014-06-13T13:39:34.14Z",
  "total": 18.00,
  "subtotal": 15.00,
  "paid": 15.00,
  "confirmationUrl": "http://amctheatres.com/order/confirmation/92e325ab-2b96-429f-ae67-3815a1b3449b",
  "token": "92e325ab-2b96-429f-ae67-3815a1b3449b",
  "paymentOptions": [
    "creditCard",
    "giftCard"
  ],
  "fees": [
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 1
    },
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 1
    }
  ],
  "expirationDateUtc": "2014-05-30T20:46:06.643Z",
  "_embedded": {
    "products": [
      {
        "sku": "TICKET-RS-26250946-ADULT",
        "quantity": 1,
        "status": "Fulfilled",
        "cost": 7.50,
        "name": "ADULT Ticket",
        "theatre": "AMC Studio 30",
        "movie": "Mortal Instruments",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97027,
        "format": "",
        "internalReleaseNumber": 36885,                      
        "confirmationCode": "0262936537",
        "confirmationQrCode": "https://api.amctheatres.com/v1/qr-codes/038024115098068109254181246040164098188106044115",
        "confirmationQrCodeValue": "A0143491217",
        "row": 1,
        "column": 1,
        "seatName": "23",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/97027/products/1",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/movie": {
            "href": "https://api.amctheatres.com/v2/movies/40385",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/theatre": {
            "href": "https://api.amctheatres.com/v2/theatres/610",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v3/sms-ticket-confirmation": {
            "href": "https://api.amctheatres.com/v3/orders/98096/products/1/sms-ticket-confirmation/{phone-number}",
            "templated": true
          }
        }
      },
       {
        "sku": "TICKET-RS-26250946-ADULT",
        "quantity": 1,
        "status": "Fulfilled",
        "cost": 7.50,
        "name": "ADULT Ticket",
        "theatre": "AMC Studio 30",
        "movie": "Mortal Instruments",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97027,
        "format": "",
        "internalReleaseNumber": 36885,
        "row": 1,
        "column": 2,
        "seatName": "24",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/97027/products/1",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/movie": {
            "href": "https://api.amctheatres.com/v2/movies/40385",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/theatre": {
            "href": "https://api.amctheatres.com/v2/theatres/610",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v3/sms-ticket-confirmation": {
            "href": "https://api.amctheatres.com/v3/orders/98096/products/1/sms-ticket-confirmation/{phone-number}",
            "templated": true
          }
        }
      }
    ],
    "payments": [
      {
        "type": "Amex",
        "balance": 0.0,
        "amount": 18.00,
        "status": "Settled",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/98096/payments/1",
            "templated": false
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.amctheatres.com/v3/orders/98096",
      "templated": false
    }
  }
}