Skip to content

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.

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.1
Authorization: Bearer sk-op-...
Content-Type: application/json

A 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.

{
"payment": {
"amountCents": 2599,
"reference": "ORDER 1042"
},
"data": "order-9f3a2"
}
FieldRequiredConstraints
payment.amountCentsYesInteger, minor units. Minimum 100 (€1.00), maximum 999999 (€9,999.99).
payment.referenceYes1 to 18 characters: letters, digits and spaces only.
dataNoUp to 100 characters: letters, digits, -, ., _, ~.
{ "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.

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();

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"
}
}
}
StatusCause
400payment.amountCents, payment.reference or data failed validation. The response body names the field.
401Missing, invalid, or mismatched bearer token.
409Online 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.