From 27fa1e5479f285da62b761e36b7e7fb2b1319158 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 20 Sep 2023 15:35:12 -0700 Subject: shopify attributes --- routes/shopify.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 routes/shopify.js (limited to 'routes') diff --git a/routes/shopify.js b/routes/shopify.js new file mode 100644 index 00000000..f15a3468 --- /dev/null +++ b/routes/shopify.js @@ -0,0 +1,29 @@ +import got from "got"; + +let query = `mutation orderMarkAsPaid($input: OrderMarkAsPaidInput!) { + orderMarkAsPaid(input: $input) { + order { id } + userErrors { + field + message + } + } +}`; + +export default async ({ body, params: { id }, user }, res) => { + let r = await got.post( + `https://${user.shopifyStore}.myshopify.com/admin/api/2023-07/graphql.json`, + { + headers: { + "Content-Type": "application/json", + "X-Shopify-Access-Token": user.shopifyToken + }, + json: { + query, + variables: { input: { id: `gid://shopify/Order/${id}` } } + } + } + ).json(); + + res.send(r); +}; -- cgit v1.2.3