How to implement ScriptDiscountApplication with StoreFront API?

Hello,

I’m trying to use ScriptDiscountApplication on my external application that is connected using the StoreFront API. I’m trying to run the automatic discounts and have them be visible in the cart before users checkout.

When using the graphql api , I’m not sure how to get started using ScriptDiscountApplication.

Would I create an checkoutLineItemsUpdate mutation and add the ScriptDiscount Object to it?

If anyone has experience with this and could help that would be great! I couldn’t find any documentation on how to use it.

Side note, we are using the Shopify Buy SDK , which generates a shopify checkout url and the checkout url gets the discounts updated automatically , but we also want to show what the discount will be in the cart before the customer checkouts.

Thanks!

https://shopify.dev/api/storefront/reference/checkouts/scriptdiscountapplication

Were you able to get anywhere with this? I am trying to figure out how to do something similar