aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/shopify.js29
1 files changed, 29 insertions, 0 deletions
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);
+};