I'm working on creating web services for mobile applications to use drupal as backend. When ever the user applying a coupon code through mobile application, I'll get the coupon code through web services as JSON data.
So, How can I validate and apply the coupon to the order programmatically. I found the below answer from StackExchange (programmatically add line item of commerce_discount type to order). But, what value I need to pass for $discount_name. And how can I get it?
commerce_discount_fixed_amount(EntityDrupalWrapper $wrapper, $discount_name);