import {fetch} from 'wix-fetch';
export function ConfirmOrder_click(event) { //Add your code for this event here: var CustomOrder={"order_id": "224477", "order_date": "2019-07-24", "pickup_location": "Shahapur", "channel_id": "", "comment": "Reseller: M/s Goku", "billing_customer_name": "Naruto", "billing_last_name": "Uzumaki", "billing_address": "House 221B, Leaf Village", "billing_address_2": "Near Hokage House", "billing_city": "New Delhi", "billing_pincode": "110002", "billing_state": "Delhi", "billing_country": "India", "billing_email": "naruto@uzumaki.com", "billing_phone": "9876543210", "shipping_is_billing": true, "shipping_customer_name": "", "shipping_last_name": "", "shipping_address": "", "shipping_address_2": "", "shipping_city": "", "shipping_pincode": "", "shipping_country": "", "shipping_state": "", "shipping_email": "", "shipping_phone": "", "order_items": [ { "name": "Kunai", "sku": "chakra123", "units": 10, "selling_price": "900", "discount": "", "tax": "", "hsn": 441122 } ], "payment_method": "Prepaid", "shipping_charges": 0, "giftwrap_charges": 0, "transaction_charges": 0, "total_discount": 0, "sub_total": 9000, "length": 10, "breadth": 15, "height": 20, "weight": 2.5 }
var headers=["Content-Type", "application/x-www-form-urlencoded;charset=UTF-8","Authorization","Bearer mytoken"];
const url = 'https://apiv2.shiprocket.in/v1/external/orders/create/adhoc'; async function getCreateOrder(){ const response = await fetch(url,{ method:"POST", headers:headers, body:CustomOrder }); const data = await response.json(); console.log(data); } getCreateOrder();
}
Ask on the Corvid Forum, as this forum is for the Wix Forum Application only.
wix.com/corvid/forum
var result = fetch("https://apiv2.shiprocket.in/v1/external/orders/create/adhoc",{ method:"POST", headers:headers, body:CustomOrder }); console.log(result);
i changed the fetch function to this but it returns {...}
Hi Aditi, did you get a response or working solution? I am struggling in this space as well