Generate a payment link
POST /companies/{companyId}/online/link/generate creates a payment link your customer can open to pay.
It is the only Paydot API endpoint that requires authentication. Everything else in this reference is about
receiving results asynchronously through webhooks; this is how you start a payment.
Authenticate
Section titled “Authenticate”Generate an API token under Online Payments in the Paydot portal, then send it as a bearer token:
POST /companies/acme/online/link/generate HTTP/1.1Authorization: Bearer sk-op-...Content-Type: application/jsonA missing, malformed, or wrong token returns the same 401. A token that belongs to a different company
also returns 401, not a company-specific error, so the endpoint cannot be used to probe for the existence
of a company id.
Request
Section titled “Request”{ "payment": { "amountCents": 2599, "reference": "ORDER 1042" }, "data": "order-9f3a2"}| Field | Required | Constraints |
|---|---|---|
payment.amountCents | Yes | Integer, minor units. Minimum 100 (€1.00), maximum 999999 (€9,999.99). |
payment.reference | Yes | 1 to 18 characters: letters, digits and spaces only. |
data | No | Up to 100 characters: letters, digits, -, ., _, ~. |
Response
Section titled “Response”{ "url": "https://pay.paydot.eu/#Company/acme?d=..." }Send your customer to url. The link is opaque and single-use; do not construct one by hand or attempt to
decode it.
Call the API
Section titled “Call the API”const response = await fetch( `https://pay-api.paydot.eu/companies/${companyId}/online/link/generate`, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${process.env.PAYDOT_API_TOKEN}`, }, body: JSON.stringify({ payment: { amountCents: 2599, reference: "ORDER 1042" }, data: "order-9f3a2", }), });if (!response.ok) { throw new Error(`Paydot API error: ${response.status} ${await response.text()}`);}const { url } = await response.json();import osimport requests
response = requests.post( f"https://pay-api.paydot.eu/companies/{company_id}/online/link/generate", headers={"Authorization": f"Bearer {os.environ['PAYDOT_API_TOKEN']}"}, json={ "payment": {"amountCents": 2599, "reference": "ORDER 1042"}, "data": "order-9f3a2", },)response.raise_for_status()url = response.json()["url"]<?php$ch = curl_init("https://pay-api.paydot.eu/companies/$companyId/online/link/generate");curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer ' . getenv('PAYDOT_API_TOKEN'), ], CURLOPT_POSTFIELDS => json_encode([ 'payment' => ['amountCents' => 2599, 'reference' => 'ORDER 1042'], 'data' => 'order-9f3a2', ]),]);$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status !== 200) { throw new Exception("Paydot API error: $status $response");}
$url = json_decode($response, true)['url'];var body = """ {"payment":{"amountCents":2599,"reference":"ORDER 1042"},"data":"order-9f3a2"}""";
var request = HttpRequest.newBuilder( URI.create("https://pay-api.paydot.eu/companies/" + companyId + "/online/link/generate")) .header("Content-Type", "application/json") .header("Authorization", "Bearer " + System.getenv("PAYDOT_API_TOKEN")) .POST(HttpRequest.BodyPublishers.ofString(body)) .build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());if (response.statusCode() != 200) { throw new RuntimeException("Paydot API error: " + response.statusCode() + " " + response.body());}Correlating with your own order id
Section titled “Correlating with your own order id”data is not shown to the payer and does not affect the amount or reference. It exists so you can recover
your own order id when the result arrives. Whatever you send here comes back unchanged as
data.payment.data on the webhook event for this payment, or as null if you did not
set it.
// Webhook event for a link created with "data": "order-9f3a2"{ "data": { "payment": { "id": "pay_4KdR8s2Xn1QwZ7", "reference": "ORDER 1042", "status": "EXECUTED", "data": "order-9f3a2" } }}Errors
Section titled “Errors”| Status | Cause |
|---|---|
400 | payment.amountCents, payment.reference or data failed validation. The response body names the field. |
401 | Missing, invalid, or mismatched bearer token. |
409 | Online payments are not enabled for this company. Enable the feature in the portal first. |
Every error is a ProblemDetail (RFC 7807) body: status, title, detail, instance.