const options = {method: 'POST'};
fetch('https://api-pse.gnosispay.com/api/v1/ephemeral-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api-pse.gnosispay.com/api/v1/ephemeral-tokenimport requests
url = "https://api-pse.gnosispay.com/api/v1/ephemeral-token"
response = requests.post(url)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-pse.gnosispay.com/api/v1/ephemeral-token"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-pse.gnosispay.com/api/v1/ephemeral-token")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-pse.gnosispay.com/api/v1/ephemeral-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"token": "8356ea2b8e7f1d49c2e5f8a76b91c02a3d4f7e10a2c5b9d8e1f4a7c0b3d5e2f",
"expiresAt": "2024-02-07T12:34:56Z"
}
}{
"error": "Client certificate required"
}{
"error": "Internal Server Error"
}Generate a new ephemeral token
Generates a new ephemeral token for secure PCI operations.
Ephemeral tokens are single-use tokens with a short lifespan (60 seconds) that are used to authorize sensitive PCI operations like retrieving card details or setting a PIN.
This endpoint requires mTLS (Mutual TLS) authentication using a valid client certificate.
The client certificate must be issued by a trusted Certificate Authority and contain valid partner identifier in its subject.
mTLS Requirements
- Certificate must be issued by a trusted Certificate Authority
- Certificate must contain a valid partner app ID in the CN (Common Name) field
- Certificate must be valid and not expired
- Certificate must be presented during the TLS handshake
Example certificate subject format:
CN=gp_f1a9b6c741c94510bb3b27f2e8379e29,C=US
Testing the Endpoint
Due to browser limitations, this endpoint cannot be tested directly in Swagger UI. Use one of the following methods:
Using cURL
curl -X POST --cert client.crt --key client.key https://${{AUTHENTICATED_PSE_API_URL}}/api/v1/ephemeral-token
Certificate and Key Format Requirements:
- Certificate file (
.crt/.pem) and Private key file (.key/.pem): both must be in PEM format
Example certificate format:
-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2oCiwYwDQYJKoZIhvcNAQELBQAw
... (base64 encoded certificate data) ...
-----END CERTIFICATE-----
Example private key format:
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7VJTUt9Us8cKB
... (base64 encoded private key data) ...
-----END PRIVATE KEY-----
Important Notes:
- Ensure certificate and key files have proper line endings
- Certificate and key files should be readable by the client application
- The private key must correspond to the certificate being used
- Certificate must be valid and not expired
Using Postman
- Go to Settings > Certificates
- Add your client certificate and private key
- Make sure to select the certificate for the correct host
Using Node.js
import https from "https";
const httpsAgent = new https.Agent({
cert: CERT,
key: KEY,
rejectUnauthorized: true,
});
const req = https.request(
{
hostname: "api-pse.gnosispay.com",
path: "/api/v1/ephemeral-token",
method: "POST",
headers: {
"Content-Type": "application/json",
"User-Agent": "User-Client/1.0.0",
},
agent: httpsAgent,
},
(res) => {
let data = "";
res.on("data", (chunk) => {
data += chunk;
});
res.on("end", () => {
console.log("Status:", res.statusCode);
try {
const parsedData = JSON.parse(data);
console.log("Response:", parsedData);
} catch {
console.log("Raw response:", data);
}
});
},
);
req.on("error", (error) => {
console.error("Request error:", error);
});
req.end();
const options = {method: 'POST'};
fetch('https://api-pse.gnosispay.com/api/v1/ephemeral-token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api-pse.gnosispay.com/api/v1/ephemeral-tokenimport requests
url = "https://api-pse.gnosispay.com/api/v1/ephemeral-token"
response = requests.post(url)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-pse.gnosispay.com/api/v1/ephemeral-token"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-pse.gnosispay.com/api/v1/ephemeral-token")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-pse.gnosispay.com/api/v1/ephemeral-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"token": "8356ea2b8e7f1d49c2e5f8a76b91c02a3d4f7e10a2c5b9d8e1f4a7c0b3d5e2f",
"expiresAt": "2024-02-07T12:34:56Z"
}
}{
"error": "Client certificate required"
}{
"error": "Internal Server Error"
}Response
Ephemeral token generated successfully
Show child attributes
Show child attributes