new Link2PayClient(options: Link2PayClientOptions)interface Link2PayClientOptions {
apiKey: string;
baseUrl?: string;
environment?: "sandbox" | "production";
timeoutMs?: number;
fetch?: typeof fetch;
userAgentSuffix?: string;
}paymentLinks:PaymentLinksResourcebaseUrl:string
create(request: CreatePaymentLinkRequest): Promise<PaymentLink>get(paymentLinkId: string): Promise<PaymentLink>Alias of retrieve(paymentLinkId).
retrieve(paymentLinkId: string): Promise<PaymentLink>list(query?: ListPaymentLinksQuery): Promise<ListPaymentLinksResponse>For JavaScript and TypeScript consumers, the SDK validates key inputs before network calls:
apiKeymust be a non-empty stringbaseUrlmust be a valid absolute URLtimeoutMsmust be a positive integerCreatePaymentLinkRequest.amountmust be a positive decimal string with up to 2 fraction digitsCreatePaymentLinkRequest.currencymust be a 3-letter uppercase ISO code (for example,USD)list({ limit })must use an integer from1to100
interface CreatePaymentLinkRequest {
amount: string;
currency: string;
reference: string;
customerEmail?: string;
redirectUrl?: string;
webhookUrl?: string;
expiresAt?: string;
metadata?: Record<string, string>;
}
interface PaymentLink {
id: string;
url: string;
status: "draft" | "active" | "paid" | "expired" | "cancelled";
settlementStatus: "pending" | "settled" | "failed";
amount: string;
currency: string;
reference: string;
customerEmail?: string;
redirectUrl?: string;
webhookUrl?: string;
expiresAt?: string;
paidAt?: string;
createdAt: string;
updatedAt: string;
metadata?: Record<string, string>;
}Import from the dedicated entrypoint:
import {
verifyWebhookSignature,
assertWebhookSignature
} from "@link2pay/sdk/webhooks";Returns true when signature and timestamp checks pass, otherwise false.
Throws WebhookSignatureError when verification fails.