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.

app/routes/example.tsxtypescript
1import inkress from "~/inkress.server";
2
3export async function loader({ request }: LoaderFunctionArgs) {
4 // Authenticate and get admin instance
5 const { admin, session, user } = await inkress.authenticate(request);
6
7 // Use admin methods to interact with API
8 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 modules
3// session: { merchant_id, user_id, role_id, organization_id, ... }
4// user: User object (if available)
5// valid: boolean indicating if session is valid

Unauthenticated 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:

admin.merchant
admin.order
admin.paymentLink
admin.financialRequests
admin.financialAccounts
admin.plan
admin.subscription
admin.transaction
admin.user
admin.product
admin.fee
admin.template
admin.webhookUrls
admin.addresses
admin.legalRequests
admin.file
admin.category

Standard CRUD Methods

Most modules extend RestModule and support these standard methods:

list(query?, headers?)

Retrieve a paginated list of resources.

List Payment Linkstypescript
1const response = await admin.paymentLink.list({
2 limit: 50,
3 offset: 0,
4 status: 1 // active links only
5});
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.

Example: Create Payment Linktypescript
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: true
4});
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 limits

invoices()

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 tokens

getConfig(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, products

setOrderStatus(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 progress

Financial 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 requests
4 status: 2, // 2 = processing
5 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, // payout
3 sub_type: 2, // 1=standard, 2=expedited, 3=express
4 total: 50000,
5 source_id: walletId,
6 destination_id: bankAccountId
7});

Response Format

Success Response

1{
2 "state": "ok",
3 "result": {
4 // Resource data or list with pagination
5 "entries": [...], // for list() calls
6 "total": 123 // for list() calls
7 }
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]);