Effortless integration of any API,SDK or library

Wreken is built for devs for accurate,efficient and effortless integration with any API/SDK or library.

Get started for free

See it in action

Company
GoKwik
API SDK
NodeJS
Method
Create Order
//<wreken>Create Order<wreken>
const axios = require('axios');
/**
* Creates an order with the given order details.
*
* @param {Object} order - The order details.
* - id: STRING - Unique identifier for the order.
* - cart_id: STRING - Cart identifier associated with the order.
* - status: STRING - Current status of the order.
* - subtotal: INTEGER - Subtotal amount of the order.
* - total_line_items: INTEGER - Total number of line items in the order.
* - total_line_items_quantity: INTEGER - Total quantity of line items.
* - total_tax: INTEGER - Total tax amount.
* - total_shipping: INTEGER - Total shipping cost.
* - total_discount: INTEGER - Total discount applied.
* - total: INTEGER - Total amount of the order.
* - promo_code: STRING - Promo code applied to the order.
* - source: STRING - Source from where the order was placed.
* - payment_details: STRUCT(payment) - Payment details.
* - method_id: STRING - Payment method identifier.
* - billing_address: STRUCT(b_address) - Billing address.
* - first_name: STRING
* - last_name: STRING
* - company: STRING
* - address_1: STRING
* - address_2: STRING
* - city: STRING
* - state: STRING
* - postcode: STRING
* - country: STRING
* - email: STRING
* - phone: STRING
* - shipping_address: STRUCT(s_address) - Shipping address (same structure as billing_address).
* - customer_ip: INTEGER - IP address of the customer.
* - customer_user_agent: STRING - User agent of the customer's device.
* - line_items: STRUCT[](items) - List of line items in the order.
* - product_id: INTEGER
* - variant_id: INTEGER
* - product_url: STRING
* - line_item_id: STRING
* - name: STRING
* - sku: STRING
* - price: INTEGER
* - quantity: INTEGER
* - subtotal: INTEGER
* - total: INTEGER
* - tax: INTEGER
* - product_thumbnail_url: STRING
* - awb_number: STRING
* - awb_status: STRING
* - shipping_provider: STRING
* @param {String} request_id - A unique identifier for the request.
* @returns {Promise<Object>} - The result of the create order operation.
*/
async function createOrder(order, request_id) {
try {
const response = await axios.post('https://sandbox.gokwik.co/v1/order/create', {
order,
request_id
}, {
headers: {
'Authorization': 'bearer_token', // Replace 'bearer_token' with your actual bearer token.
'Content-Type': 'application/json'
}
});
// Handle response based on the HTTP status code.
switch (response.status) {
case 200:
// Success response structure.
console.log('Order created successfully:', response.data);
break;
case 404:
console.error('Order not found:', response.data);
break;
case 409:
console.error('Conflict in creating order:', response.data);
break;
default:
console.error('Unexpected status code received:', response.status);
}
} catch (error) {
console.error('Error creating order:', error);
}
}
// Example usage:
// createOrder({
// // Provide the order details here.
// }, 'your_request_id_here');

Effortless Integration, Accurate Results

Any API/SDK

Any API/SDK

Add any API/SDK and get integration ready sample code supported in 15 languages.

Save time

Save time

Be awesome,spend less time integrating and more time building great products.

Direct integration

Direct integration

Directly integrate any API/SDK, no rate limits and no bottlenecks

Request API/SDK Integration

May the power of AI be with you

Get started for free