Purchasing General Admission Tickets

In this article we will run through a basic process for finding a performance at AMC Town Center 20, and purchasing 2 tickets with 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 Town Center 20, and pulling the showtimes for today. We'll construct the url using Town Center 20's Theatre number 38 and today's date, to keep things simple we will set the page size to one and just use 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/38/showtimes/05-30-2014?page-number=1&page-size=1",
      "templated": false
    },
    "next": {
      "href": "https://api.amctheatres.com/v2/theatres/38/showtimes/05-30-2014?page-number=2&page-size=1",
      "templated": false
    }
  },
  "_embedded": {
    "showtimes": [
      {
        "id": 26250458,
        "performanceNumber": 97027,
        "sortableTitleName": "Getaway",
        "showDateTimeUtc": "2014-05-30T19:00:00Z",
        "showDateTimeLocal": "2014-05-30T14:00:00",
        "isSoldOut": false,
        "isCanceled": false,
        "auditorium": 7,
        "runTime": 90,
        "mpaaRating": "PG13",
        "purchaseUrl": "https://www.amctheatres.com/order/towncenter/05-30-2014/97027",
        "mobilePurchaseUrl": "https://www.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": "SENIOR",
            "sku": "TICKET-GA-26250946-SENIOR",
            "tax": 0.60
          },
          {
            "price": 6.00,
            "type": "CHILD",
            "sku": "TICKET-GA-26250946-CHILD",
            "tax": 0.55
          },
          {
            "price": 7.50,
            "type": "ADULT",
            "sku": "TICKET-GA-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/38",
            "templated": false
          },
          "https://api.amctheatres.com/rels/v2/seating-layout": {
            "href": "https://api.amctheatres.com/v2/seating-layouts/38/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.

"sku": "TICKET-GA-26250946-ADULT"

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": "developers@amctheatres.com"
}
                    

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/98077

Response

{
  "email": "developers@amctheatres.com",
  "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. We can then post it to the products endpoint from inside the order's links.

POST  /v3/orders/98077/products

Request

{
    "sku": "TICKET-GA-26250946-ADULT"
}
                    

Response

HTTP/1.1 201 Created
Location: https://api.amctheatres.com/v3/orders/98077/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 "HELD" and our subtotal has increased to 27.50 and total to 30.50

GET  /v3/orders/98077

Response

                       
{
  "email": "developers@amctheatres.com",
  "status": "Pending",
  "createdDateUtc": "2014-05-30T20:33:14.513Z",
  "total": 30.50,
  "subtotal": 27.50,
  "paid": 0.0,
  "token": "92e325ab-2b96-429f-ae67-3815a1b3449b",
  "paymentOptions": [
    "creditCard",
    "giftCard"
  ],
  "fees": [
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 2
    }
  ],
  "expirationDateUtc": "2014-05-30T20:46:06.643Z",
  "_embedded": {
    "products": [
      {
        "sku": "TICKET-GA-26250946-ADULT",
        "quantity": 2,
        "status": "Held",
        "cost": 13.75,
        "name": "ADULT Ticket",
        "theatre": "AMC Town Center 20",
        "movie": "One Direction Concert Movie",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97040,
        "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
    }
  }
}
                    

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/98077/payments

Request

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

Response

HTTP/1.1 201 Created
Location: https://api.amctheatres.com/v3/orders/98077/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": "developers@amctheatres.com",
  "status": "Pending",
  "createdDateUtc": "2014-05-30T20:33:14.513Z",
  "total": 30.50,
  "subtotal": 27.50,
  "paid": 30.50,
  "token": "92e325ab-2b96-429f-ae67-3815a1b3449b",
  "paymentOptions": [
    "creditCard",
    "giftCard"
  ],
  "fees": [
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 2
    }
  ],
  "expirationDateUtc": "2014-05-30T20:46:06.643Z",
  "_embedded": {
    "products": [
      {
        "sku": "TICKET-GA-26250946-ADULT",
        "quantity": 2,
        "status": "Held",
        "cost": 13.75,
        "name": "ADULT Ticket",
        "theatre": "AMC Town Center 20",
        "movie": "One Direction Concert Movie",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97040,
        "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": [
      {
        "type": "Visa",
        "balance": 0.0,
        "amount": 30.50,
        "status": "Authorized",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/98102/payments/1",
            "templated": false
          }
        }
      }
    ]
  },
  "_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
    },
    "fulfill": {
      "href": "https://api.amctheatres.com/v3/orders/98102/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 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/98077/fulfill

Response

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

Response

                       
{
  "email": "developers@amctheatres.com",
  "status": "Fulfilled",
  "createdDateUtc": "2014-05-30T20:33:14.513Z",
  "total": 30.50,
  "subtotal": 27.50,
  "paid": 30.50,
  "confirmationUrl": "http://www.amctheatres.com/order/confirmation/514fd64f-d28a-4a59-9091-1ccddd4c2982",
  "token": "514fd64f-d28a-4a59-9091-1ccddd4c2982",
  "paymentOptions": [
    "creditCard",
    "giftCard"
  ],
  "fees": [
    {
      "amount": 1.50,
      "waived": false,
      "quantity": 2
    }
  ],
  "expirationDateUtc": "2014-05-30T20:46:06.643Z",
  "_embedded": {
    "products": [
                              {
        "sku": "TICKET-GA-26250946-ADULT",
        "quantity": 2,
        "status": "Fulfilled",
        "cost": 13.75,
        "name": "ADULT Ticket",
        "theatre": "AMC Town Center 20",
        "movie": "One Direction Concert Movie",
        "showDateTime": "2014-05-30 18:15",
        "performanceNumber": 97040,
        "format": "RealD 3D",
        "internalReleaseNumber": 38895,
        "expirationDate": "2014-05-30T20:46:06.643Z",                        
        "confirmationCode": "0113826828",
        "confirmationQrCode": "https://api.amctheatres.com/v1/qr-codes/178162109039097026223043073246116104082005201227",
        "confirmationQrCodeValue": "A0143491217",
        "_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
          },
          "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": "Visa",
        "balance": 0.0,
        "amount": 30.50,
        "status": "Settled",
        "_links": {
          "self": {
            "href": "https://api.amctheatres.com/v3/orders/98102/payments/1",
            "templated": false
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.amctheatres.com/v3/orders/98096",
      "templated": false
    }
  }
}