API Authentication
Learn how to authenticate with the HexPay API using JWT tokens
Getting Your API Key
Create a Store via Telegram Bot
Your API key is automatically generated when you create a store using the HexPay Telegram bot.
Save Your JWT Token
After creating your store, the bot will provide you with a JWT token:
🎉 Congratulations! Your Store is Live!
🔸 Your API Key: eyJhbGciOiJFZERTQSIsImtpZCI6IjFjZDZhOTIy...Important: This token is only shown once during store creation. Save it securely as you'll need it for all API requests.
Using Your API Key
Authorization Header
Include your JWT token in the Authorization header of every API request using the Bearer scheme:
Authorization: Bearer eyJhbGciOiJFZERTQSIsImtpZCI6IjFjZDZhOTIy...Example API Request
Here's a complete example of an authenticated API request:
curl -X GET "https://api.hexpay.io/v1/payments/methods" \
-H "Authorization: Bearer eyJhbGciOiJFZERTQSIsImtpZCI6IjFjZDZhOTIy..."fetch("https://api.hexpay.io/v1/payments/methods", {
method: "GET",
headers: {
"Authorization": "Bearer eyJhbGciOiJFZERTQSIsImtpZCI6IjFjZDZhOTIy..."
}
})package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.hexpay.io/v1/payments/methods"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer eyJhbGciOiJFZERTQSIsImtpZCI6IjFjZDZhOTIy...")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://api.hexpay.io/v1/payments/methods"
response = requests.request("GET", url, headers = {
"Authorization": "Bearer eyJhbGciOiJFZERTQSIsImtpZCI6IjFjZDZhOTIy..."
})
print(response.text)import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create("https://api.hexpay.io/v1/payments/methods"))
.header("Authorization", "Bearer eyJhbGciOiJFZERTQSIsImtpZCI6IjFjZDZhOTIy...")
.GET()
.build();
try {
HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Response body: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}using System;
using System.Net.Http;
using System.Text;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer eyJhbGciOiJFZERTQSIsImtpZCI6IjFjZDZhOTIy...");
var response = await client.GetAsync("https://api.hexpay.io/v1/payments/methods");
var responseBody = await response.Content.ReadAsStringAsync();Next Steps
💰 Create Payment
Learn how to create payments via API
Start building payment flows with our flexible API. Support for fiat amounts, crypto amounts, and customer payment method selection.
📊 Monitor Payments
Check payment status and details
Track payment progress, get transaction signatures, and monitor the complete payment lifecycle in real-time.