aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-09-20 15:35:12 -0700
committerAdam Soltys <[email protected]>2023-09-20 15:38:06 -0700
commit27fa1e5479f285da62b761e36b7e7fb2b1319158 (patch)
tree6e786344c793695b1fdddefd9650f9e16b5ecca2 /routes
parentfb45ea1f665c5fc750e1bd09e3cc23be9c695133 (diff)
downloadcoinos-server-27fa1e5479f285da62b761e36b7e7fb2b1319158.tar.gz
coinos-server-27fa1e5479f285da62b761e36b7e7fb2b1319158.zip
shopify attributes
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);
+};