SDK Reference
Complete reference for the Inkress Server SDK, including authentication, available modules, and method signatures.
Getting Started
The Inkress SDK provides a server-side client for interacting with the Inkress platform. All API calls are authenticated using JWT tokens stored in your session.
1import inkress from "~/inkress.server";23export async function loader({ request }: LoaderFunctionArgs) {4 // Authenticate and get admin instance5 const { admin, session, user } = await inkress.authenticate(request);6 7 // Use admin methods to interact with API8 const merchant = await admin.merchant.get(session.merchant_id);9 10 return json({ merchant });11}Authentication
The authenticate() method extracts the JWT from the request, validates it, and returns an authenticated API instance.
1const { admin, session, user, valid } = await inkress.authenticate(request);2// admin: InkressAdminAPI instance with all modules3// session: { merchant_id, user_id, role_id, organization_id, ... }4// user: User object (if available)5// valid: boolean indicating if session is validUnauthenticated Access
For public endpoints that don't require authentication, use unauthenticated() method.
1const { admin } = await inkress.unauthenticated(request);2const tokens = await admin.merchant.getMerchantTokens(username);Available Modules
The admin object provides access to the following resource modules:
Standard CRUD Methods
Most modules extend RestModule and support these standard methods:
list(query?, headers?)
Retrieve a paginated list of resources.
1const response = await admin.paymentLink.list({2 limit: 50,3 offset: 0,4 status: 1 // active links only5});6// Returns: { state: 'ok', result: { entries: [...], total: 123 } }get(id, headers?)
Retrieve a single resource by ID.
1const response = await admin.merchant.get(merchantId);2// Returns: { state: 'ok', result: { id, name, username, ... } }create(data, headers?)
Create a new resource.
1const response = await admin.paymentLink.create({2 title: "Premium Subscription",3 total: 9900,4 currency_code: "JMD",5 description: "Monthly premium plan"6});7// Returns: { state: 'ok', result: { id, uid, ... } }update(id, data, headers?)
Update an existing resource.
1const response = await admin.merchant.update(merchantId, {2 status: 'active',3 verified: true4});5// Returns: { state: 'ok', result: { ... } }delete(id, headers?)
Delete a resource by ID.
1const response = await admin.paymentLink.delete(id);2// Returns: { state: 'ok' }Merchant Module
balances(data?, headers?)
Get merchant account balances.
1const response = await admin.merchant.balances();2// Returns: { 3// state: 'ok', 4// data: { 5// balance: 150000, 6// available_payout_balance: 145000,7// pending: 5000 8// } 9// }subscription()
Get merchant's current subscription plan.
1const response = await admin.merchant.subscription();2// Returns plan details with features and limitsinvoices()
List merchant's billing invoices.
1const response = await admin.merchant.invoices();getMerchantTokens(username)
Get public payment tokens for a merchant (unauthenticated endpoint).
1const response = await admin.merchant.getMerchantTokens('shop-username');2// Returns available payment methods and tokensgetConfig(id) / setConfig(id, data)
Get or update merchant configuration settings.
1const config = await admin.merchant.getConfig(merchantId);2await admin.merchant.setConfig(merchantId, { theme: 'dark' });Order Module
status(id)
Get basic order status.
1const response = await admin.order.status(orderId);2// Returns: { state: 'ok', result: { status: 'completed', ... } }fullStatus(id)
Get detailed order information including payment details.
1const response = await admin.order.fullStatus(orderId);2// Returns complete order with transactions, customer, productssetOrderStatus(id, data)
Update order status.
1await admin.order.setOrderStatus(orderId, { status: 'fulfilled' });getOrderStats()
Get order statistics and analytics.
1const stats = await admin.order.getOrderStats();2// Returns revenue, order counts, trends, etc.Payment Link Module
Extends RestModule with all CRUD methods (list, get, create, update, delete) plus:
invoice(uid)
Get payment link details by public UID (for checkout pages).
1const response = await admin.paymentLink.invoice(uid);2// Returns payment link with merchant info, products, etc.session(uid)
Get active payment session for a link.
1const response = await admin.paymentLink.session(uid);2// Returns session data if payment is in progressFinancial Requests Module
Manage payout requests and other financial operations. Extends RestModule with all CRUD methods.
List Payouts with Filters
1const response = await admin.financialRequests.list({2 limit: 50,3 type: 1, // 1 = payout requests4 status: 2, // 2 = processing5 inserted_at_min: '2024-01-01T00:00:00Z',6 inserted_at_max: '2024-12-31T23:59:59Z'7});Create Payout Request
1const response = await admin.financialRequests.create({2 type: 1, // payout3 sub_type: 2, // 1=standard, 2=expedited, 3=express4 total: 50000,5 source_id: walletId,6 destination_id: bankAccountId7});Response Format
Success Response
1{2 "state": "ok",3 "result": {4 // Resource data or list with pagination5 "entries": [...], // for list() calls6 "total": 123 // for list() calls7 }8}Error Response
1{2 "state": "error",3 "result": {4 "message": "Resource not found",5 "code": "not_found"6 }7}Parallel Requests
Use the multi() method to make multiple API calls in parallel:
1const [merchant, balances, payouts] = await admin.multi((api) => [2 () => api.merchant.get(session.merchant_id),3 () => api.merchant.balances(),4 () => api.financialRequests.list({ type: 1, limit: 10 })5]);