Commerce
Create hosted payment links and confirm checkout.
Payment links can be attached to a product or used as standalone hosted payment collection flows.
Management
GET
/payment-linksPro or BusinessPOST
/payment-linksPro or BusinessGET
/payment-links/:idPATCH
/payment-links/:idDELETE
/payment-links/:idDefault product links cannot be deleted.
typescript
import { veritas } from "@/lib/veritas";
const created = await veritas<{ paymentLink: { id: string } }>(
"/payment-links",
{
method: "POST",
body: JSON.stringify({
name: "Workshop seat",
customAmount: 850,
acceptedProviders: ["telebirr"],
payoutAccountIds: ["payout_id"],
redirectUrl: "https://example.com/thank-you",
expiresInMinutes: 60,
}),
},
);
const linkId = created.paymentLink.id;
const links = await veritas("/payment-links");
const link = await veritas(`/payment-links/${linkId}`);
await veritas(`/payment-links/${linkId}`, {
method: "PATCH",
body: JSON.stringify({ expiresInMinutes: 120 }),
});
await veritas(`/payment-links/${linkId}`, { method: "DELETE" });Create a standalone link
json
{
"name": "Workshop seat",
"customAmount": 850,
"acceptedProviders": ["telebirr"],
"payoutAccountIds": ["payout_id"],
"redirectUrl": "https://example.com/thank-you",
"expiresInMinutes": 60
}Public checkout
GET
/payment-links/:id/publicNo API keyReturns the public checkout configuration and current link state.
POST
/payment-links/:id/confirmNo API keyVerifies the submitted payment, matches amount and payout destination, then creates the order.
json
{
"reference": "ABC123DE45",
"provider": "telebirr",
"buyerName": "Betty",
"buyerEmail": "[email protected]",
"buyerPhone": "0911223344"
}typescript
const apiUrl =
process.env.VERITAS_API_URL ?? "https://verifyapi.leulzenebe.pro";
const linkId = "payment_link_id";
const linkResponse = await fetch(`${apiUrl}/payment-links/${linkId}/public`);
const checkout = await linkResponse.json();
const confirmResponse = await fetch(
`${apiUrl}/payment-links/${linkId}/confirm`,
{
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
reference: "ABC123DE45",
provider: "telebirr",
buyerName: "Betty",
buyerEmail: "[email protected]",
buyerPhone: "0911223344",
}),
},
);
const confirmation = await confirmResponse.json();
if (!confirmResponse.ok || confirmation.success === false) {
throw new Error(confirmation.error ?? "Payment confirmation failed");
}Recent order
GET
/payment-links/:id/recent-orderPro or BusinessReturns a paid order summary for dashboard workflows.
typescript
import { veritas } from "@/lib/veritas";
const recentOrder = await veritas(
"/payment-links/payment_link_id/recent-order?orderId=order_id",
);