$responseHandlerFactory = new ResponseHandlerFactory();
$factory = new ProcessorFactory();
$processor = $factory->getProcessor('default', $client, $messageFactory, $signer, $responseHandlerFactory, $host);
$merchant = new Merchant();
$merchant->setAccountId($accountId);
// OAuth
$oAuth = $merchant->getOAuth();
$oAuth->setConsumerKey($consumerKey);
$oAuth->setConsumerSecret($consumerSecret);
$oAuth->setOAuthToken($oAuthToken);
$oAuth->setOAuthTokenSecret($oAuthTokenSecret);
if ($_POST) {
    $m = $_POST['merchant'];
    try {
        // Foreign Reference
        $merchant->setId($m['id']);
        $processor->getMerchant($merchant);
        $success = 'Your merchant was found.';
    } catch (\Exception $e) {
        $error = sprintf('%s: %s', get_class($e), $e->getMessage());
    }
}
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title>Twitter Marketplace | Get Merchant | Demo</title>
    </head>
    <body>