When a customer enters a discount code i would like to do a request to an external API to validate the discount code.
I'm new to Shopify and I cannot find a way in your documentation.
If this is possible can you point me in the right direction?
So the idea is:
1. customer adds a discount code
2. my personal shopify app does a request to external API
3. external API returns valid: true or false
4. app returns the response to shopify
5. shopify rejects or accepts the discount code based on valid true or false
Not sure who you're referring to as "the customer" in this case, but I'll do my best to answer both cases:
1. There's no way to add validation to the Shopify admin.
2. Checkout validates the discount code against what's present on the store.
If you want to add a validation for the store owner, you'd need to have them enter the discount code directly from your app. You could validate it within your application, and then call the API to create the discount code on Shopify. As for checkout, any discount codes that are entered there are validated against their presence / validity according to the shop, not any specific app.
Hope this helps!