The Clink Node.js SDK provides convenient access to the Clink API from applications written in server-side JavaScript or TypeScript. It includes TypeScript definitions for all request parameters and response fields.Documentation Index
Fetch the complete documentation index at: https://docs.clinkbill.com/llms.txt
Use this file to discover all available pages before exploring further.
NPM Package
View the package on npmjs.com
Installation
Install the package with your preferred package manager:Quick Start
To start using the SDK, you need to initialize the client with your API Key. You can find your secret keys in the Developers section of your Clink dashboard.uiMode: 'elements' and provide returnUrl, for example https://YOUR_DOMAIN/complete.html?session_id={ELEMENTS_SESSION_ID}. Clink replaces {ELEMENTS_SESSION_ID} with the created session ID.
API Overview
createCheckoutSession(options): Create a checkout session and get the redirecturl.getCheckoutSession(sessionId): Retrieve checkout session details.getOrder(orderId): Retrieve order details.getRefund(refundId): Retrieve refund details.getSubscription(subscriptionId): Retrieve subscription details.getInvoice(invoiceId): Retrieve subscription invoice details.customerPortalSession(options): Create a customer portal session and get the access link.
Error Handling
When the API returns a non-success status code (4xx or 5xx), the SDK throws an error. You should wrap your API calls intry/catch blocks.