Renew the terminal's certificate
const url = 'https://terminal.api.example.com/v1/terminal/certificate_renewals';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"csr":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://terminal.api.example.com/v1/terminal/certificate_renewals \ --header 'Content-Type: application/json' \ --data '{ "csr": "example" }'Called by a paired terminal, over mutual TLS with its current certificate, for a new certificate for the same key, with no Pairing Code. The current certificate is checked as on any terminal call, so one that was revoked, replaced or has expired cannot be renewed: the terminal is paired again.
Both certificates are honoured until the new one is first used; from then on only the new one is. A retry after a lost answer, with the old certificate and the same key, returns the same new certificate. See Renewing a certificate.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
A PKCS#10 certificate signing request in PEM, signed by the key the terminal was paired with. Its subject is ignored. No attestation chain is needed.
Examplegenerated
{ "csr": "example"}Responses
Section titled “Responses”The new certificate. Sent with Cache-Control: no-store.
object
The id of the terminal the certificate is for, the one the current certificate names.
The terminal’s new client certificate, in PEM, for the same key. Valid for up to 7 days:
expires_at says when it ends. Once it is first used, the certificate it replaces is refused.
The certificates above it, in PEM, its issuer first.
When the new certificate expires, as a Unix timestamp.
Always true. A terminal is a live device; there are no test terminals.
Example
{ "object": "terminal_certificate_renewal", "livemode": true, "terminal_id": "3f6c2a9e-8b41-4d7a-9e25-0c1b7d4f8a63", "certificate": "-----BEGIN CERTIFICATE-----\nMIIB9TCCAZugAwIBAgIU...\n-----END CERTIFICATE-----\n", "chain": "-----BEGIN CERTIFICATE-----\nMIIBvjCCAWSgAwIBAgIU...\n-----END CERTIFICATE-----\n", "expires_at": 1791604200}validation_failure with invalid_parameter and param csr: the CSR is missing, is not a PEM certificate signing request, or is not signed by the key this terminal was paired with. A new key needs a new Pairing Code. Also the codes any /v1 call can get for a body that is not JSON.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure", "code": "invalid_parameter", "message": "csr must be signed by the key this terminal was paired with. A new key needs a new Pairing Code.", "param": "csr", "request_id": "req_2b8d4f6a1c3e" }}authentication_failure with terminal_credential_refused: the current certificate does not count, so it cannot be renewed. Pair the terminal again. See Pairing a terminal.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}dependency_failure with service_unavailable: the platform did not answer, or failed part-way. Whether a new certificate was made is not known. Retry the same request, with the old certificate and the same key: if one was made you get that one back, not a second, and the old certificate stays honoured until the new one is first used.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}