Get related entries in plugin via Entries field type
First, you should get all the Merchant Entries with the merchantId of 123

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section('merchants');
$criteria-&gt;merchantId = '123';

$merchants = $criteria-&gt;find();


Next, find all Gift Card entries that are related to the found merchants.

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = 'giftCards';
$criteria-&gt;relatedTo = array(
    'targetElement' =&gt; $merchants,
    'field' =&gt; 'YOUR-ENTRIES-FIELD'
);

$gift_cards = $criteria-&gt;find();