Integrating Qikink's Print-on-Demand API with Node.js
I spent days figuring out the parts Qikink's docs don't clearly explain, so here is the short version that actually helps you ship.
Qikink's API is straightforward once you know a few hidden rules:
- Sandbox and Live do not share the same product database
-
search_from_my_productsbehaves differently depending on the environment - Auth uses
ClientId,client_secret, andAccesstoken -
order_numbermust stay within 15 characters -
quantity,price, andtotal_order_valuemust be strings
Authentication
Token generation must use form-urlencoded data, not JSON:
import axios from 'axios';
const getQikinkToken = async (): Promise<string> => {
const isSandbox = process.env.QIKINK_SANDBOX_MODE === 'true';
const baseUrl = isSandbox
? 'https://sandbox.qikink.com'
: 'https://api.qikink.com';
const clientSecret = isSandbox
? process.env.QIKINK_SANDBOX_SECRET!
: process.env.QIKINK_CLIENT_SECRET!;
const params = new URLSearchParams();
params.append('ClientId', process.env.QIKINK_CLIENT_ID!);
params.append('client_secret', clientSecret);
const response = await axios.post(`${baseUrl}/api/token`, params, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
});
return response.data?.Accesstoken;
};
Order Creation
const payload = {
order_number: 'APP123456789012',
qikink_shipping: '1',
gateway: 'Prepaid',
total_order_value: '799',
line_items: [
{
search_from_my_products: 1,
sku: 'USs-Wh-M',
quantity: '1',
price: '799'
}
],
shipping_address: {
first_name: 'John',
last_name: 'Doe',
address1: '123 Main Street',
address2: '',
phone: '9876543210',
email: 'john.doe@example.com',
city: 'Mumbai',
zip: '400001',
province: 'Maharashtra',
country_code: 'IN'
}
};
If Sandbox gives you Invalid SKU, it usually means you used search_from_my_products: 1 even though the product does not exist in Sandbox.
For Sandbox testing, use search_from_my_products: 0 and provide the required design fields manually.
Common Errors
Invalid SKU
Sandbox cannot see your dashboard products.Design code, Mockup Link and placement sku is mandatory
You left required design fields empty while usingsearch_from_my_products: 0.Order no. cannot exceed 15 chars
Shorten yourorder_number.401 Unauthorized
Refresh the token and retry.
Final Note
Qikink becomes much easier once you understand the Sandbox vs Live difference and the exact request format. After that, the integration is pretty clean.
Read the full blog here: Integrating Qikink's Print-on-Demand API with Node.js
Top comments (0)