Hi there,
I’m running into an issue where I am able to POST an order to Shopify through Postman, but when I try to recreate it in my app I get the following error:
{"errors":{"order":"Required parameter missing or invalid"}}
Below is my code:
var testOrder = {
"order": {
"email": "email10+TEST@gmail.com",
"shipping_address":
{ "address1": "10 Erb St.",
"city": "Toronto",
"province": "ON",
"country": "CA",
"zip": "N2N 1N5",
"company": null,
"first_name": "JOE",
"last_name": "TEST" },
"phone": null,
"line_items": [
{
"variant_id": 42331988931,
"price": "300.0",
"quantity": 1
}
],
"discount_codes": [ { "code": "25%OFF", "amount": "25", "type": "percentage" } ],
"tags": "27900202",
"note": "test",
"shipping_lines": [ { "title": "test", "price": "30.00", "code": "test" } ],
"total_tax": "25.5"
}
};
var shopifyOrderOptions = {
url: "https://{apikey}:{password}@{site}.myshopify.com/admin/api/2019-07/orders.json",
headers : { 'Content-Type': 'application/json' },
data: testOrder
request.post(shopifyOrderOptions, (err, res, body) => {
if (err) { console.log(err); }
console.log(body);
});
Please let me know what I’m doing wrong. Thanks!