A payment is an explicit signed instruction.
Whether you transfer directly or accept a payment request, the wallet shows what will be signed and the ledger validates the exact payload.
Useful building blocks
Before you ask someone to pay
Choose the asset deliberately
A payment request never relies on a ticker alone.
Show the final amount
Use decimal strings at the edge and exact atomic units inside the ledger.
Let the wallet confirm
The payer signs the final payload with their own key.
Verify merchant payments on your server
Save the order's recipient, ledger, exact asset code, decimal amount, unique public reference, and expiry before asking for payment. Browser submitted events are hints. Your server independently reads the authoritative Worker, checks those saved terms, and fulfils once with a unique transaction-hash receipt.
Ordinary wallet payments are plain transfer transactions. The browser helper getPaymentStatus() checks that exact transfer. Hosted Ledra Checkout settles a transfer_batch: with the default 0.5% Checkout fee, a gross order of 1 Ledra Dollar (USDL) pays 0.995 USDL to the merchant and 0.005 USDL to the Checkout treasury in one atomic transaction. The batch summary amount is the total of both outputs.
For Checkout, forward both checkoutSessionId and transactionHash from the widget event to your server. The browser helper getCheckoutStatus() checks the paid session against the gross order terms and its settled hash. Your server uses @ldgr/client (0.6.0 or later) with the order's configured network to verify the authoritative receipt. Browser helpers remain UX hints only.
// Server code: npm install @ldgr/client@^0.6.0
import { createLdgrClient } from "@ldgr/client";
// Load your saved order; never take its terms from the browser.
const order = await orders.load(orderId);
const client = createLdgrClient({ network: order.network });
const receipt = await client.payments.verifyPayment({
transactionHash: submitted.transactionHash,
checkoutSessionId: submitted.checkoutSessionId,
}, {
to: order.recipient,
asset: order.assetCode,
amount: order.grossAmount, // Decimal string, including the Checkout fee.
reference: order.publicReference,
});
if (receipt.status !== "confirmed") return receipt;
// Your database transaction must check order expiry, reserve a unique
// (network, transactionHash) and optional session ID, and fulfil once.
await orders.fulfilOnce({
orderId: order.id,
network: order.network,
transactionHash: receipt.transactionHash,
checkoutSessionId: submitted.checkoutSessionId,
});payments.verifyPayment uses the explicit Checkout session ID when supplied and otherwise requires a plain transfer. Its statuses are confirmed, pending, expired,not_found, and mismatch. For a known Checkout session, payments.verifyCheckout also accepts its ID and saved expected terms, including an optional transaction hash. Verification does not store orders or perform database fulfilment.
A plain-transfer verifier intentionally rejects Checkout batches. Do not lower the order amount to the merchant's net receipt or accept arbitrary batches with Checkout-like metadata. The authoritative paid session binds the hash to the merchant and fee outputs checked at settlement. A paid session remains the receipt after its funding instruction expires.
LDGR supports declarative templates with named, reviewable rules. It does not offer a general-purpose smart-contract VM or opaque code execution.