Buy tickets on the secondary market
To enable users to access the secondary market and view available tickets, you need to include a button on the event page within your platform. This button should direct users to the secondary market, where they can view and purchase published tickets.
caution
IMPORTANT Remember to use the private API key from your servers.
Below is an example of how to generate the access URL to purchase tickets in the secondary market, using cURL.
curl -X GET 'https://api.mentatickets.com/v1/marketplace/buyingflow/url/entrypoint?externalReferenceEventId=YOUR_EVENT_ID&showId=YOUR_SHOW_ID'
-H 'Authorization: YOUR_API_KEY'
-H 'Content-Type: application/json'
Below is an example of how to generate the access URL to purchase tickets in the secondary market, using Python.
import requests
event_id = "YOUR_EVENT_ID"
show_id = "YOUR_SHOW_ID"
url = f"https://api.mentatickets.com/v1/marketplace/buyingflow/url/entrypoint?externalReferenceEventId={event_id}&showId={show_id}"
api_key = "YOUR_API_KEY"
headers = {"Authorization": api_key}
response = requests.get(url, headers=headers)
print(response.json())
Below is an example of how to generate the access URL to purchase tickets in the secondary market, using Java.
import okhttp3.*;
import java.io.IOException;
OkHttpClient client = new OkHttpClient();
String eventId = "YOUR_EVENT_ID";
String showId = "YOUR_SHOW_ID";
String url = "https://api.mentatickets.com/v1/marketplace/buyingflow/url/entrypoint?externalReferenceEventId=" + eventId + "&showId=" + showId;
Request request = new Request.Builder()
.url(url)
.addHeader("Authorization", "YOUR_API_KEY")
.get()
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
} catch (IOException e) {
e.printStackTrace();
}
Below is an example of how to generate the access URL to purchase tickets in the secondary market, using PHP.
<?php
$event_id = "YOUR_EVENT_ID";
$show_id = "YOUR_SHOW_ID";
$url = "https://api.mentatickets.com/v1/marketplace/buyingflow/url/entrypoint?externalReferenceEventId={$event_id}&showId={$show_id}";
$api_key = "YOUR_API_KEY";
$headers = array("Authorization: {$api_key}");
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$response_data = json_decode($response, true);
print_r($response_data);
?>