> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.todaytixgroup.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.todaytixgroup.com/_mcp/server.

# Create an Apple Pay session

POST https://stg.ttix.io/api/v3/apple-pay-sessions
Content-Type: application/json

Apple Pay requires a server-side merchant validation step before the browser can open the payment sheet. Call this when the shopper taps the Apple Pay button, then pass the returned `merchantSession` unchanged to `ApplePaySession.completeMerchantValidation`. Sessions are short-lived, so mint one per payment attempt rather than caching. The `Origin` request header must carry the domain the shopper is paying on, and that domain must be registered with Apple Pay. Google Pay needs no equivalent — it initializes client-side. When the shopper is paying for a cart, use `POST /api/v3/carts/{cartId}/apple-pay-sessions` instead: a shopper can pay in a currency other than the event's, and the order is charged through the merchant account for the event's currency.

Reference: https://docs.todaytixgroup.com/api-reference/purchase/apple-pay-sessions/post-apple-pay-session

## Authentication

- `X-TT-API-Key` header (required) — API Key authentication via header

## Servers

- `https://stg.ttix.io` (Staging Environment, default)
- `https://api.ttix.io` (Production Environment)

## Request

### Headers

- `X-TT-Platform` (enum, required) — Identifies the platform the request comes from.
  - Allowed values: `android`, `api`, `ios`, `web`
- `X-TT-Retailer` (string, required) — Your retailer identifier, provided during onboarding. It must be a retailer your API key was issued for.

### Body (application/json)

This endpoint expects a PostApplePaySessionRequest.

- `currency` (string, required) — ISO 4217 currency the shopper will pay in. Selects the merchant account the session is minted for, so Apple Pay must be enabled for this currency.

## Response

### 200

Apple Pay merchant session.

- `data` (ApplePaySessionResponse, required) — The Apple Pay merchant session a client needs to open the Apple Pay payment sheet.

## Errors

### 400 Bad Request Error

Missing `Origin` header or invalid currency. Also `APPLE_PAY_NOT_AVAILABLE` when Apple Pay is not enabled for this retailer in the requested currency, or the payment gateway rejects the merchant setup. Retrying will not help, so offer another payment method.

- `error` (ErrorResponse, required) — What went wrong: `type` and `code` for your code to act on, `message` to display.

### 401 Unauthorized Error

The request could not be authenticated. Any request gets `UNAUTHORIZED` when the `X-TT-API-Key` header is missing, and `INVALID_API_KEY` when the key is not valid or was revoked, or when the `X-TT-Retailer` header is missing or names a retailer the key cannot be used for.

- `error` (ErrorResponse, required) — What went wrong: `type` and `code` for your code to act on, `message` to display.

### 403 Forbidden Error

The request is not allowed from where it was sent. Any request sent from a web page gets `ORIGIN_NOT_ALLOWED` when the page's origin is not one the API key allows. Add the origin to the key, or use a key that allows it. A request with no `Origin` header, such as one from your server, is never refused for this.

- `error` (ErrorResponse, required) — What went wrong: `type` and `code` for your code to act on, `message` to display.

### 429 Too Many Requests Error

Too many requests. Wait at most the number of seconds in the `Retry-After` header when it is present, then send the request again.

- `error` (ErrorResponse, required) — What went wrong: `type` and `code` for your code to act on, `message` to display.

### 503 Service Unavailable Error

`APPLE_PAY_SESSION_UNAVAILABLE`: the merchant session could not be created right now. The payment gateway is down, slow or throttling, or it sent back a session that is empty or unreadable. Only failures like these answer 503, and a retry later can succeed.

- `error` (ErrorResponse, required) — What went wrong: `type` and `code` for your code to act on, `message` to display.

## Types

### ApplePaySessionResponse

The Apple Pay merchant session a client needs to open the Apple Pay payment sheet.

- `merchantSession` (map from string to any, optional) — Opaque, time-limited merchant session issued by Apple. Pass it unchanged to the browser's ApplePaySession.completeMerchantValidation to open the payment sheet. Each value is text or a number.

### ErrorResponse

What went wrong: `type` and `code` for your code to act on, `message` to display.

- `type` (enum, required) — High-level error category.
  - Allowed values: `INVALID_REQUEST_ERROR`, `AUTHENTICATION_ERROR`, `PAYMENT_ERROR`, `PERMISSION_ERROR`, `NOT_FOUND_ERROR`, `CONFLICT_ERROR`, `RESOURCE_GONE_ERROR`, `RATE_LIMIT_ERROR`, `API_ERROR`, `SERVICE_UNAVAILABLE`
- `code` (enum, required) — Machine-readable error code.
  - Allowed values: `INVALID_FIELD_VALUE`, `ACCESS_CARD_NOT_VERIFIED`, `ACCESS_CARD_WRONG_SCHEME`, `ACCESS_VERIFICATION_NOT_SUPPORTED`, `ACCESS_VERIFICATION_UNAVAILABLE`, `TICKET_ALERT_SIGNUP_NOT_SUPPORTED`, `MIXED_ITEM_TYPES_NOT_SUPPORTED`, `INVALID_VOUCHER`, `CURRENCY_NOT_SUPPORTED`, `CURRENCY_TEMPORARILY_UNAVAILABLE`, `MISSING_REQUIRED_HEADER`, `MISSING_REQUIRED_FIELD`, `UNAUTHORIZED`, `INVALID_API_KEY`, `INVALID_ACCESS_TOKEN`, `PAYMENT_AUTHENTICATION_REQUIRED`, `PAYMENT_DECLINED`, `RISK_CHECK_FAILED`, `APPLE_PAY_NOT_AVAILABLE`, `APPLE_PAY_SESSION_UNAVAILABLE`, `INVALID_REQUEST`, `RESOURCE_NOT_FOUND`, `INSUFFICIENT_PERMISSIONS`, `ORIGIN_NOT_ALLOWED`, `RATE_LIMITED`, `INTERNAL_SERVER_ERROR`, `SERVICE_UNAVAILABLE`, `INVENTORY_EXHAUSTED`, `OCCURRENCE_NOT_AVAILABLE`, `OCCURRENCE_NOT_COMPATIBLE`, `ORPHANED_SEATS`, `INVALID_PRICE_OPTION`, `MIXED_OCCURRENCES_NOT_SUPPORTED`, `EVENT_NOT_SELLABLE`, `MIXED_PRODUCT_TYPES_NOT_SUPPORTED`, `MULTIPLE_GIFT_CARDS_NOT_SUPPORTED`, `GIFT_CARD_QUANTITY_NOT_SUPPORTED`, `MINIMUM_QUANTITY_NOT_MET`, `VOUCHER_NOT_APPLICABLE_TO_GIFT_CARD`, `CART_EXPIRED`, `EXPECTED_TOTAL_MISMATCH`, `TICKET_LIMIT_EXCEEDED`, `PAYMENT_METHOD_NOT_AVAILABLE`, `CART_ALREADY_ORDERED`, `CART_ALREADY_CLAIMED`, `INVALID_IDEMPOTENCY_KEY`, `IDEMPOTENCY_KEY_ALREADY_PROCESSING`, `IDEMPOTENCY_KEY_CART_MISMATCH`, `IDEMPOTENCY_KEY_FAILED`, `GRANT_NOT_CLAIMABLE`, `GRANT_NOT_CANCELLABLE`, `ACTION_NOT_AVAILABLE`, `THIRD_PARTY_OUTAGE`
- `message` (string, required) — Human-readable description of the error.
- `param` (string, optional, nullable) — The request field that caused the error, if applicable.
- `details` (map from string to ErrorResponseDetails, optional, nullable) — Additional structured data for client recovery logic.

### ErrorResponseDetails

Additional structured data for client recovery logic.

## Examples

**Request**

```json
{
  "currency": "USD"
}
```

**Response**

```json
{
  "data": {
    "merchantSession": {}
  }
}
```

**SDK Code**

```python
import requests

url = "https://stg.ttix.io/api/v3/apple-pay-sessions"

payload = { "currency": "USD" }
headers = {
    "X-TT-Platform": "android",
    "X-TT-Retailer": "YOUR_RETAILER_ID",
    "X-TT-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://stg.ttix.io/api/v3/apple-pay-sessions';
const options = {
  method: 'POST',
  headers: {
    'X-TT-Platform': 'android',
    'X-TT-Retailer': 'YOUR_RETAILER_ID',
    'X-TT-API-Key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"currency":"USD"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://stg.ttix.io/api/v3/apple-pay-sessions"

	payload := strings.NewReader("{\n  \"currency\": \"USD\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-TT-Platform", "android")
	req.Header.Add("X-TT-Retailer", "YOUR_RETAILER_ID")
	req.Header.Add("X-TT-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://stg.ttix.io/api/v3/apple-pay-sessions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-TT-Platform"] = 'android'
request["X-TT-Retailer"] = 'YOUR_RETAILER_ID'
request["X-TT-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"currency\": \"USD\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://stg.ttix.io/api/v3/apple-pay-sessions")
  .header("X-TT-Platform", "android")
  .header("X-TT-Retailer", "YOUR_RETAILER_ID")
  .header("X-TT-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"currency\": \"USD\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://stg.ttix.io/api/v3/apple-pay-sessions', [
  'body' => '{
  "currency": "USD"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-TT-API-Key' => '<apiKey>',
    'X-TT-Platform' => 'android',
    'X-TT-Retailer' => 'YOUR_RETAILER_ID',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://stg.ttix.io/api/v3/apple-pay-sessions");
var request = new RestRequest(Method.POST);
request.AddHeader("X-TT-Platform", "android");
request.AddHeader("X-TT-Retailer", "YOUR_RETAILER_ID");
request.AddHeader("X-TT-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"currency\": \"USD\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-TT-Platform": "android",
  "X-TT-Retailer": "YOUR_RETAILER_ID",
  "X-TT-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["currency": "USD"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://stg.ttix.io/api/v3/apple-pay-sessions")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```