Update checkout via API after receiving checkout webhook

New Member
1 0 0

Hi. We're a newbie Shopify partner running loyalty programmes for multichannel retailers. We have a retailer with Shopify e-commerce and a non-Shopify POS in their physical stores. The loyalty programme they have entitles the customer to a percentage discount on total order value depending on the customer's loyalty status, e.g. "Silver members always get 10% off their order".

We allow the discounts in the non-Shopify POS as follows:

  1. POS calls our API with the customer details and total order value
  2. Our API responds with a "voucher" of monetary value equivalent to the percentage value of their order
  3. POS applies the voucher as an applied discount on the order

We want to implement something similar for the same customers in Shopify, e.g:

  1. Webhook sent on checkout/create or checkout/update event in Shopify (we receive these webhooks already)
  2. We (in our Shopify app) receive webhook showing line items and total order value
  3. We calculate applied monetary discount value based on identifying customer and the total order value
  4. We connect to Shopify API and add applied discount of monetary value to checkout
  5. Checkout updated to reflect discounted monetary value

Is this possible? Which Shopify API resource should we be using in step 4 where we would apply the discount to the checkout? How would this be re-rendered in the Shopify UI?

We're trying out various API endpoints but haven't quite worked out which ones to use for this yet. The challenge is that we still need to mix the Shopify store and the non-Shopify POS to apply the same dynamic discounts to customer orders. 

Thanks in advance if anyone has any input!