1

I've created a custom app using Shopify CLI and have my app embedded in Shopify POS.

When I try to add or remove customers to the cart, it's not sending a POST request to the promotions endpoint anymore. (I remember it was functioning well before). I followed all steps according to the doc.

I attached the extension setting of my app. All endpoints are correct (tested via Postman)

I can't find any helpful documents or forums.

What am I wrong? Any advice, very thank you!

This is my posRouter.js

const Router = require("koa-router");
const trackModel = require("../../models/trackModel");

const router = new Router({
  prefix: "/pos",
});

function register(app) {
  router.post("/promotions", async (ctx) => {
    const body = ctx.request.body;
    console.log("pos request", body);

    ctx.status = 200;
    ctx.body = {
      type: "simple_action_list",
      points_label: "Points balance",
      points_balance: "23867",
      actions: [
        {
          type: "flat_discount",
          title: "Add $5.00 discount",
          description: "-1000 points",
          action_id: "123ABC",
          value: "5",
        },
      ],
    };
  });

  router.post("/perform_action", async (ctx) => {});

  router.post("/revert_action", async (ctx) => {});
  app.use(router.routes());
  app.use(router.allowedMethods());
}

module.exports = register;
RM-Digit
  • 94
  • 8
  • It's hard to help you without seeing your code, please attach the code of how your are sending the post request. – Uttam Jan 28 '22 at 06:05
  • Thanks for the quick reply. I attached the code. According to the Shopify doc, it should send a POST request to the promtions point – RM-Digit Jan 28 '22 at 06:15
  • Did you make any progress on this? I am having a similar issue. – seth Oct 23 '22 at 03:18

0 Answers0