Commerce: retrieve coupon code used in order
If you're using 1.x version, an entity reference field is attached to the commerce order field upon installation (see function commerce_coupon_order_configuration()). This creates the field table commerce_coupon_order_reference.

To check coupons attached to an order, simply access the commerce_coupon_order_reference field, like:

if (!empty($order-&gt;commerce_coupon_order_reference)) {
  // Traverse the coupons referenced by this order.
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  foreach ($order_wrapper-&gt;commerce_coupon_order_reference as $coupon_wrapper) {
    dpm($coupon_wrapper-&gt;value());
  }
}